-
Notifications
You must be signed in to change notification settings - Fork 334
WPB-18190: Add route to delete collaborator from team #4694
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
4084173
586f331
cfead2e
9571202
f6955b3
0c35a6f
1bb0ac7
f77061f
0bc8ca5
f449c50
120ca1b
970e054
26aec51
51c3b60
7cdb9c7
e6d1b3e
5f3bfbd
22221b6
9b28702
55cbe59
b3e2b60
0e4ba6a
bff2966
c572f53
c217801
869c0ab
cc93c00
a845443
0b1bc4a
2e08048
f71e5e4
d6c5c6f
485bbcf
8921bbc
87646c5
f9e0b31
3614fb6
97371d0
152359e
c3cc262
6be8485
5239163
c585a07
14c857a
8368ee6
2c4b431
c711d68
a721475
d8b1e27
9986c2f
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 @@ | ||
Allow collaborator to be removed from a team. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -125,6 +125,7 @@ data EventType | |||||
| ConvDelete | ||||||
| CollaboratorAdd | ||||||
| AppCreate | ||||||
| CollaboratorRemove | ||||||
deriving stock (Eq, Show, Generic) | ||||||
deriving (Arbitrary) via (GenericUniform EventType) | ||||||
deriving (FromJSON, ToJSON, S.ToSchema) via Schema EventType | ||||||
|
@@ -142,7 +143,8 @@ instance ToSchema EventType where | |||||
element "team.conversation-create" ConvCreate, | ||||||
element "team.conversation-delete" ConvDelete, | ||||||
element "team.collaborator-add" CollaboratorAdd, | ||||||
element "team.app-create" AppCreate | ||||||
element "team.app-create" AppCreate, | ||||||
element "team.collaborator-remove" CollaboratorRemove | ||||||
] | ||||||
|
||||||
-------------------------------------------------------------------------------- | ||||||
|
@@ -159,6 +161,7 @@ data EventData | |||||
| EdConvDelete ConvId | ||||||
| EdCollaboratorAdd UserId [CollaboratorPermission] | ||||||
| EdAppCreate UserId | ||||||
| EdCollaboratorRemove UserId | ||||||
deriving stock (Eq, Show, Generic) | ||||||
|
||||||
-- FUTUREWORK: this is outright wrong; see "Wire.API.Event.Conversation" on how to do this properly. | ||||||
|
@@ -189,6 +192,7 @@ instance ToJSON EventData where | |||||
"permissions" A..= perms | ||||||
] | ||||||
toJSON (EdAppCreate usr) = A.object ["user" A..= usr] | ||||||
toJSON (EdCollaboratorRemove usr) = A.object ["user" A..= usr] | ||||||
|
||||||
eventDataType :: EventData -> EventType | ||||||
eventDataType (EdTeamCreate _) = TeamCreate | ||||||
|
@@ -201,6 +205,7 @@ eventDataType (EdConvCreate _) = ConvCreate | |||||
eventDataType (EdConvDelete _) = ConvDelete | ||||||
eventDataType (EdCollaboratorAdd _ _) = CollaboratorAdd | ||||||
eventDataType (EdAppCreate _) = AppCreate | ||||||
eventDataType (EdCollaboratorRemove _) = CollaboratorRemove | ||||||
|
||||||
parseEventData :: EventType -> Maybe Value -> Parser EventData | ||||||
parseEventData MemberJoin Nothing = fail "missing event data for type 'team.member-join'" | ||||||
|
@@ -215,11 +220,11 @@ parseEventData MemberLeave Nothing = fail "missing event data for type 'team.mem | |||||
parseEventData MemberLeave (Just j) = do | ||||||
let f o = EdMemberLeave <$> o .: "user" | ||||||
withObject "member leave data" f j | ||||||
parseEventData ConvCreate Nothing = fail "missing event data for type 'team.conversation-create" | ||||||
parseEventData ConvCreate Nothing = fail "missing event data for type 'team.conversation-create'" | ||||||
parseEventData ConvCreate (Just j) = do | ||||||
let f o = EdConvCreate <$> o .: "conv" | ||||||
withObject "conversation create data" f j | ||||||
parseEventData ConvDelete Nothing = fail "missing event data for type 'team.conversation-delete" | ||||||
parseEventData ConvDelete Nothing = fail "missing event data for type 'team.conversation-delete'" | ||||||
parseEventData ConvDelete (Just j) = do | ||||||
let f o = EdConvDelete <$> o .: "conv" | ||||||
withObject "conversation delete data" f j | ||||||
|
@@ -235,6 +240,10 @@ parseEventData AppCreate Nothing = fail "missing event data for type 'team.app-c | |||||
parseEventData AppCreate (Just j) = do | ||||||
let f o = EdAppCreate <$> o .: "user" | ||||||
withObject "app create data" f j | ||||||
parseEventData CollaboratorRemove Nothing = fail "missing event data for type 'team.collaborator-remove" | ||||||
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. Missing closing quote in error message. Should be "missing event data for type 'team.collaborator-remove'".
Suggested change
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. fixed, thanks non-human. |
||||||
parseEventData CollaboratorRemove (Just j) = do | ||||||
let f o = EdCollaboratorRemove <$> o .: "user" | ||||||
withObject "collaborator remove data" f j | ||||||
parseEventData _ Nothing = pure EdTeamDelete | ||||||
parseEventData t (Just _) = fail $ "unexpected event data for type " <> show t | ||||||
|
||||||
|
@@ -250,5 +259,6 @@ genEventData = \case | |||||
ConvDelete -> EdConvDelete <$> arbitrary | ||||||
CollaboratorAdd -> EdCollaboratorAdd <$> arbitrary <*> arbitrary | ||||||
AppCreate -> EdAppCreate <$> arbitrary | ||||||
CollaboratorRemove -> EdCollaboratorRemove <$> arbitrary | ||||||
|
||||||
makeLenses ''Event |
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 not sent, is it?
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.
added, thanks.