Add a blacklist editor that saves to e621
The Online sidebar's "Your blacklist" section is editable now: typing a
tag appends it and each entry gets an x to remove it. Changes are written
straight to the e621 account (PATCH /users/{id}.json with
user[blacklisted_tags]); the store keeps the fetched profile for the id,
updates the list optimistically and reloads it from e621. The Followed
page's blacklist cloud is rebuilt afterwards via the new
/api/follows/cloud/?refresh=1 force flag.
Verified against the live API with a reversible add/verify/restore test.
This commit is contained in:
@@ -316,6 +316,18 @@ export async function fetchPostsByMd5(
|
||||
return data.posts;
|
||||
}
|
||||
|
||||
/** Replace the account's blacklist (e621 stores it as one newline-joined string). */
|
||||
export async function updateBlacklist(
|
||||
credentials: E621Credentials,
|
||||
userId: number,
|
||||
blacklist: string,
|
||||
): Promise<void> {
|
||||
await e621Request(credentials, `/users/${userId}.json`, {
|
||||
method: "PATCH",
|
||||
body: new URLSearchParams({ "user[blacklisted_tags]": blacklist }),
|
||||
});
|
||||
}
|
||||
|
||||
export interface E621Pool {
|
||||
id: number;
|
||||
name: string;
|
||||
|
||||
Reference in New Issue
Block a user