v12 (#5712)
Co-authored-by: MeiMei <30769358+mei23@users.noreply.github.com> Co-authored-by: Satsuki Yanagi <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
parent
a5955c1123
commit
f6154dc0af
871 changed files with 26140 additions and 71950 deletions
59
src/client/scripts/compose-notification.ts
Normal file
59
src/client/scripts/compose-notification.ts
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
import getNoteSummary from '../../misc/get-note-summary';
|
||||
import getUserName from '../../misc/get-user-name';
|
||||
|
||||
type Notification = {
|
||||
title: string;
|
||||
body: string;
|
||||
icon: string;
|
||||
onclick?: any;
|
||||
};
|
||||
|
||||
// TODO: i18n
|
||||
|
||||
export default function(type, data): Notification {
|
||||
switch (type) {
|
||||
case 'driveFileCreated':
|
||||
return {
|
||||
title: 'File uploaded',
|
||||
body: data.name,
|
||||
icon: data.url
|
||||
};
|
||||
|
||||
case 'notification':
|
||||
switch (data.type) {
|
||||
case 'mention':
|
||||
return {
|
||||
title: `${getUserName(data.user)}:`,
|
||||
body: getNoteSummary(data),
|
||||
icon: data.user.avatarUrl
|
||||
};
|
||||
|
||||
case 'reply':
|
||||
return {
|
||||
title: `You got reply from ${getUserName(data.user)}:`,
|
||||
body: getNoteSummary(data),
|
||||
icon: data.user.avatarUrl
|
||||
};
|
||||
|
||||
case 'quote':
|
||||
return {
|
||||
title: `${getUserName(data.user)}:`,
|
||||
body: getNoteSummary(data),
|
||||
icon: data.user.avatarUrl
|
||||
};
|
||||
|
||||
case 'reaction':
|
||||
return {
|
||||
title: `${getUserName(data.user)}: ${data.reaction}:`,
|
||||
body: getNoteSummary(data.note),
|
||||
icon: data.user.avatarUrl
|
||||
};
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue