test: mention fix
This commit is contained in:
parent
3b2bf0dc35
commit
7df25f036a
1 changed files with 44 additions and 31 deletions
|
@ -628,15 +628,6 @@ export default class Misskey implements MegalodonInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => {
|
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => {
|
||||||
if ((res.data as any)["error"]) {
|
|
||||||
return Object.assign(res, {
|
|
||||||
data: {
|
|
||||||
accounts: [],
|
|
||||||
statuses: [],
|
|
||||||
hashtags: [],
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return Object.assign(res, {
|
return Object.assign(res, {
|
||||||
data: res.data.map(u => MisskeyAPI.Converter.userDetail(u, this.baseUrl))
|
data: res.data.map(u => MisskeyAPI.Converter.userDetail(u, this.baseUrl))
|
||||||
})
|
})
|
||||||
|
@ -2135,7 +2126,11 @@ export default class Misskey implements MegalodonInterface {
|
||||||
params = Object.assign(params, {
|
params = Object.assign(params, {
|
||||||
limit: options.limit
|
limit: options.limit
|
||||||
})
|
})
|
||||||
}
|
} else {
|
||||||
|
params = Object.assign(params, {
|
||||||
|
limit: 20,
|
||||||
|
});
|
||||||
|
}
|
||||||
if (options.offset) {
|
if (options.offset) {
|
||||||
params = Object.assign(params, {
|
params = Object.assign(params, {
|
||||||
offset: options.offset
|
offset: options.offset
|
||||||
|
@ -2146,28 +2141,46 @@ export default class Misskey implements MegalodonInterface {
|
||||||
localOnly: options.resolve
|
localOnly: options.resolve
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
const match = q.match(/^@?(?<user>[a-zA-Z0-9_]+)(?:@(?<host>[a-zA-Z0-9-.]+\.[a-zA-Z0-9-]+)|)$/);
|
params = Object.assign(params, {
|
||||||
if (match) {
|
limit: 20,
|
||||||
const lookupQuery = {
|
});
|
||||||
username: match.groups?.user,
|
}
|
||||||
host: match.groups?.host,
|
try {
|
||||||
};
|
const match = q.match(/^@?(?<user>[a-zA-Z0-9_]+)(?:@(?<host>[a-zA-Z0-9-.]+\.[a-zA-Z0-9-]+)|)$/);
|
||||||
|
if (match) {
|
||||||
|
const lookupQuery = {
|
||||||
|
username: match.groups?.user,
|
||||||
|
host: match.groups?.host,
|
||||||
|
};
|
||||||
|
|
||||||
return await this.client.post<MisskeyAPI.Entity.UserDetail>('/api/users/show', lookupQuery).then((res) => ({
|
const result = await this.client.post<MisskeyAPI.Entity.UserDetail>('/api/users/show', lookupQuery).then((res) => ({
|
||||||
...res,
|
...res,
|
||||||
data: {
|
data: {
|
||||||
accounts: [
|
accounts: [
|
||||||
MisskeyAPI.Converter.userDetail(
|
MisskeyAPI.Converter.userDetail(
|
||||||
res.data,
|
res.data,
|
||||||
this.baseUrl,
|
this.baseUrl,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
statuses: [],
|
statuses: [],
|
||||||
hashtags: [],
|
hashtags: [],
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
}
|
|
||||||
|
if (result.status !== 200) {
|
||||||
|
result.status = 200;
|
||||||
|
result.statusText = "OK";
|
||||||
|
result.data = {
|
||||||
|
accounts: [],
|
||||||
|
statuses: [],
|
||||||
|
hashtags: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => ({
|
return this.client.post<Array<MisskeyAPI.Entity.UserDetail>>('/api/users/search', params).then(res => ({
|
||||||
...res,
|
...res,
|
||||||
data: {
|
data: {
|
||||||
|
|
Loading…
Reference in a new issue