Revert "Revert "[mastodon-client] send actual default post privacy instead of fallback value""
This reverts commit a441cc6067
.
This commit is contained in:
parent
66fbca321c
commit
3e1b112f92
3 changed files with 19 additions and 2 deletions
|
@ -33,7 +33,7 @@ export const paramDef = {
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
export default define(meta, paramDef, async (ps, user) => {
|
||||||
if (ps.key !== "reactions") return;
|
if (ps.key !== "reactions" && ps.key !== "defaultNoteVisibility") return;
|
||||||
const query = RegistryItems.createQueryBuilder("item")
|
const query = RegistryItems.createQueryBuilder("item")
|
||||||
.where("item.domain IS NULL")
|
.where("item.domain IS NULL")
|
||||||
.andWhere("item.userId = :userId", { userId: user.id })
|
.andWhere("item.userId = :userId", { userId: user.id })
|
||||||
|
|
|
@ -48,7 +48,7 @@ export function apiAccountMastodon(router: Router): void {
|
||||||
acct.source = {
|
acct.source = {
|
||||||
note: acct.note,
|
note: acct.note,
|
||||||
fields: acct.fields,
|
fields: acct.fields,
|
||||||
privacy: "public",
|
privacy: await client.getDefaultPostPrivacy(),
|
||||||
sensitive: false,
|
sensitive: false,
|
||||||
language: "",
|
language: "",
|
||||||
};
|
};
|
||||||
|
|
|
@ -1539,6 +1539,23 @@ export default class Misskey implements MegalodonInterface {
|
||||||
.then(res => res.data[0] ?? '⭐');
|
.then(res => res.data[0] ?? '⭐');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async getDefaultPostPrivacy(): Promise<string> {
|
||||||
|
// NOTE: get-unsecure is calckey's extension.
|
||||||
|
// Misskey doesn't have this endpoint and regular `/i/registry/get` won't work
|
||||||
|
// unless you have a 'nativeToken', which is reserved for the frontend webapp.
|
||||||
|
|
||||||
|
return this.client
|
||||||
|
.post<string>('/api/i/registry/get-unsecure', {
|
||||||
|
key: 'defaultNoteVisibility',
|
||||||
|
scope: ['client', 'base'],
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
if (!res.data || (res.data != 'public' && res.data != 'home' && res.data != 'followers' && res.data != 'specified'))
|
||||||
|
return 'public';
|
||||||
|
return this.converter.visibility(res.data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public async unfavouriteStatus(id: string): Promise<Response<Entity.Status>> {
|
public async unfavouriteStatus(id: string): Promise<Response<Entity.Status>> {
|
||||||
// NOTE: Misskey allows only one reaction per status, so we don't need to care what that emoji was.
|
// NOTE: Misskey allows only one reaction per status, so we don't need to care what that emoji was.
|
||||||
return this.deleteEmojiReaction(id, '');
|
return this.deleteEmojiReaction(id, '');
|
||||||
|
|
Loading…
Reference in a new issue