Allow notes to be syndicated to Mastodon

This commit is contained in:
Jonny Barnes 2022-11-04 15:23:31 +00:00
parent ffe90b9399
commit 72cb4fd7eb
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
11 changed files with 200 additions and 5 deletions

View file

@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Services;
use App\Jobs\SendWebMentions;
use App\Jobs\SyndicateNoteToMastodon;
use App\Jobs\SyndicateNoteToTwitter;
use App\Models\Media;
use App\Models\Note;
@ -58,6 +59,10 @@ class NoteService
dispatch(new SyndicateNoteToTwitter($note));
}
if (in_array('mastodon', $this->getSyndicationTargets($request), true)) {
dispatch(new SyndicateNoteToMastodon($note));
}
return $note;
}
@ -212,6 +217,9 @@ class NoteService
if ($target && $target->service_name === 'Twitter') {
$syndication[] = 'twitter';
}
if ($target && $target->service_name === 'Mastodon') {
$syndication[] = 'mastodon';
}
}
return $syndication;