Skip to content

Commit 73d254e

Browse files
Return actual user preferences instead of hardcoded values
Read posting:default:visibility, posting:default:sensitive, and posting:default:language from the authenticated user's account settings instead of returning hardcoded defaults from the GET /api/v1/preferences endpoint. Fixes #425
1 parent 183f0af commit 73d254e

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

src/api/v1/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,17 @@ app.get(
5757
tokenRequired,
5858
scopeRequired(["read:accounts"]),
5959
(c) => {
60+
const owner = c.get("token").accountOwner;
61+
if (owner == null) {
62+
return c.json(
63+
{ error: "This method requires an authenticated user" },
64+
422,
65+
);
66+
}
6067
return c.json({
61-
// TODO
62-
"posting:default:visibility": "public",
63-
"posting:default:sensitive": false,
64-
"posting:default:language": null,
68+
"posting:default:visibility": owner.visibility,
69+
"posting:default:sensitive": owner.account.sensitive,
70+
"posting:default:language": owner.language,
6571
"reading:expand:media": "default",
6672
"reading:expand:spoilers": false,
6773
});

0 commit comments

Comments
 (0)