summaryrefslogtreecommitdiff
path: root/src/common/get-notification-summary.ts
blob: 03db722c84fa26310d795e348fb84484776af2c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import getPostSummary from './get-post-summary';
import getReactionEmoji from './get-reaction-emoji';

/**
 * 通知を表す文字列を取得します。
 * @param notification 通知
 */
export default function(notification: any): string {
	switch (notification.type) {
		case 'follow':
			return `${notification.user.name}にフォローされました`;
		case 'mention':
			return `言及されました:\n${notification.user.name}${getPostSummary(notification.post)}」`;
		case 'reply':
			return `返信されました:\n${notification.user.name}${getPostSummary(notification.post)}」`;
		case 'repost':
			return `Repostされました:\n${notification.user.name}${getPostSummary(notification.post)}」`;
		case 'quote':
			return `引用されました:\n${notification.user.name}${getPostSummary(notification.post)}」`;
		case 'reaction':
			return `リアクションされました:\n${notification.user.name} <${getReactionEmoji(notification.reaction)}>「${getPostSummary(notification.post)}」`;
		case 'poll_vote':
			return `投票されました:\n${notification.user.name}${getPostSummary(notification.post)}」`;
		default:
			return `<不明な通知タイプ: ${notification.type}>`;
	}
}