Skip to content

Commit f114414

Browse files
committed
fix: rebase
1 parent 6277070 commit f114414

File tree

3 files changed

+12
-46
lines changed

3 files changed

+12
-46
lines changed

libs/wire-subsystems/src/Wire/AppSubsystem/Interpreter.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ createAppImpl lusr tid new = do
8585
Store.createUser u Nothing
8686

8787
-- generate a team event
88-
generateTeamEvent creator.id tid (EdAppCreate u.id)
88+
generateTeamEvents creator.id tid [EdAppCreate u.id]
8989

9090
c :: Cookie (Token U) <- newCookie u.id Nothing PersistentCookie (Just "app")
9191
pure

libs/wire-subsystems/src/Wire/TeamCollaboratorsSubsystem/Interpreter.hs

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ createTeamCollaboratorImpl zUser user team perms = do
6969
Store.createTeamCollaborator user team perms
7070

7171
-- TODO: Review the event's values
72-
generateTeamEvent (tUnqualified zUser) team (EdCollaboratorAdd user (Set.toList perms))
72+
generateTeamEvents (tUnqualified zUser) team [EdCollaboratorAdd user (Set.toList perms)]
7373

7474
getAllTeamCollaboratorsImpl ::
7575
( Member TeamSubsystem r,
@@ -109,48 +109,15 @@ updateTeamCollaboratorImpl zUser user team perms = do
109109
guardPermission (tUnqualified zUser) team TeamMember.UpdateTeamCollaborator InsufficientRights
110110
Store.updateTeamCollaborator user team perms
111111

112-
now <- get
113-
teamMembersList <- internalGetTeamAdmins team
114-
let teamMembers :: [UserId] = view TeamMember.userId <$> (teamMembersList ^. TeamMember.teamMembers)
115-
116112
extraNotifications <-
117113
if Set.null $ Set.intersection (Set.fromList [CreateTeamConversation, ImplicitConnection]) perms
118114
then do
119115
leavingConversations <- internalLeaveConversationsFrom team user
120-
pure $
121-
leavingConversations.close <&> \convId ->
122-
def
123-
{ origin = Just (tUnqualified zUser),
124-
json = toJSONObject $ newEvent team now (EdConvDelete convId),
125-
recipients =
126-
( \uid ->
127-
Recipient
128-
{ recipientUserId = uid,
129-
recipientClients = Push.RecipientClientsAll
130-
}
131-
)
132-
<$> teamMembers,
133-
transient = False
134-
}
116+
pure $ EdConvDelete <$> leavingConversations.close
135117
else pure []
136118

137-
let event = newEvent team now (EdCollaboratorUpdate user $ Set.toList perms)
138119
-- TODO: Review the event's values
139-
pushNotifications $
140-
def
141-
{ origin = Just (tUnqualified zUser),
142-
json = toJSONObject $ event,
143-
recipients =
144-
( \uid ->
145-
Recipient
146-
{ recipientUserId = uid,
147-
recipientClients = Push.RecipientClientsAll
148-
}
149-
)
150-
<$> teamMembers,
151-
transient = False
152-
}
153-
: extraNotifications
120+
generateTeamEvents (tUnqualified zUser) team (EdCollaboratorAdd user (Set.toList perms) : extraNotifications)
154121

155122
internalRemoveTeamCollaboratorImpl ::
156123
( Member Store.TeamCollaboratorsStore r

libs/wire-subsystems/src/Wire/TeamSubsystem/Util.hs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,24 @@ import Wire.NotificationSubsystem
1313
import Wire.Sem.Now
1414
import Wire.TeamSubsystem
1515

16-
-- | Generate a team event and send it to all team admins
17-
generateTeamEvent ::
16+
-- | Generate team events and send them to all team admins
17+
generateTeamEvents ::
1818
( Member Now r,
1919
Member TeamSubsystem r,
2020
Member NotificationSubsystem r
2121
) =>
2222
UserId ->
2323
TeamId ->
24-
EventData ->
24+
[EventData] ->
2525
Sem r ()
26-
generateTeamEvent uid tid edata = do
26+
generateTeamEvents uid tid eventsData = do
2727
now <- get
28-
let event = newEvent tid now edata
2928
admins <- internalGetTeamAdmins tid
30-
pushNotifications
31-
[ def
29+
pushNotifications $
30+
eventsData <&> \eData ->
31+
def
3232
{ origin = Just uid,
33-
json = toJSONObject $ event,
33+
json = toJSONObject $ newEvent tid now eData,
3434
recipients =
3535
[ Recipient
3636
{ recipientUserId = u,
@@ -40,4 +40,3 @@ generateTeamEvent uid tid edata = do
4040
],
4141
transient = False
4242
}
43-
]

0 commit comments

Comments
 (0)