diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-11-11 00:27:02 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-11-11 00:27:02 +0900 |
| commit | 3f0f307104300e148b02f05fd51ac833f9b75b01 (patch) | |
| tree | 131ad6c84bcbad684d0fac285915953045e30627 /src/common | |
| parent | v2996 (diff) | |
| download | misskey-3f0f307104300e148b02f05fd51ac833f9b75b01.tar.gz misskey-3f0f307104300e148b02f05fd51ac833f9b75b01.tar.bz2 misskey-3f0f307104300e148b02f05fd51ac833f9b75b01.zip | |
[LINE] 通知の表示に対応
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/get-notification-summary.ts | 28 | ||||
| -rw-r--r-- | src/common/get-reaction-emoji.ts | 14 |
2 files changed, 42 insertions, 0 deletions
diff --git a/src/common/get-notification-summary.ts b/src/common/get-notification-summary.ts new file mode 100644 index 0000000000..bf8610599c --- /dev/null +++ b/src/common/get-notification-summary.ts @@ -0,0 +1,28 @@ +import { INotification } from '../api/models/notification'; +import getPostSummary from './get-post-summary'; +import getReactionEmoji from './get-reaction-emoji'; + +/** + * 通知を表す文字列を取得します。 + * @param notification 通知 + */ +export default function(notification: INotification & any): string { + switch (notification.type) { + case 'follow': + return `${notification.notifier.name}にフォローされました`; + case 'mention': + return `言及されました: ${notification.notifier.name}「${getPostSummary(notification.post)}」`; + case 'reply': + return `返信されました: ${notification.notifier.name}「${getPostSummary(notification.post)}」`; + case 'repost': + return `Repostされました: ${notification.notifier.name}「${getPostSummary(notification.post)}」`; + case 'quote': + return `引用されました: ${notification.notifier.name}「${getPostSummary(notification.post)}」`; + case 'reaction': + return `リアクションされました: ${notification.notifier.name} <${getReactionEmoji(notification.reaction)}>「${getPostSummary(notification.post)}」`; + case 'poll_vote': + return `投票されました: ${notification.notifier.name}「${getPostSummary(notification.post)}」`; + default: + return `<不明な通知タイプ: ${notification.type}>`; + } +} diff --git a/src/common/get-reaction-emoji.ts b/src/common/get-reaction-emoji.ts new file mode 100644 index 0000000000..c661205379 --- /dev/null +++ b/src/common/get-reaction-emoji.ts @@ -0,0 +1,14 @@ +export default function(reaction: string): string { + switch (reaction) { + case 'like': return '👍'; + case 'love': return '❤️'; + case 'laugh': return '😆'; + case 'hmm': return '🤔'; + case 'surprise': return '😮'; + case 'congrats': return '🎉'; + case 'angry': return '💢'; + case 'confused': return '😥'; + case 'pudding': return '🍮'; + default: return ''; + } +} |