Skip to content

Commit

Permalink
correctly inform online sharers on topic membership changes
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Dec 25, 2018
1 parent ae26f44 commit a5441af
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions server/topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -1204,11 +1204,15 @@ func (t *Topic) approveSub(h *Hub, sess *Session, asUid, target types.Uid, set *
target: target.UserId(),
dWant: oldWant.Delta(userData.modeWant),
dGiven: oldGiven.Delta(userData.modeGiven)}
filter := &presFilters{filterIn: types.ModeCSharer}

// Inform topic sharers.
t.presSubsOffline("acs", params, &presFilters{filterIn: types.ModeCSharer}, sess.sid, false)
// Inform topic sharers who are currently not in topic that the user's access mode has changed.
t.presSubsOffline("acs", params, filter, sess.sid, true)

// If tagret user is not a sharer, inform the target user separately.
// Inform sharers online in topic of the same event.
t.presSubsOnline("acs", params.target, params, filter, sess.sid)

// If target user is not a sharer, inform the target user separately.
if !(userData.modeGiven & userData.modeWant).IsSharer() {
t.presSingleUserOffline(target, "acs", params, sess.sid, false)
}
Expand Down

0 comments on commit a5441af

Please sign in to comment.