Allow name property of user to be null

This commit is contained in:
Akihiko Odaki
2018-04-06 01:36:34 +09:00
parent 46e8fd44c1
commit f0e8e6392b
52 changed files with 311 additions and 107 deletions

View File

@ -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'
};