|
3 | 3 | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. |
4 | 4 | // See the LICENCE file in the repository root for full licence text. |
5 | 5 |
|
| 6 | +declare(strict_types=1); |
| 7 | + |
6 | 8 | namespace App\Jobs\Notifications; |
7 | 9 |
|
8 | | -use App\Models\Chat\Message; |
9 | 10 | use App\Models\Notification; |
10 | | -use App\Models\User; |
11 | 11 |
|
12 | | -class ChannelAnnouncement extends BroadcastNotificationBase |
| 12 | +class ChannelAnnouncement extends ChannelMessageBase |
13 | 13 | { |
14 | 14 | const DELIVERY_MODE_DEFAULTS = ['mail' => true, 'push' => true]; |
15 | 15 |
|
16 | | - protected $message; |
17 | | - |
18 | 16 | public static function getBaseKey(Notification $notification): string |
19 | 17 | { |
20 | 18 | return 'channel.announcement.announce'; |
21 | 19 | } |
22 | 20 |
|
23 | | - public static function getMailLink(Notification $notification): string |
24 | | - { |
25 | | - return route('chat.index', ['channel_id' => $notification->notifiable_id]); |
26 | | - } |
27 | | - |
28 | | - public function __construct(Message $message, User $source) |
29 | | - { |
30 | | - parent::__construct($source); |
31 | | - |
32 | | - $this->message = $message; |
33 | | - } |
34 | | - |
35 | 21 | public function getDetails(): array |
36 | 22 | { |
37 | 23 | $channel = $this->message->channel; |
38 | 24 |
|
39 | 25 | return [ |
| 26 | + ...parent::getDetails(), |
40 | 27 | 'channel_id' => $channel->getKey(), |
41 | 28 | 'name' => $channel->name, |
42 | | - 'title' => truncate($this->message->content, static::CONTENT_TRUNCATE), |
43 | | - 'type' => strtolower($channel->type), |
44 | | - 'cover_url' => $this->source->user_avatar, |
45 | 29 | ]; |
46 | 30 | } |
47 | | - |
48 | | - public function getListeningUserIds(): array |
49 | | - { |
50 | | - return $this->message->channel->userIds(); |
51 | | - } |
52 | | - |
53 | | - public function getNotifiable() |
54 | | - { |
55 | | - return $this->message->channel; |
56 | | - } |
57 | 31 | } |
0 commit comments