@@ -94,15 +94,15 @@ def set_mod(sid):
94
94
- `rooms` — List of one or more room tokens to which the moderator status should be applied. The
95
95
invoking user must be an admin of all of the given rooms.
96
96
97
- This may be set to the single-element list ["*"] to add or remove the moderator from all
97
+ This may be set to the single-element list ` ["*"]` to add or remove the moderator from all
98
98
rooms in which the current user has admin permissions (the call will succeed if the calling
99
- user is an admin in at least one channel ).
99
+ user is an admin in at least one room ).
100
100
101
101
Exclusive of `global`.
102
102
103
103
- `global` — boolean value: if true then apply the change at the server-wide global level: the
104
- user will be added/removed as a global moderator. The invoking user must be a global admin in
105
- order to control global mods/admins.
104
+ user will be added/removed as a global moderator/admin . The invoking user must be a global
105
+ admin in order to control global mods/admins.
106
106
107
107
Exclusive of `rooms`.
108
108
@@ -156,7 +156,16 @@ def set_mod(sid):
156
156
157
157
# Return value
158
158
159
- On success returns a 200 status code with an empty JSON object as body.
159
+ On success returns a 200 status code with JSON object as body containing keys:
160
+
161
+ - "info_updates": this is an object where each key is a room token, and each value is that
162
+ room's new `info_updates` value. For a request making changes to room-level mods (i.e. using
163
+ the `rooms` parameter) this will be the new `info_updates` value for each of the given rooms.
164
+ For global moderator changes this will contain the new info_updates value of *all* rooms on
165
+ the server (because all rooms are updated when a global mod is added/removed).
166
+
167
+ These values can be useful to track whether possibly-concurrent room polling requests are
168
+ expected to have the moderator changes applied yet.
160
169
161
170
# Error status codes
162
171
@@ -205,6 +214,8 @@ def set_mod(sid):
205
214
if visible is None :
206
215
visible = True
207
216
217
+ info_updates = {}
218
+
208
219
with db .transaction ():
209
220
for room in rooms :
210
221
if (admin , mod ) in ((True , None ), (None , True )):
@@ -220,6 +231,8 @@ def set_mod(sid):
220
231
app .logger .error ("Internal error: unhandled mod/admin room case" )
221
232
raise RuntimeError ("Internal error: unhandled mod/admin room case" )
222
233
234
+ info_updates [room .token ] = room .info_updates
235
+
223
236
else : # global mod
224
237
if visible is None :
225
238
visible = False
@@ -234,8 +247,9 @@ def set_mod(sid):
234
247
with db .transaction ():
235
248
user .remove_moderator (removed_by = g .user , remove_admin_only = True )
236
249
user .set_moderator (added_by = g .user , admin = bool (admin ), visible = visible )
250
+ info_updates = {room .token : room .info_updates for room in mroom .get_rooms ()}
237
251
238
- return jsonify ({})
252
+ return jsonify ({"info_updates" : info_updates })
239
253
240
254
241
255
@users .post ("/user/<AnySessionID:sid>/ban" )
0 commit comments