mirror of
https://iceshrimp.dev/crimekillz/trashposs
synced 2024-11-25 02:09:05 +01:00
[mastodon-client] Proper note deletion response, resolves #159
This commit is contained in:
parent
74941f35e4
commit
29099e4635
@ -18,7 +18,7 @@ namespace Entity {
|
|||||||
in_reply_to_account_id: string | null;
|
in_reply_to_account_id: string | null;
|
||||||
reblog: Status | null;
|
reblog: Status | null;
|
||||||
content: string;
|
content: string;
|
||||||
plain_content: string | null;
|
text: string | null;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
emojis: Emoji[];
|
emojis: Emoji[];
|
||||||
replies_count: number;
|
replies_count: number;
|
||||||
|
@ -1518,7 +1518,7 @@ export default class Misskey implements MegalodonInterface {
|
|||||||
const origin = idx < 0 ? null : status.account.acct.substring(idx + 1);
|
const origin = idx < 0 ? null : status.account.acct.substring(idx + 1);
|
||||||
|
|
||||||
status.mentions = (
|
status.mentions = (
|
||||||
await this.getMentions(status.plain_content!, origin, cache)
|
await this.getMentions(status.text!, origin, cache)
|
||||||
).filter((p) => p != null);
|
).filter((p) => p != null);
|
||||||
for (const m of status.mentions.filter(
|
for (const m of status.mentions.filter(
|
||||||
(value, index, array) => array.indexOf(value) === index,
|
(value, index, array) => array.indexOf(value) === index,
|
||||||
@ -1699,10 +1699,12 @@ export default class Misskey implements MegalodonInterface {
|
|||||||
/**
|
/**
|
||||||
* POST /api/notes/delete
|
* POST /api/notes/delete
|
||||||
*/
|
*/
|
||||||
public async deleteStatus(id: string): Promise<Response<{}>> {
|
public async deleteStatus(id: string): Promise<Response<Entity.Status>> {
|
||||||
return this.client.post<{}>("/api/notes/delete", {
|
const status = await this.getStatus(id);
|
||||||
|
await this.client.post<{}>("/api/notes/delete", {
|
||||||
noteId: id,
|
noteId: id,
|
||||||
});
|
});
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -319,7 +319,7 @@ namespace MisskeyAPI {
|
|||||||
in_reply_to_account_id: n.reply?.userId ?? null,
|
in_reply_to_account_id: n.reply?.userId ?? null,
|
||||||
reblog: n.renote ? this.note(n.renote, host) : null,
|
reblog: n.renote ? this.note(n.renote, host) : null,
|
||||||
content: n.text ? this.escapeMFM(n.text) : "",
|
content: n.text ? this.escapeMFM(n.text) : "",
|
||||||
plain_content: n.text ? n.text : null,
|
text: n.text ? n.text : null,
|
||||||
created_at: n.createdAt,
|
created_at: n.createdAt,
|
||||||
// Remove reaction emojis with names containing @ from the emojis list.
|
// Remove reaction emojis with names containing @ from the emojis list.
|
||||||
emojis: n.emojis
|
emojis: n.emojis
|
||||||
|
@ -201,7 +201,7 @@ describe('api_client', () => {
|
|||||||
renoteId: null
|
renoteId: null
|
||||||
}
|
}
|
||||||
const megalodonStatus = converter.note(note, user.host || 'misskey.io')
|
const megalodonStatus = converter.note(note, user.host || 'misskey.io')
|
||||||
expect(megalodonStatus.plain_content).toEqual(plainContent)
|
expect(megalodonStatus.text).toEqual(plainContent)
|
||||||
expect(megalodonStatus.content).toEqual(content)
|
expect(megalodonStatus.content).toEqual(content)
|
||||||
})
|
})
|
||||||
it('html tags should be escaped', () => {
|
it('html tags should be escaped', () => {
|
||||||
@ -225,7 +225,7 @@ describe('api_client', () => {
|
|||||||
renoteId: null
|
renoteId: null
|
||||||
}
|
}
|
||||||
const megalodonStatus = converter.note(note, user.host || 'misskey.io')
|
const megalodonStatus = converter.note(note, user.host || 'misskey.io')
|
||||||
expect(megalodonStatus.plain_content).toEqual(plainContent)
|
expect(megalodonStatus.text).toEqual(plainContent)
|
||||||
expect(megalodonStatus.content).toEqual(content)
|
expect(megalodonStatus.content).toEqual(content)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -32,7 +32,7 @@ const status: Entity.Status = {
|
|||||||
in_reply_to_account_id: null,
|
in_reply_to_account_id: null,
|
||||||
reblog: null,
|
reblog: null,
|
||||||
content: 'hoge',
|
content: 'hoge',
|
||||||
plain_content: 'hoge',
|
text: 'hoge',
|
||||||
created_at: '2019-03-26T21:40:32',
|
created_at: '2019-03-26T21:40:32',
|
||||||
emojis: [],
|
emojis: [],
|
||||||
replies_count: 0,
|
replies_count: 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user