[AP] Support Private Messaging

ActivityPubPlugin:
- Subscribe DirectMessage events

Activitypub_inbox_handler:
- Update handle_create_note to create private messages

Activitypub_postman:
- Add create_direct_note for sending private messages

Activitypub_create:
- Update create_to_array to support the 'directMessage' attribute
- Add isPrivateNote to verify private activities

Activitypub_notice:
- Update create_note to support the 'directMessage' attribute
- Remove isPrivateNote

lib/models:
- Add Activitypub_message, the model in charge of private notes
This commit is contained in:
tenma
2019-08-19 23:33:18 +01:00
committed by Diogo Cordeiro
parent 9733f3c02c
commit ebeae261de
6 changed files with 225 additions and 34 deletions

View File

@@ -206,8 +206,8 @@ class Activitypub_inbox_handler
*/
private function handle_create_note()
{
if (Activitypub_notice::isPrivateNote($this->activity)) {
// Plugin DirectMessage must handle this
if (Activitypub_create::isPrivateNote($this->activity)) {
Activitypub_message::create_message($this->object, $this->actor);
} else {
Activitypub_notice::create_notice($this->object, $this->actor);
}
@@ -226,8 +226,7 @@ class Activitypub_inbox_handler
$object = $object['id'];
}
// some moderator could already have deleted the
// notice, so we test it first
// Already deleted? (By some admin, perhaps?)
try {
$found = Deleted_notice::getByUri($object);
$deleted = ($found instanceof Deleted_notice);