Fix bugs
This commit is contained in:
parent
7f448221ce
commit
5ddb047794
|
@ -1,8 +1,8 @@
|
||||||
import config from '../../../config';
|
import config from '../../../config';
|
||||||
import { IRemoteUser } from '../../../models/user';
|
import { IRemoteUser, ILocalUser } from '../../../models/user';
|
||||||
|
|
||||||
export default ({ username }, followee: IRemoteUser) => ({
|
export default (follower: ILocalUser, followee: IRemoteUser) => ({
|
||||||
type: 'Follow',
|
type: 'Follow',
|
||||||
actor: `${config.url}/@${username}`,
|
actor: `${config.url}/@${follower.username}`,
|
||||||
object: followee.uri
|
object: followee.uri
|
||||||
});
|
});
|
||||||
|
|
|
@ -66,14 +66,12 @@ export default async (value, verifier?: string) => {
|
||||||
usernameLower: object.preferredUsername.toLowerCase(),
|
usernameLower: object.preferredUsername.toLowerCase(),
|
||||||
host,
|
host,
|
||||||
hostLower,
|
hostLower,
|
||||||
account: {
|
|
||||||
publicKey: {
|
publicKey: {
|
||||||
id: object.publicKey.id,
|
id: object.publicKey.id,
|
||||||
publicKeyPem: object.publicKey.publicKeyPem
|
publicKeyPem: object.publicKey.publicKeyPem
|
||||||
},
|
},
|
||||||
inbox: object.inbox,
|
inbox: object.inbox,
|
||||||
uri: id,
|
uri: id
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const [avatarId, bannerId] = (await Promise.all([
|
const [avatarId, bannerId] = (await Promise.all([
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { ILocalUser } from '../models/user';
|
||||||
|
|
||||||
const log = debug('misskey:activitypub:deliver');
|
const log = debug('misskey:activitypub:deliver');
|
||||||
|
|
||||||
export default (user: ILocalUser, url, object) => new Promise((resolve, reject) => {
|
export default (user: ILocalUser, url: string, object) => new Promise((resolve, reject) => {
|
||||||
log(`--> ${url}`);
|
log(`--> ${url}`);
|
||||||
|
|
||||||
const { protocol, hostname, port, pathname, search } = new URL(url);
|
const { protocol, hostname, port, pathname, search } = new URL(url);
|
||||||
|
|
|
@ -31,7 +31,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||||
}, {
|
}, {
|
||||||
fields: {
|
fields: {
|
||||||
data: false,
|
data: false,
|
||||||
'profile': false
|
profile: false
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
import $ from 'cafy';
|
import $ from 'cafy';
|
||||||
import User, { isValidName, isValidDescription, isValidLocation, isValidBirthday, pack } from '../../../../models/user';
|
import User, { isValidName, isValidDescription, isValidLocation, isValidBirthday, pack } from '../../../../models/user';
|
||||||
import event from '../../../../publishers/stream';
|
import event from '../../../../publishers/stream';
|
||||||
import config from '../../../../config';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update myself
|
* Update myself
|
||||||
|
@ -17,7 +16,7 @@ import config from '../../../../config';
|
||||||
*/
|
*/
|
||||||
module.exports = async (params, user, _, isSecure) => new Promise(async (res, rej) => {
|
module.exports = async (params, user, _, isSecure) => new Promise(async (res, rej) => {
|
||||||
// Get 'name' parameter
|
// Get 'name' parameter
|
||||||
const [name, nameErr] = $(params.name).optional.string().pipe(isValidName).$;
|
const [name, nameErr] = $(params.name).optional.nullable.string().pipe(isValidName).$;
|
||||||
if (nameErr) return rej('invalid name param');
|
if (nameErr) return rej('invalid name param');
|
||||||
if (name) user.name = name;
|
if (name) user.name = name;
|
||||||
|
|
||||||
|
@ -62,9 +61,9 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re
|
||||||
description: user.description,
|
description: user.description,
|
||||||
avatarId: user.avatarId,
|
avatarId: user.avatarId,
|
||||||
bannerId: user.bannerId,
|
bannerId: user.bannerId,
|
||||||
'profile': user.profile,
|
profile: user.profile,
|
||||||
'isBot': user.isBot,
|
isBot: user.isBot,
|
||||||
'settings': user.settings
|
settings: user.settings
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,19 +78,4 @@ module.exports = async (params, user, _, isSecure) => new Promise(async (res, re
|
||||||
|
|
||||||
// Publish i updated event
|
// Publish i updated event
|
||||||
event(user._id, 'i_updated', iObj);
|
event(user._id, 'i_updated', iObj);
|
||||||
|
|
||||||
// Update search index
|
|
||||||
if (config.elasticsearch.enable) {
|
|
||||||
const es = require('../../../db/elasticsearch');
|
|
||||||
|
|
||||||
es.index({
|
|
||||||
index: 'misskey',
|
|
||||||
type: 'user',
|
|
||||||
id: user._id.toString(),
|
|
||||||
body: {
|
|
||||||
name: user.name,
|
|
||||||
bio: user.bio
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue