From 8b849a6650466c2e0f3e8244090218ab21941664 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Mon, 21 Dec 2020 23:12:47 -0500 Subject: [PATCH] added move notification support --- .../mentions/mentions.component.ts | 2 +- .../notification/notification.component.html | 19 +++++++++++++++++++ .../notification/notification.component.ts | 3 ++- .../notifications/notifications.component.ts | 4 +++- .../stream-notifications.component.ts | 2 +- src/app/services/mastodon-wrapper.service.ts | 2 +- src/app/services/mastodon.service.ts | 2 +- .../services/models/mastodon.interfaces.ts | 3 ++- src/app/services/user-notification.service.ts | 2 +- 9 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/app/components/floating-column/manage-account/mentions/mentions.component.ts b/src/app/components/floating-column/manage-account/mentions/mentions.component.ts index f4529731..61288d72 100644 --- a/src/app/components/floating-column/manage-account/mentions/mentions.component.ts +++ b/src/app/components/floating-column/manage-account/mentions/mentions.component.ts @@ -83,7 +83,7 @@ export class MentionsComponent extends TimelineBase { protected getNextStatuses(): Promise { console.warn('MENTIONS get next status'); - return this.mastodonService.getNotifications(this.account, ['follow', 'favourite', 'reblog', 'poll'], this.lastId) + return this.mastodonService.getNotifications(this.account, ['follow', 'favourite', 'reblog', 'poll', 'move'], this.lastId) .then((result: Notification[]) => { const statuses = result.map(x => x.status); diff --git a/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html index a91f1481..93d2f28d 100644 --- a/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html +++ b/src/app/components/floating-column/manage-account/notifications/notification/notification.component.html @@ -50,6 +50,25 @@ +
+
+ +
+
+ + migrated to +
+ + +
+ { if (result.length === 0) { this.mentionsMaxReached = true; diff --git a/src/app/services/mastodon-wrapper.service.ts b/src/app/services/mastodon-wrapper.service.ts index 4dde19f8..9452ced7 100644 --- a/src/app/services/mastodon-wrapper.service.ts +++ b/src/app/services/mastodon-wrapper.service.ts @@ -252,7 +252,7 @@ export class MastodonWrapperService { }); } - getNotifications(account: AccountInfo, excludeTypes: ('follow' | 'favourite' | 'reblog' | 'mention' | 'poll' | 'follow_request')[] = null, maxId: string = null, sinceId: string = null, limit: number = 15): Promise { + getNotifications(account: AccountInfo, excludeTypes: ('follow' | 'favourite' | 'reblog' | 'mention' | 'poll' | 'follow_request' | 'move')[] = null, maxId: string = null, sinceId: string = null, limit: number = 15): Promise { return this.refreshAccountIfNeeded(account) .then((refreshedAccount: AccountInfo) => { return this.mastodonService.getNotifications(refreshedAccount, excludeTypes, maxId, sinceId, limit); diff --git a/src/app/services/mastodon.service.ts b/src/app/services/mastodon.service.ts index 09302276..f5e5973d 100644 --- a/src/app/services/mastodon.service.ts +++ b/src/app/services/mastodon.service.ts @@ -311,7 +311,7 @@ export class MastodonService { return this.httpClient.put(route, input, { headers: headers }).toPromise(); } - getNotifications(account: AccountInfo, excludeTypes: ('follow' | 'favourite' | 'reblog' | 'mention' | 'poll' | 'follow_request')[] = null, maxId: string = null, sinceId: string = null, limit: number = 15): Promise { + getNotifications(account: AccountInfo, excludeTypes: ('follow' | 'favourite' | 'reblog' | 'mention' | 'poll' | 'follow_request' | 'move')[] = null, maxId: string = null, sinceId: string = null, limit: number = 15): Promise { let route = `https://${account.instance}${this.apiRoutes.getNotifications}?limit=${limit}`; if (maxId) { diff --git a/src/app/services/models/mastodon.interfaces.ts b/src/app/services/models/mastodon.interfaces.ts index 6aa2956a..c1668a7a 100644 --- a/src/app/services/models/mastodon.interfaces.ts +++ b/src/app/services/models/mastodon.interfaces.ts @@ -130,10 +130,11 @@ export interface Mention { export interface Notification { id: string; - type: 'mention' | 'reblog' | 'favourite' | 'follow' | 'poll' | 'follow_request'; + type: 'mention' | 'reblog' | 'favourite' | 'follow' | 'poll' | 'follow_request' | 'move'; created_at: string; account: Account; status?: Status; + target?: Account; //for move Pleroma's notification } export interface Relationship { diff --git a/src/app/services/user-notification.service.ts b/src/app/services/user-notification.service.ts index f8cc94cb..7110bafd 100644 --- a/src/app/services/user-notification.service.ts +++ b/src/app/services/user-notification.service.ts @@ -58,7 +58,7 @@ export class UserNotificationService { } private startFetchingNotifications(account: AccountInfo) { - let getMentionsPromise = this.mastodonService.getNotifications(account, ['favourite', 'follow', 'reblog', 'poll', 'follow_request'], null, null, 10) + let getMentionsPromise = this.mastodonService.getNotifications(account, ['favourite', 'follow', 'reblog', 'poll', 'follow_request', 'move'], null, null, 10) .then((notifications: Notification[]) => { this.processMentionsAndNotifications(account, notifications, NotificationTypeEnum.UserMention); })