-
Notifications
You must be signed in to change notification settings - Fork 334
WPB-20214: Add member searchability #4786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3e7403a
ecb8603
ec9eeb8
9afddae
4f846ae
991b7d2
1afd1ff
a4092a3
0e062d4
06c3d05
a83fca9
bc91e9f
d7a4d92
845fe82
08e2a73
59eebad
32afbe1
34f9868
5b8636a
8393d5c
d48d773
91a64a4
f4304ee
3e6cc0c
367fcf7
07b11aa
bceac5b
3de1b14
8fd8b6c
5421654
ce77a44
c1d99cd
6f670bc
ee2094f
4567ce9
22b12d4
419a017
e63e93b
7716271
c9cd3d6
0ade5c3
a45b069
23da170
c5667e6
40e049a
6c5b0d0
680d092
2846097
5c8794a
80ad6b6
791a4cb
5acb9f7
1233dc0
8de6015
cfd7a91
8e395fa
7195d36
28447bc
25fa40f
18cc561
6982181
bd04a10
0ea4a7c
8d46700
8a74d63
7879f1c
cfc9caf
fe13075
1646b92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Add `searchable` field to users, users who have it set to `false` won't be found by the public endpoint. | ||
Add `POST /users/:uid/searchable` endpoint where team admin can change it for user. | ||
Add `/teams/:tid/search?searchable=false`, where the query parameter makes it return only non-searchable users. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,7 +161,6 @@ instance AsUnion DeleteSelfResponses (Maybe Timeout) where | |
type ConnectionUpdateResponses = UpdateResponses "Connection unchanged" "Connection updated" UserConnection | ||
|
||
type UserAPI = | ||
-- See Note [ephemeral user sideeffect] | ||
Named | ||
Comment on lines
163
to
164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The removal of 'See Note [ephemeral user sideeffect]' comments appears unrelated to the searchability feature. These documentation changes should be part of a separate commit focused on documentation cleanup. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These removals are in a separate commit. |
||
"get-user-unqualified" | ||
( Summary "Get a user by UserId" | ||
|
@@ -171,16 +170,14 @@ type UserAPI = | |
:> CaptureUserId "uid" | ||
:> GetUserVerb | ||
) | ||
:<|> | ||
-- See Note [ephemeral user sideeffect] | ||
Named | ||
"get-user-qualified" | ||
( Summary "Get a user by Domain and UserId" | ||
:> ZLocalUser | ||
:> "users" | ||
:> QualifiedCaptureUserId "uid" | ||
:> GetUserVerb | ||
) | ||
:<|> Named | ||
"get-user-qualified" | ||
( Summary "Get a user by Domain and UserId" | ||
:> ZLocalUser | ||
:> "users" | ||
:> QualifiedCaptureUserId "uid" | ||
:> GetUserVerb | ||
) | ||
:<|> Named | ||
"update-user-email" | ||
( Summary "Resend email address validation email." | ||
|
@@ -224,19 +221,17 @@ type UserAPI = | |
] | ||
(Maybe UserProfile) | ||
) | ||
:<|> | ||
-- See Note [ephemeral user sideeffect] | ||
Named | ||
"list-users-by-unqualified-ids-or-handles" | ||
( Summary "List users (deprecated)" | ||
:> Until 'V2 | ||
:> Description "The 'ids' and 'handles' parameters are mutually exclusive." | ||
:> ZUser | ||
:> "users" | ||
:> QueryParam' [Optional, Strict, Description "User IDs of users to fetch"] "ids" (CommaSeparatedList UserId) | ||
:> QueryParam' [Optional, Strict, Description "Handles of users to fetch, min 1 and max 4 (the check for handles is rather expensive)"] "handles" (Range 1 4 (CommaSeparatedList Handle)) | ||
:> Get '[JSON] [UserProfile] | ||
) | ||
:<|> Named | ||
"list-users-by-unqualified-ids-or-handles" | ||
( Summary "List users (deprecated)" | ||
:> Until 'V2 | ||
:> Description "The 'ids' and 'handles' parameters are mutually exclusive." | ||
:> ZUser | ||
:> "users" | ||
:> QueryParam' [Optional, Strict, Description "User IDs of users to fetch"] "ids" (CommaSeparatedList UserId) | ||
:> QueryParam' [Optional, Strict, Description "Handles of users to fetch, min 1 and max 4 (the check for handles is rather expensive)"] "handles" (Range 1 4 (CommaSeparatedList Handle)) | ||
:> Get '[JSON] [UserProfile] | ||
) | ||
:<|> Named | ||
"list-users-by-ids-or-handles" | ||
( Summary "List users" | ||
|
@@ -247,18 +242,16 @@ type UserAPI = | |
:> ReqBody '[JSON] ListUsersQuery | ||
:> Post '[JSON] ListUsersById | ||
) | ||
:<|> | ||
-- See Note [ephemeral user sideeffect] | ||
Named | ||
"list-users-by-ids-or-handles@V3" | ||
( Summary "List users" | ||
:> Description "The 'qualified_ids' and 'qualified_handles' parameters are mutually exclusive." | ||
:> ZUser | ||
:> Until 'V4 | ||
:> "list-users" | ||
:> ReqBody '[JSON] ListUsersQuery | ||
:> Post '[JSON] [UserProfile] | ||
) | ||
:<|> Named | ||
"list-users-by-ids-or-handles@V3" | ||
( Summary "List users" | ||
:> Description "The 'qualified_ids' and 'qualified_handles' parameters are mutually exclusive." | ||
:> ZUser | ||
:> Until 'V4 | ||
:> "list-users" | ||
:> ReqBody '[JSON] ListUsersQuery | ||
:> Post '[JSON] [UserProfile] | ||
) | ||
:<|> Named | ||
"send-verification-code" | ||
( Summary "Send a verification code to a given email address." | ||
|
@@ -294,6 +287,17 @@ type UserAPI = | |
'[JSON] | ||
(Respond 200 "Protocols supported by the user" (Set BaseProtocolTag)) | ||
) | ||
:<|> Named | ||
"set-user-searchable" | ||
( Summary "Set user's visibility in search" | ||
:> From 'V12 | ||
:> ZLocalUser | ||
:> "users" | ||
:> CaptureUserId "uid" | ||
:> "searchable" | ||
akshaymankar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
:> ReqBody '[JSON] SetSearchable | ||
:> Post '[JSON] () | ||
) | ||
|
||
type LastSeenNameDesc = Description "`name` of the last seen user group, used to get the next page when sorting by name." | ||
|
||
|
@@ -1735,6 +1739,13 @@ type SearchAPI = | |
] | ||
"email" | ||
EmailVerificationFilter | ||
:> QueryParam' | ||
[ Optional, | ||
Strict, | ||
Description "Optional, return only non-searchable members when false." | ||
] | ||
"searchable" | ||
Bool | ||
:> MultiVerb | ||
'GET | ||
'[JSON] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,9 @@ serviceWhitelistPermissions = | |
-- Perm | ||
|
||
-- | Team-level permission. Analog to conversation-level 'Action'. | ||
-- | ||
-- If you ever think about adding a new permission flag, read Note | ||
-- [team roles] first. | ||
Comment on lines
+131
to
+133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] The comment about reading 'Note [team roles]' was moved from after the data type definition to before it, but the new Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it was moved, it was definitely read. I moved it because it relates to the entire data type (as when it was next to a data constructor, it looked as if it only mattered to that particular one). |
||
data Perm | ||
= CreateConversation | ||
| -- NOTE: This may get overruled by conv level checks in case those are more restrictive | ||
|
@@ -153,8 +156,6 @@ data Perm | |
| DeleteTeam | ||
-- FUTUREWORK: make the verbs in the roles more consistent | ||
-- (CRUD vs. Add,Remove vs; Get,Set vs. Create,Delete etc). | ||
-- If you ever think about adding a new permission flag, | ||
-- read Note [team roles] first. | ||
deriving stock (Eq, Ord, Show, Enum, Bounded, Generic) | ||
deriving (Arbitrary) via (GenericUniform Perm) | ||
deriving (FromJSON, ToJSON) via (CustomEncoded Perm) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change from pattern matching to direct function composition appears to be unrelated to the searchability feature. Consider moving this refactoring to a separate commit or PR to maintain clear separation of concerns.
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of a functionally no-op refactor commit. The single line version is shorter, but still clear.