diff options
| author | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-04-06 01:36:34 +0900 |
|---|---|---|
| committer | Akihiko Odaki <nekomanma@pixiv.co.jp> | 2018-04-06 01:36:34 +0900 |
| commit | f0e8e6392b5ef99488ea0bbecbf9029e30ef0cfa (patch) | |
| tree | 736d3fe581b6b9169d8e676453019e1d2afec876 /src/renderers | |
| parent | Merge pull request #1403 from akihikodaki/duplicate (diff) | |
| download | sharkey-f0e8e6392b5ef99488ea0bbecbf9029e30ef0cfa.tar.gz sharkey-f0e8e6392b5ef99488ea0bbecbf9029e30ef0cfa.tar.bz2 sharkey-f0e8e6392b5ef99488ea0bbecbf9029e30ef0cfa.zip | |
Allow name property of user to be null
Diffstat (limited to 'src/renderers')
| -rw-r--r-- | src/renderers/get-notification-summary.ts | 15 | ||||
| -rw-r--r-- | src/renderers/get-user-summary.ts | 3 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/renderers/get-notification-summary.ts b/src/renderers/get-notification-summary.ts index 03db722c84..f5e38faf99 100644 --- a/src/renderers/get-notification-summary.ts +++ b/src/renderers/get-notification-summary.ts @@ -1,3 +1,4 @@ +import getUserName from '../renderers/get-user-name'; import getPostSummary from './get-post-summary'; import getReactionEmoji from './get-reaction-emoji'; @@ -8,19 +9,19 @@ import getReactionEmoji from './get-reaction-emoji'; export default function(notification: any): string { switch (notification.type) { case 'follow': - return `${notification.user.name}にフォローされました`; + return `${getUserName(notification.user)}にフォローされました`; case 'mention': - return `言及されました:\n${notification.user.name}「${getPostSummary(notification.post)}」`; + return `言及されました:\n${getUserName(notification.user)}「${getPostSummary(notification.post)}」`; case 'reply': - return `返信されました:\n${notification.user.name}「${getPostSummary(notification.post)}」`; + return `返信されました:\n${getUserName(notification.user)}「${getPostSummary(notification.post)}」`; case 'repost': - return `Repostされました:\n${notification.user.name}「${getPostSummary(notification.post)}」`; + return `Repostされました:\n${getUserName(notification.user)}「${getPostSummary(notification.post)}」`; case 'quote': - return `引用されました:\n${notification.user.name}「${getPostSummary(notification.post)}」`; + return `引用されました:\n${getUserName(notification.user)}「${getPostSummary(notification.post)}」`; case 'reaction': - return `リアクションされました:\n${notification.user.name} <${getReactionEmoji(notification.reaction)}>「${getPostSummary(notification.post)}」`; + return `リアクションされました:\n${getUserName(notification.user)} <${getReactionEmoji(notification.reaction)}>「${getPostSummary(notification.post)}」`; case 'poll_vote': - return `投票されました:\n${notification.user.name}「${getPostSummary(notification.post)}」`; + return `投票されました:\n${getUserName(notification.user)}「${getPostSummary(notification.post)}」`; default: return `<不明な通知タイプ: ${notification.type}>`; } diff --git a/src/renderers/get-user-summary.ts b/src/renderers/get-user-summary.ts index 2089871130..d002933b6d 100644 --- a/src/renderers/get-user-summary.ts +++ b/src/renderers/get-user-summary.ts @@ -1,12 +1,13 @@ import { IUser, isLocalUser } from '../models/user'; import getAcct from '../acct/render'; +import getUserName from './get-user-name'; /** * ユーザーを表す文字列を取得します。 * @param user ユーザー */ export default function(user: IUser): string { - let string = `${user.name} (@${getAcct(user)})\n` + + let string = `${getUserName(user)} (@${getAcct(user)})\n` + `${user.postsCount}投稿、${user.followingCount}フォロー、${user.followersCount}フォロワー\n`; if (isLocalUser(user)) { |