Merge pull request #10 from kawamataryo/feature/work-with-members-of-list

 work with members of list #8
This commit is contained in:
ryo 2023-08-22 22:00:31 +09:00 committed by GitHub
commit 0a286e3e0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
"sky-follower-bridge": minor
---
- Fixed to be searchable even by list members.

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)