mirror of
https://github.com/NicolasConstant/sengi
synced 2025-02-08 16:08:40 +01:00
added move notification support
This commit is contained in:
parent
8c76056747
commit
8b849a6650
@ -83,7 +83,7 @@ export class MentionsComponent extends TimelineBase {
|
||||
|
||||
protected getNextStatuses(): Promise<Status[]> {
|
||||
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);
|
||||
|
||||
|
@ -50,6 +50,25 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div *ngIf="notification.type === 'move'">
|
||||
<div class="stream__notification--icon" title="{{notification.account.acct}}">
|
||||
<fa-icon class="followed" [icon]="faTruckMoving"></fa-icon>
|
||||
</div>
|
||||
<div class="stream__notification--label">
|
||||
<a href class="stream__link" title="{{notification.account.acct}}"
|
||||
(click)="openAccount(notification.account)" (auxclick)="openUrl(notification.account.url)"
|
||||
innerHTML="{{ notification.account | accountEmoji }}"></a>
|
||||
migrated to
|
||||
</div>
|
||||
|
||||
<a href (click)="openAccount(notification.target)" (auxclick)="openUrl(notification.target.url)"
|
||||
class="follow-account" title="{{notification.target.acct}}">
|
||||
<img class="follow-account__avatar" src="{{ notification.target.avatar }}" />
|
||||
<span class="follow-account__display-name" innerHTML="{{ notification.target | accountEmoji }}"></span>
|
||||
<span class="follow-account__acct">@{{ notification.target.acct }}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<app-status *ngIf="notification.status && notification.type !== 'mention'" class="stream__status" [statusWrapper]="notification.status"
|
||||
[notificationAccount]="notification.account" [notificationType]="notification.type"
|
||||
(browseAccountEvent)="browseAccount($event)" (browseHashtagEvent)="browseHashtag($event)"
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { faUserPlus, faUserClock, faCheck, faTimes } from "@fortawesome/free-solid-svg-icons";
|
||||
import { faUserPlus, faUserClock, faCheck, faTimes, faTruckMoving } from "@fortawesome/free-solid-svg-icons";
|
||||
|
||||
import { NotificationWrapper } from '../notifications.component';
|
||||
import { ToolsService } from '../../../../../services/tools.service';
|
||||
@ -18,6 +18,7 @@ export class NotificationComponent extends BrowseBase {
|
||||
faUserClock = faUserClock;
|
||||
faCheck = faCheck;
|
||||
faTimes = faTimes;
|
||||
faTruckMoving = faTruckMoving;
|
||||
|
||||
@Input() notification: NotificationWrapper;
|
||||
|
||||
|
@ -156,6 +156,7 @@ export class NotificationWrapper {
|
||||
break;
|
||||
}
|
||||
this.account = notification.account;
|
||||
this.target = notification.target;
|
||||
this.wrapperId = `${this.type}-${notification.id}`;
|
||||
this.notification = notification;
|
||||
this.provider = provider;
|
||||
@ -165,6 +166,7 @@ export class NotificationWrapper {
|
||||
notification: Notification;
|
||||
wrapperId: string;
|
||||
account: Account;
|
||||
target: Account;
|
||||
status: StatusWrapper;
|
||||
type: 'mention' | 'reblog' | 'favourite' | 'follow' | 'poll' | 'follow_request';
|
||||
type: 'mention' | 'reblog' | 'favourite' | 'follow' | 'poll' | 'follow_request' | 'move';
|
||||
}
|
@ -237,7 +237,7 @@ export class StreamNotificationsComponent extends BrowseBase {
|
||||
|
||||
this.isMentionsLoading = true;
|
||||
|
||||
this.mastodonService.getNotifications(this.account, ['follow', 'favourite', 'reblog', 'poll', 'follow_request'], this.lastMentionId)
|
||||
this.mastodonService.getNotifications(this.account, ['follow', 'favourite', 'reblog', 'poll', 'follow_request', 'move'], this.lastMentionId)
|
||||
.then((result: Notification[]) => {
|
||||
if (result.length === 0) {
|
||||
this.mentionsMaxReached = true;
|
||||
|
@ -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<Notification[]> {
|
||||
getNotifications(account: AccountInfo, excludeTypes: ('follow' | 'favourite' | 'reblog' | 'mention' | 'poll' | 'follow_request' | 'move')[] = null, maxId: string = null, sinceId: string = null, limit: number = 15): Promise<Notification[]> {
|
||||
return this.refreshAccountIfNeeded(account)
|
||||
.then((refreshedAccount: AccountInfo) => {
|
||||
return this.mastodonService.getNotifications(refreshedAccount, excludeTypes, maxId, sinceId, limit);
|
||||
|
@ -311,7 +311,7 @@ export class MastodonService {
|
||||
return this.httpClient.put<Attachment>(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<Notification[]> {
|
||||
getNotifications(account: AccountInfo, excludeTypes: ('follow' | 'favourite' | 'reblog' | 'mention' | 'poll' | 'follow_request' | 'move')[] = null, maxId: string = null, sinceId: string = null, limit: number = 15): Promise<Notification[]> {
|
||||
let route = `https://${account.instance}${this.apiRoutes.getNotifications}?limit=${limit}`;
|
||||
|
||||
if (maxId) {
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user