Merge branch 'develop' of https://github.com/syuilo/misskey into develop
This commit is contained in:
commit
aba84612a7
@ -3,8 +3,8 @@ import $ from 'cafy';
|
|||||||
import User, { pack, ILocalUser } from '../../../../models/user';
|
import User, { pack, ILocalUser } from '../../../../models/user';
|
||||||
import { getFriendIds } from '../../common/get-friends';
|
import { getFriendIds } from '../../common/get-friends';
|
||||||
import Mute from '../../../../models/mute';
|
import Mute from '../../../../models/mute';
|
||||||
import * as request from 'request'
|
import * as request from 'request';
|
||||||
import config from '../../../../config'
|
import config from '../../../../config';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
desc: {
|
desc: {
|
||||||
@ -18,18 +18,19 @@ export const meta = {
|
|||||||
|
|
||||||
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
|
||||||
if (config.user_recommendation && config.user_recommendation.external) {
|
if (config.user_recommendation && config.user_recommendation.external) {
|
||||||
const userName = me.username
|
const userName = me.username;
|
||||||
const hostName = config.hostname
|
const hostName = config.hostname;
|
||||||
const limit = params.limit
|
const limit = params.limit;
|
||||||
const offset = params.offset
|
const offset = params.offset;
|
||||||
const timeout = config.user_recommendation.timeout
|
const timeout = config.user_recommendation.timeout;
|
||||||
const engine = config.user_recommendation.engine
|
const engine = config.user_recommendation.engine;
|
||||||
const url = engine
|
const url = engine
|
||||||
.replace('{{host}}', hostName)
|
.replace('{{host}}', hostName)
|
||||||
.replace('{{user}}', userName)
|
.replace('{{user}}', userName)
|
||||||
.replace('{{limit}}', limit)
|
.replace('{{limit}}', limit)
|
||||||
.replace('{{offset}}', offset)
|
.replace('{{offset}}', offset);
|
||||||
request(
|
|
||||||
|
request(
|
||||||
{
|
{
|
||||||
url: url,
|
url: url,
|
||||||
timeout: timeout,
|
timeout: timeout,
|
||||||
@ -39,12 +40,12 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||||||
},
|
},
|
||||||
(error: any, response: any, body: any) => {
|
(error: any, response: any, body: any) => {
|
||||||
if (!error && response.statusCode == 200) {
|
if (!error && response.statusCode == 200) {
|
||||||
res(body)
|
res(body);
|
||||||
} else {
|
} else {
|
||||||
res([])
|
res([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
} else {
|
} else {
|
||||||
// Get 'limit' parameter
|
// Get 'limit' parameter
|
||||||
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
|
||||||
@ -67,7 +68,7 @@ export default (params: any, me: ILocalUser) => new Promise(async (res, rej) =>
|
|||||||
_id: {
|
_id: {
|
||||||
$nin: followingIds.concat(mutedUserIds)
|
$nin: followingIds.concat(mutedUserIds)
|
||||||
},
|
},
|
||||||
isLocked: false,
|
isLocked: { $ne: true },
|
||||||
$or: [{
|
$or: [{
|
||||||
lastUsedAt: {
|
lastUsedAt: {
|
||||||
$gte: new Date(Date.now() - ms('7days'))
|
$gte: new Date(Date.now() - ms('7days'))
|
||||||
|
Loading…
Reference in New Issue
Block a user