Fix: `delete-messages-from-user.js` should remove message instead of clearing them
Closes #1626 (closed)
The first commit refactors the script not to use bluebird and to use async/await, the second commit utilizes chatService
to delete each message.
Testing:
- temporarily add the script to
beta
because ES doesn't work locally
ssh gitter-beta-01.beta.gitter
$ cd /opt/gitter/gitter-webapp/ && eval $(/opt/gitter/secrets/webapp/env beta) && eval $(/usr/bin/ns-env )
$ export NODE_ENV=beta
$ cd scripts/utils/
$ sudo su
root$ touch dmfu.js
root$ chown deployer dmfu.js
root$ chmod +x dmfu.js
root$ exit
$ vim dmfu.js # paste content of the script file from this MR to the vim editor
- have two users join the same room
- one of the users is not actively in the room (so we can validate unreads being added and removed)
- the other user creates ten messages with the same string (e.g.
abc
) - now validate that the first user can see 10 unreads in left menu
- run the script
./dmfu.js -u username -g abc --dry
- testing the dry run - run the script
./dmfu.js -u username -g abc
- this should delete all ten messages - validate that the messages are deleted and that the first user doesn't have any unreads (using regex not to delete all the messages)
Edited by 🤖 GitLab Bot 🤖