diff options
| author | winter | 2024-12-08 23:18:35 +0000 |
|---|---|---|
| committer | winter | 2024-12-08 23:18:35 +0000 |
| commit | bda28640d6e066ae338c6f31407df274ed09f026 (patch) | |
| tree | 2a887dd4f98f79fc11efefc9585c58e144f66a00 /WpfTest/Model/NotePrivacy.php | |
| parent | b00185ddbac9ac3de975a3954f2ede2f24458f6a (diff) | |
implement remote object fetching!
this is most of the tricky parts of inbound federation :3
Diffstat (limited to 'WpfTest/Model/NotePrivacy.php')
| -rw-r--r-- | WpfTest/Model/NotePrivacy.php | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/WpfTest/Model/NotePrivacy.php b/WpfTest/Model/NotePrivacy.php index b7ed58a..b955447 100644 --- a/WpfTest/Model/NotePrivacy.php +++ b/WpfTest/Model/NotePrivacy.php @@ -3,14 +3,37 @@ namespace WpfTest\Model; use WpfTest\Model; -class NotePrivacy extends Model { +class NotePrivacy extends Model implements \JsonSerializable { + public ?int $noteId; public NotePrivacyScope $scope; /** * @var Actor[] */ public array $alsoVisibleTo = []; public bool $indexable; - public NotePrivacyInteractors $canReshare = NotePrivacyInteractors::all; - public NotePrivacyInteractors $canReply = NotePrivacyInteractors::all; - public NotePrivacyInteractors $canOtherInteract = NotePrivacyInteractors::all; + public NotePrivacyInteractors $canReshare = NotePrivacyInteractors::ALL; + public NotePrivacyInteractors $canReply = NotePrivacyInteractors::ALL; + public NotePrivacyInteractors $canOtherInteract = NotePrivacyInteractors::ALL; + + protected function setOwnerId(int $id) { + $this->noteId = $id; + } + + protected function getUpdateWhereClause($db): ?string { + if (self::findWhere('note_id = ?', [$this->noteId]) != null) { + return "note_id = $this->noteId"; + } + return null; + } + + public function jsonSerialize(): array { + return [ + 'scope' => $this->scope->value, + 'alsoVisibleTo' => $this->alsoVisibleTo, + 'indexable' => $this->indexable, + 'canReshare' => $this->canReshare->value, + 'canReply' => $this->canReply->value, + 'canOtherInteract' => $this->canOtherInteract->value + ]; + } }
\ No newline at end of file |
