aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/Model/Note.php
diff options
context:
space:
mode:
Diffstat (limited to 'Digitigrade/Model/Note.php')
-rw-r--r--Digitigrade/Model/Note.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/Digitigrade/Model/Note.php b/Digitigrade/Model/Note.php
index 3b7c362..1e867fa 100644
--- a/Digitigrade/Model/Note.php
+++ b/Digitigrade/Model/Note.php
@@ -3,7 +3,7 @@ namespace Digitigrade\Model;
use Digitigrade\Db;
-class Note extends FetchableModel implements \JsonSerializable {
+class Note extends PushableModel {
public ?int $id;
public string $uri;
public \DateTimeImmutable $created;
@@ -44,6 +44,11 @@ class Note extends FetchableModel implements \JsonSerializable {
$this->attachments = NoteAttachment::findAllWhere('note_id = ?', [$this->id]);
}
+ protected function validate(): bool {
+ // author has to be from the same instance as the note itself
+ return hostname_from_uri($this->author->uri) == hostname_from_uri($this->uri);
+ }
+
private function findFormattedContents(): array {
$pdo = Db::getInstance()->getPdo();
$stmt = $pdo->prepare('SELECT mimetype, body FROM note_formatted_content WHERE note_id = ?');