forked from GNUsocial/gnu-social
[ENTITY][Note] Add deleter
This commit is contained in:
parent
b1585f0ef2
commit
5f167517ad
@ -360,6 +360,23 @@ class Note extends Entity
|
||||
return $mentioned;
|
||||
}
|
||||
|
||||
public function delete(?int $actor_id = null, string $source = 'web'): bool
|
||||
{
|
||||
if (Event::handle('NoteDeleteRelated', [&$this]) === Event::next) {
|
||||
DB::persist(Activity::create([
|
||||
'actor_id' => $actor_id ?? $this->getActorId(),
|
||||
'verb' => 'delete',
|
||||
'object_type' => 'note',
|
||||
'object_id' => $this->getId(),
|
||||
'source' => $source
|
||||
])
|
||||
);
|
||||
DB::remove($this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function schemaDef(): array
|
||||
{
|
||||
return [
|
||||
|
Loading…
Reference in New Issue
Block a user