From f0e8e6392b5ef99488ea0bbecbf9029e30ef0cfa Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Fri, 6 Apr 2018 01:36:34 +0900 Subject: [PATCH 1/2] Allow name property of user to be null --- src/client/app/ch/tags/channel.tag | 10 ++++++-- .../common/scripts/compose-notification.ts | 13 ++++++----- .../common/views/components/autocomplete.vue | 4 +++- .../app/common/views/components/messaging.vue | 6 +++-- .../views/components/welcome-timeline.vue | 4 +++- .../views/components/followers-window.vue | 11 +++++++-- .../views/components/following-window.vue | 11 +++++++-- .../views/components/friends-maker.vue | 4 +++- .../components/messaging-room-window.vue | 6 ++++- .../views/components/notifications.vue | 16 +++++++------ .../views/components/post-detail.sub.vue | 6 ++++- .../desktop/views/components/post-detail.vue | 11 +++++++-- .../desktop/views/components/post-preview.vue | 6 ++++- .../views/components/posts.post.sub.vue | 6 ++++- .../desktop/views/components/posts.post.vue | 6 ++++- .../views/components/settings.mute.vue | 6 +++-- .../views/components/settings.profile.vue | 4 ++-- .../desktop/views/components/ui.header.vue | 9 +++++++- .../views/components/users-list.item.vue | 6 ++++- .../desktop/views/pages/messaging-room.vue | 3 ++- .../pages/user/user.followers-you-know.vue | 6 +++-- .../desktop/views/pages/user/user.header.vue | 6 ++++- .../app/desktop/views/pages/user/user.vue | 3 ++- .../views/widgets/channel.channel.post.vue | 6 ++++- .../app/desktop/views/widgets/profile.vue | 9 +++++++- .../app/desktop/views/widgets/users.vue | 4 +++- .../views/components/notification-preview.vue | 23 +++++++++++++------ .../mobile/views/components/notification.vue | 15 ++++++++---- .../app/mobile/views/components/post-card.vue | 6 ++++- .../views/components/post-detail.sub.vue | 6 ++++- .../mobile/views/components/post-detail.vue | 11 +++++++-- .../mobile/views/components/post-preview.vue | 6 ++++- .../app/mobile/views/components/post.sub.vue | 6 ++++- .../app/mobile/views/components/post.vue | 11 +++++++-- .../app/mobile/views/components/ui.header.vue | 8 ++++++- .../app/mobile/views/components/ui.nav.vue | 8 ++++++- .../app/mobile/views/components/user-card.vue | 6 ++++- .../mobile/views/components/user-preview.vue | 6 ++++- .../app/mobile/views/pages/followers.vue | 10 ++++++-- .../app/mobile/views/pages/following.vue | 10 ++++++-- .../app/mobile/views/pages/messaging-room.vue | 10 ++++++-- .../mobile/views/pages/profile-setting.vue | 4 ++-- .../app/mobile/views/pages/settings.vue | 8 ++++++- src/client/app/mobile/views/pages/user.vue | 11 +++++---- .../pages/user/home.followers-you-know.vue | 8 ++++++- .../app/mobile/views/widgets/profile.vue | 10 +++++++- src/models/user.ts | 6 ++--- src/othello/ai/back.ts | 17 +++++++------- src/renderers/get-notification-summary.ts | 15 ++++++------ src/renderers/get-user-summary.ts | 3 ++- src/server/api/bot/core.ts | 7 +++--- src/server/api/bot/interfaces/line.ts | 5 ++-- 52 files changed, 311 insertions(+), 107 deletions(-) diff --git a/src/client/app/ch/tags/channel.tag b/src/client/app/ch/tags/channel.tag index 1ebc3cceb..4856728de 100644 --- a/src/client/app/ch/tags/channel.tag +++ b/src/client/app/ch/tags/channel.tag @@ -165,7 +165,7 @@
{ post.index }: - { post.user.name } + { getUserName(post.user) } ID:{ acct } @@ -230,10 +230,12 @@ diff --git a/src/client/app/common/scripts/compose-notification.ts b/src/client/app/common/scripts/compose-notification.ts index ebc15952f..e99d50296 100644 --- a/src/client/app/common/scripts/compose-notification.ts +++ b/src/client/app/common/scripts/compose-notification.ts @@ -1,5 +1,6 @@ import getPostSummary from '../../../../renderers/get-post-summary'; import getReactionEmoji from '../../../../renderers/get-reaction-emoji'; +import getUserName from '../../../../renderers/get-user-name'; type Notification = { title: string; @@ -21,35 +22,35 @@ export default function(type, data): Notification { case 'mention': return { - title: `${data.user.name}さんから:`, + title: `${getUserName(data.user)}さんから:`, body: getPostSummary(data), icon: data.user.avatarUrl + '?thumbnail&size=64' }; case 'reply': return { - title: `${data.user.name}さんから返信:`, + title: `${getUserName(data.user)}さんから返信:`, body: getPostSummary(data), icon: data.user.avatarUrl + '?thumbnail&size=64' }; case 'quote': return { - title: `${data.user.name}さんが引用:`, + title: `${getUserName(data.user)}さんが引用:`, body: getPostSummary(data), icon: data.user.avatarUrl + '?thumbnail&size=64' }; case 'reaction': return { - title: `${data.user.name}: ${getReactionEmoji(data.reaction)}:`, + title: `${getUserName(data.user)}: ${getReactionEmoji(data.reaction)}:`, body: getPostSummary(data.post), icon: data.user.avatarUrl + '?thumbnail&size=64' }; case 'unread_messaging_message': return { - title: `${data.user.name}さんからメッセージ:`, + title: `${getUserName(data.user)}さんからメッセージ:`, body: data.text, // TODO: getMessagingMessageSummary(data), icon: data.user.avatarUrl + '?thumbnail&size=64' }; @@ -57,7 +58,7 @@ export default function(type, data): Notification { case 'othello_invited': return { title: '対局への招待があります', - body: `${data.parent.name}さんから`, + body: `${getUserName(data.parent)}さんから`, icon: data.parent.avatarUrl + '?thumbnail&size=64' }; diff --git a/src/client/app/common/views/components/autocomplete.vue b/src/client/app/common/views/components/autocomplete.vue index 38eaf8650..8837fde6b 100644 --- a/src/client/app/common/views/components/autocomplete.vue +++ b/src/client/app/common/views/components/autocomplete.vue @@ -3,7 +3,7 @@
  1. - {{ user.name }} + {{ getUserName(user) }} @{{ getAcct(user) }}
@@ -22,6 +22,7 @@ import Vue from 'vue'; import * as emojilib from 'emojilib'; import contains from '../../../common/scripts/contains'; import getAcct from '../../../../../acct/render'; +import getUserName from '../../../../../renderers/get-user-name'; const lib = Object.entries(emojilib.lib).filter((x: any) => { return x[1].category != 'flags'; @@ -107,6 +108,7 @@ export default Vue.extend({ }, methods: { getAcct, + getUserName, exec() { this.select = -1; if (this.$refs.suggests) { diff --git a/src/client/app/common/views/components/messaging.vue b/src/client/app/common/views/components/messaging.vue index 4ab3e46e8..9b1449daa 100644 --- a/src/client/app/common/views/components/messaging.vue +++ b/src/client/app/common/views/components/messaging.vue @@ -14,7 +14,7 @@ tabindex="-1" > - {{ user.name }} + {{ getUserName(user) }} @{{ getAcct(user) }} @@ -33,7 +33,7 @@
- {{ isMe(message) ? message.recipient.name : message.user.name }} + {{ getUserName(isMe(message) ? message.recipient : message.user) }} @{{ getAcct(isMe(message) ? message.recipient : message.user) }}
@@ -52,6 +52,7 @@ diff --git a/src/client/app/desktop/views/components/following-window.vue b/src/client/app/desktop/views/components/following-window.vue index 612847b38..cbd8ec5f9 100644 --- a/src/client/app/desktop/views/components/following-window.vue +++ b/src/client/app/desktop/views/components/following-window.vue @@ -1,7 +1,7 @@