feat(notif): issue notifications (#2242)

* feat(notif): issue notifications

* refactor: dedupe test notification strings

* fix: webhook key parsing

* fix(notif): skip send for admin who requested on behalf of another user

* fix(notif): send comment notifs to admins when other admins reply

* fix(notif): also send resolved notifs to admins, and reopened notifs to issue creator

* fix: don't send duplicate notifications

* fix(lang): tweak notification description strings

* fix(notif): tweak Slack notification styling

* fix(notif): tweak Pushbullet & Telegram notification styling

* docs: reformat webhooks page

* fix(notif): add missing issue_type & issue_status variables to LunaSea notif payloads

* fix: explicitly attach media & issue objects where applicable

* fix(notif): correctly notify both notifyUser and managers where applicable

* fix: update default webhook payload for new installs

* fix(notif): add missing comment_message to LunaSea notif payload

* refactor(sw): simplify notificationclick event listener logic

* fix(notif): add missing event description for MEDIA_AVAILABLE notifications
This commit is contained in:
TheCatLady
2021-12-04 07:24:26 -05:00
committed by GitHub
parent 6245be1e10
commit c9ffac33f7
30 changed files with 1014 additions and 804 deletions

View File

@@ -31,6 +31,8 @@ export class MediaSubscriber implements EntitySubscriberInterface<Media> {
relatedRequests.forEach((request) => {
notificationManager.sendNotification(Notification.MEDIA_AVAILABLE, {
event: 'Movie Now Available',
notifyAdmin: false,
notifyUser: request.requestedBy,
subject: `${movie.title}${
movie.release_date ? ` (${movie.release_date.slice(0, 4)})` : ''
@@ -42,7 +44,7 @@ export class MediaSubscriber implements EntitySubscriberInterface<Media> {
}),
media: entity,
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${movie.poster_path}`,
request: request,
request,
});
});
}
@@ -91,6 +93,7 @@ export class MediaSubscriber implements EntitySubscriberInterface<Media> {
);
const tv = await tmdb.getTvShow({ tvId: entity.tmdbId });
notificationManager.sendNotification(Notification.MEDIA_AVAILABLE, {
event: 'Series Now Available',
subject: `${tv.name}${
tv.first_air_date ? ` (${tv.first_air_date.slice(0, 4)})` : ''
}`,
@@ -99,18 +102,19 @@ export class MediaSubscriber implements EntitySubscriberInterface<Media> {
separator: /\s/,
omission: '…',
}),
notifyAdmin: false,
notifyUser: request.requestedBy,
image: `https://image.tmdb.org/t/p/w600_and_h900_bestv2${tv.poster_path}`,
media: entity,
extra: [
{
name: 'Seasons',
name: 'Requested Seasons',
value: request.seasons
.map((season) => season.seasonNumber)
.join(', '),
},
],
request: request,
request,
});
}
}