Bug fix and refactoring
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
* 投稿を表す文字列を取得します。
|
||||
* @param {*} note (packされた)投稿
|
||||
*/
|
||||
const summarize = (note: any, locale: any): string => {
|
||||
export const getNoteSummary = (note: any, locale: any): string => {
|
||||
if (note.deletedAt) {
|
||||
return `(${locale['deletedNote']})`;
|
||||
}
|
||||
@ -50,5 +50,3 @@ const summarize = (note: any, locale: any): string => {
|
||||
|
||||
return summary.trim();
|
||||
};
|
||||
|
||||
export default summarize;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import getUserName from './get-user-name';
|
||||
import getNoteSummary from './get-note-summary';
|
||||
import { getNoteSummary } from './get-note-summary';
|
||||
import getReactionEmoji from './get-reaction-emoji';
|
||||
import locales = require('../../locales');
|
||||
|
||||
/**
|
||||
* 通知を表す文字列を取得します。
|
||||
@ -11,17 +12,17 @@ export default function(notification: any): string {
|
||||
case 'follow':
|
||||
return `${getUserName(notification.user)}にフォローされました`;
|
||||
case 'mention':
|
||||
return `言及されました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note)}」`;
|
||||
return `言及されました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note, locales['ja-JP'])}」`;
|
||||
case 'reply':
|
||||
return `返信されました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note)}」`;
|
||||
return `返信されました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note, locales['ja-JP'])}」`;
|
||||
case 'renote':
|
||||
return `Renoteされました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note)}」`;
|
||||
return `Renoteされました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note, locales['ja-JP'])}」`;
|
||||
case 'quote':
|
||||
return `引用されました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note)}」`;
|
||||
return `引用されました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note, locales['ja-JP'])}」`;
|
||||
case 'reaction':
|
||||
return `リアクションされました:\n${getUserName(notification.user)} <${getReactionEmoji(notification.reaction)}>「${getNoteSummary(notification.note)}」`;
|
||||
return `リアクションされました:\n${getUserName(notification.user)} <${getReactionEmoji(notification.reaction)}>「${getNoteSummary(notification.note, locales['ja-JP'])}」`;
|
||||
case 'pollVote':
|
||||
return `投票されました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note)}」`;
|
||||
return `投票されました:\n${getUserName(notification.user)}「${getNoteSummary(notification.note, locales['ja-JP'])}」`;
|
||||
default:
|
||||
return `<不明な通知タイプ: ${notification.type}>`;
|
||||
}
|
||||
|
Reference in New Issue
Block a user