work with members of list #8

This commit is contained in:
kawamataryo 2023-08-22 21:55:07 +09:00
parent ff8457b87e
commit 284a65fec1
3 changed files with 20 additions and 0 deletions

View File

@ -34,6 +34,20 @@ const searchAndShowBskyUsers = async ({
removeQuery: async (arg: string) => await agent.unfollow(arg),
})
break
case MESSAGE_NAMES.SEARCH_BSKY_USER_ON_LIST_MEMBERS_PAGE:
await searchAndInsertBskyUsers({
agent,
btnLabel: {
add: "Follow",
remove: "Unfollow",
progressive: "Following",
},
statusKey: VIEWER_STATE.FOLLOWING,
userCellQueryParam: '[data-testid="UserCell"]',
addQuery: async (arg: string) => await agent.follow(arg),
removeQuery: async (arg: string) => await agent.unfollow(arg),
})
break
case MESSAGE_NAMES.SEARCH_BSKY_USER_ON_BLOCK_PAGE:
// TODO: If already blocked, don't show blocking state. because blocking user can't find.
await searchAndInsertBskyUsers({

View File

@ -1,5 +1,6 @@
export const MESSAGE_NAMES = {
SEARCH_BSKY_USER_ON_FOLLOW_PAGE: "search_bsky_user_on_follow_page",
SEARCH_BSKY_USER_ON_LIST_MEMBERS_PAGE: "search_bsky_user_on_list_members_page",
SEARCH_BSKY_USER_ON_BLOCK_PAGE: "search_bsky_user_on_block_page",
}
@ -11,6 +12,7 @@ export const STORAGE_KEYS = {
export const TARGET_URLS_REGEX = {
FOLLOW: /^https:\/\/(twitter|x)\.com\/[^/]+\/follow/,
LIST: /^https:\/\/(twitter|x)\.com\/[^/]+\/lists\/[^/]+\/members/,
BLOCK: /^https:\/\/(twitter|x)\.com\/settings\/blocked/,
} as const

View File

@ -55,6 +55,10 @@ function IndexPopup() {
P.when((url) => TARGET_URLS_REGEX.BLOCK.test(url)),
() => MESSAGE_NAMES.SEARCH_BSKY_USER_ON_BLOCK_PAGE
)
.with(
P.when((url) => TARGET_URLS_REGEX.LIST.test(url)),
() => MESSAGE_NAMES.SEARCH_BSKY_USER_ON_LIST_MEMBERS_PAGE
)
.run()
setMessage(null)