Utility script to delete stuck mention
We have a need for a utility script to delete stuck mention. There is a user with a room in their left-menu that won't go away. They can't leave the room because they no longer have access but they have a mention which makes it show up on their left-menu.
It's not part of their troupeuser
membership and only appears because of roomService.findAllRoomsIdsForUserIncludingMentions(userId)
-> unreadItemService
engine.getRoomsMentioningUser
-> Redis stuff
We can use engine.removeItem()
in our utility script to remove the stuck mention.
We have a similar utility script for fixing up stuck unread situations with deleted messages that we can base it off of: scripts/utils/unread-remove-deleted-messages.js
Zendesk tickets:
Dev notes
Looking at room membership for a given room and user:
$ ssh mongo-replica-01.prod.gitter
$ mongo mongo-replica-01.prod.gitter
> use gitter
// No results
db.troupeusers.findOne({
troupeId: db.troupes.findOne({ lcUri: 'launchacademy' })._id,
userId: db.users.findOne({ username: 'kevlarr' })._id
})
// Lots of results from different users
db.troupeusers.find({
troupeId: db.troupes.findOne({ lcUri: 'launchacademy' })._id
})
// Only one result for `actix/actix-web`
db.troupeusers.find({
userId: db.users.findOne({ username: 'kevlarr' })._id
})