Merge branch 'master' into refactor
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');
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
import $ from 'cafy';
|
||||
import User from '../../../../models/user';
|
||||
import Following from '../../../../models/following';
|
||||
import queue from '../../../../queue';
|
||||
import { createHttp } from '../../../../queue';
|
||||
|
||||
/**
|
||||
* Unfollow a user
|
||||
@ -49,7 +49,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
return rej('already not following');
|
||||
}
|
||||
|
||||
queue.create('http', {
|
||||
createHttp({
|
||||
type: 'unfollow',
|
||||
id: exist._id
|
||||
}).save(error => {
|
||||
|
@ -47,7 +47,6 @@ export default async (req: express.Request, res: express.Response) => {
|
||||
|
||||
const username = req.body['username'];
|
||||
const password = req.body['password'];
|
||||
const name = '名無し';
|
||||
|
||||
// Validate username
|
||||
if (!validateUsername(username)) {
|
||||
@ -113,7 +112,7 @@ export default async (req: express.Request, res: express.Response) => {
|
||||
description: null,
|
||||
followersCount: 0,
|
||||
followingCount: 0,
|
||||
name: name,
|
||||
name: null,
|
||||
postsCount: 0,
|
||||
driveCapacity: 1024 * 1024 * 128, // 128MiB
|
||||
username: username,
|
||||
|
@ -3,7 +3,7 @@ import * as express from 'express';
|
||||
//const crypto = require('crypto');
|
||||
import User from '../../../models/user';
|
||||
import config from '../../../config';
|
||||
import queue from '../../../queue';
|
||||
import { createHttp } from '../../../queue';
|
||||
|
||||
module.exports = async (app: express.Application) => {
|
||||
if (config.github_bot == null) return;
|
||||
@ -42,7 +42,7 @@ module.exports = async (app: express.Application) => {
|
||||
const commit = event.commit;
|
||||
const parent = commit.parents[0];
|
||||
|
||||
queue.create('http', {
|
||||
createHttp({
|
||||
type: 'gitHubFailureReport',
|
||||
userId: bot._id,
|
||||
parentUrl: parent.url,
|
||||
|
Reference in New Issue
Block a user