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;
|
||||
reblog: Status | null;
|
||||
content: string;
|
||||
plain_content: string | null;
|
||||
text: string | null;
|
||||
created_at: string;
|
||||
emojis: Emoji[];
|
||||
replies_count: number;
|
||||
|
@ -1518,7 +1518,7 @@ export default class Misskey implements MegalodonInterface {
|
||||
const origin = idx < 0 ? null : status.account.acct.substring(idx + 1);
|
||||
|
||||
status.mentions = (
|
||||
await this.getMentions(status.plain_content!, origin, cache)
|
||||
await this.getMentions(status.text!, origin, cache)
|
||||
).filter((p) => p != null);
|
||||
for (const m of status.mentions.filter(
|
||||
(value, index, array) => array.indexOf(value) === index,
|
||||
@ -1699,10 +1699,12 @@ export default class Misskey implements MegalodonInterface {
|
||||
/**
|
||||
* POST /api/notes/delete
|
||||
*/
|
||||
public async deleteStatus(id: string): Promise<Response<{}>> {
|
||||
return this.client.post<{}>("/api/notes/delete", {
|
||||
public async deleteStatus(id: string): Promise<Response<Entity.Status>> {
|
||||
const status = await this.getStatus(id);
|
||||
await this.client.post<{}>("/api/notes/delete", {
|
||||
noteId: id,
|
||||
});
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -319,7 +319,7 @@ namespace MisskeyAPI {
|
||||
in_reply_to_account_id: n.reply?.userId ?? null,
|
||||
reblog: n.renote ? this.note(n.renote, host) : null,
|
||||
content: n.text ? this.escapeMFM(n.text) : "",
|
||||
plain_content: n.text ? n.text : null,
|
||||
text: n.text ? n.text : null,
|
||||
created_at: n.createdAt,
|
||||
// Remove reaction emojis with names containing @ from the emojis list.
|
||||
emojis: n.emojis
|
||||
|
@ -201,7 +201,7 @@ describe('api_client', () => {
|
||||
renoteId: null
|
||||
}
|
||||
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)
|
||||
})
|
||||
it('html tags should be escaped', () => {
|
||||
@ -225,7 +225,7 @@ describe('api_client', () => {
|
||||
renoteId: null
|
||||
}
|
||||
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)
|
||||
})
|
||||
})
|
||||
|
@ -32,7 +32,7 @@ const status: Entity.Status = {
|
||||
in_reply_to_account_id: null,
|
||||
reblog: null,
|
||||
content: 'hoge',
|
||||
plain_content: 'hoge',
|
||||
text: 'hoge',
|
||||
created_at: '2019-03-26T21:40:32',
|
||||
emojis: [],
|
||||
replies_count: 0,
|
||||
|
Loading…
Reference in New Issue
Block a user