File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -960,3 +960,33 @@ def delete_all_posts(room, sid):
960
960
if not deleted :
961
961
abort (http .NOT_FOUND )
962
962
return jsonify ({})
963
+
964
+
965
+ @rooms .delete ("/rooms/all/<SessionID:sid>" )
966
+ def delete_user_posts_from_all_rooms (sid ):
967
+ """
968
+ Deletes all posts from all rooms by a given user.
969
+
970
+ # URL Parameters
971
+
972
+ - `sid` — the session id of the user to ban
973
+
974
+ # Return value
975
+
976
+ A JSON dict with the keys:
977
+
978
+ - `total` — The total number of posts deleted across all rooms.
979
+ - `rooms` — A dict of room tokens and their deletion counts.
980
+ """
981
+ deletions = {}
982
+ total = 0
983
+ user = muser .User (session_id = sid , autovivify = False )
984
+ for room in mroom .get_accessible_rooms (g .user ):
985
+ try :
986
+ count , _ = room .delete_all_posts (user , deleter = g .user )
987
+ total += count
988
+ deletions [room .token ] = count
989
+ except exc .BadPermission :
990
+ pass
991
+
992
+ return jsonify ({"total" : total , "rooms" : deletions })
Original file line number Diff line number Diff line change @@ -293,7 +293,7 @@ def ban_user(sid):
293
293
294
294
The user's messages are not deleted by this request. In order to ban and delete all messages
295
295
use the [`/sequence`](#post-sequence) endpoint to bundle a `/user/.../ban` with a
296
- [`/user/ .../deleteMessages `](#post-usersiddeleteMessages ) request.
296
+ [`/rooms/all/ ...`](#delete-roomsallsid ) request.
297
297
298
298
# Return value
299
299
You can’t perform that action at this time.
0 commit comments