Allow name property of user to be null
This commit is contained in:
@ -4,6 +4,7 @@ import * as bcrypt from 'bcryptjs';
|
||||
import User, { IUser, init as initUser, ILocalUser } from '../../../models/user';
|
||||
|
||||
import getPostSummary from '../../../renderers/get-post-summary';
|
||||
import getUserName from '../../../renderers/get-user-name';
|
||||
import getUserSummary from '../../../renderers/get-user-summary';
|
||||
import parseAcct from '../../../acct/parse';
|
||||
import getNotificationSummary from '../../../renderers/get-notification-summary';
|
||||
@ -90,7 +91,7 @@ export default class BotCore extends EventEmitter {
|
||||
'タイムラインや通知を見た後、「次」というとさらに遡ることができます。';
|
||||
|
||||
case 'me':
|
||||
return this.user ? `${this.user.name}としてサインインしています。\n\n${getUserSummary(this.user)}` : 'サインインしていません';
|
||||
return this.user ? `${getUserName(this.user)}としてサインインしています。\n\n${getUserSummary(this.user)}` : 'サインインしていません';
|
||||
|
||||
case 'login':
|
||||
case 'signin':
|
||||
@ -230,7 +231,7 @@ class SigninContext extends Context {
|
||||
if (same) {
|
||||
this.bot.signin(this.temporaryUser);
|
||||
this.bot.clearContext();
|
||||
return `${this.temporaryUser.name}さん、おかえりなさい!`;
|
||||
return `${getUserName(this.temporaryUser)}さん、おかえりなさい!`;
|
||||
} else {
|
||||
return `パスワードが違います... もう一度教えてください:`;
|
||||
}
|
||||
@ -305,7 +306,7 @@ class TlContext extends Context {
|
||||
this.emit('updated');
|
||||
|
||||
const text = tl
|
||||
.map(post => `${post.user.name}\n「${getPostSummary(post)}」`)
|
||||
.map(post => `${getUserName(post.user)}\n「${getPostSummary(post)}」`)
|
||||
.join('\n-----\n');
|
||||
|
||||
return text;
|
||||
|
@ -10,6 +10,7 @@ import prominence = require('prominence');
|
||||
import getAcct from '../../../../acct/render';
|
||||
import parseAcct from '../../../../acct/parse';
|
||||
import getPostSummary from '../../../../renderers/get-post-summary';
|
||||
import getUserName from '../../../../renderers/get-user-name';
|
||||
|
||||
const redis = prominence(_redis);
|
||||
|
||||
@ -131,7 +132,7 @@ class LineBot extends BotCore {
|
||||
template: {
|
||||
type: 'buttons',
|
||||
thumbnailImageUrl: `${user.avatarUrl}?thumbnail&size=1024`,
|
||||
title: `${user.name} (@${acct})`,
|
||||
title: `${getUserName(user)} (@${acct})`,
|
||||
text: user.description || '(no description)',
|
||||
actions: actions
|
||||
}
|
||||
@ -146,7 +147,7 @@ class LineBot extends BotCore {
|
||||
limit: 5
|
||||
}, this.user);
|
||||
|
||||
const text = `${tl[0].user.name}さんのタイムラインはこちらです:\n\n` + tl
|
||||
const text = `${getUserName(tl[0].user)}さんのタイムラインはこちらです:\n\n` + tl
|
||||
.map(post => getPostSummary(post))
|
||||
.join('\n-----\n');
|
||||
|
||||
|
Reference in New Issue
Block a user