1
0
forked from mirror/misskey
misskey/src/renderers/get-notification-summary.ts

29 lines
1.3 KiB
TypeScript
Raw Normal View History

2018-04-06 01:36:34 +09:00
import getUserName from '../renderers/get-user-name';
2017-11-11 00:27:02 +09:00
import getPostSummary from './get-post-summary';
import getReactionEmoji from './get-reaction-emoji';
/**
*
* @param notification
*/
2017-11-11 01:00:14 +09:00
export default function(notification: any): string {
2017-11-11 00:27:02 +09:00
switch (notification.type) {
case 'follow':
2018-04-06 01:36:34 +09:00
return `${getUserName(notification.user)}にフォローされました`;
2017-11-11 00:27:02 +09:00
case 'mention':
2018-04-06 01:36:34 +09:00
return `言及されました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
2017-11-11 00:27:02 +09:00
case 'reply':
2018-04-06 01:36:34 +09:00
return `返信されました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
2017-11-11 00:27:02 +09:00
case 'repost':
2018-04-06 01:36:34 +09:00
return `Repostされました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
2017-11-11 00:27:02 +09:00
case 'quote':
2018-04-06 01:36:34 +09:00
return `引用されました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
2017-11-11 00:27:02 +09:00
case 'reaction':
2018-04-06 01:36:34 +09:00
return `リアクションされました:\n${getUserName(notification.user)} <${getReactionEmoji(notification.reaction)}>「${getPostSummary(notification.post)}`;
2017-11-11 00:27:02 +09:00
case 'poll_vote':
2018-04-06 01:36:34 +09:00
return `投票されました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
2017-11-11 00:27:02 +09:00
default:
return `<不明な通知タイプ: ${notification.type}>`;
}
}