mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 11:13:08 +02:00
upd: convert masto ids to sharkeyid on media
This commit is contained in:
parent
817203a9e1
commit
314122f509
1 changed files with 6 additions and 0 deletions
|
@ -217,7 +217,13 @@ export class ApiStatusMastodon {
|
||||||
const BASE_URL = `${_request.protocol}://${_request.hostname}`;
|
const BASE_URL = `${_request.protocol}://${_request.hostname}`;
|
||||||
const accessTokens = _request.headers.authorization;
|
const accessTokens = _request.headers.authorization;
|
||||||
const client = getClient(BASE_URL, accessTokens);
|
const client = getClient(BASE_URL, accessTokens);
|
||||||
|
const body: any = _request.body;
|
||||||
try {
|
try {
|
||||||
|
if (body.media_ids) body.media_ids = undefined;
|
||||||
|
if (body.media_ids && !body.media_ids.length) body.media_ids = undefined;
|
||||||
|
if (body.media_ids) {
|
||||||
|
body.media_ids = (body.media_ids as string[]).map((p) => convertId(p, IdType.SharkeyId));
|
||||||
|
}
|
||||||
const data = await client.editStatus(convertId(_request.params.id, IdType.SharkeyId), _request.body!);
|
const data = await client.editStatus(convertId(_request.params.id, IdType.SharkeyId), _request.body!);
|
||||||
reply.send(convertStatus(data.data));
|
reply.send(convertStatus(data.data));
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
|
|
Loading…
Reference in a new issue