Failed to delete a user if user has started a chat

Unsolved Technical Support
  • Hi Community,

    I'm in the process of preparing a forum for the go-live and I want to cleanup all the users that tested it.
    This is easy as long as a user didn't engaged with the chat otherwise when I try to delete such user and his contents the deletion process breaks and the user becomes a zombie user (basically that disappears from the users list but remains attached to the group he was assigned and there are still track of him on the DB)

    The log shows:

    2021-04-23T14:05:53.452Z [4567/1009599] - verbose: [plugins/fireHook] filter:privileges:isUserAllowedTo
    2021-04-23T14:05:53.453Z [4567/1009599] - verbose: [plugins/fireHook] filter:privileges:isAllowedTo
    2021-04-23T14:05:53.455Z [4567/1009599] - verbose: [plugins/fireHook] filter:user.whitelistFields
    2021-04-23T14:05:53.456Z [4567/1009599] - verbose: [plugins/fireHook] filter:user.getFields
    2021-04-23T14:05:53.458Z [4567/1009599] - verbose: [plugins/fireHook] filter:users.get
    2021-04-23T14:05:53.468Z [4567/1009599] - verbose: [plugins/fireHook] static:user.delete
    2021-04-23T14:05:53.470Z [4567/1009599] - verbose: [plugins/fireHook] filter:user.whitelistFields
    2021-04-23T14:05:53.471Z [4567/1009599] - verbose: [plugins/fireHook] filter:user.getFields
    2021-04-23T14:05:53.472Z [4567/1009599] - verbose: [plugins/fireHook] filter:users.get
    2021-04-23T14:05:53.482Z [4567/1009599] - verbose: [plugins/fireHook] filter:messaging.isUserInRoom
    2021-04-23T14:05:53.491Z [4567/1009599] - verbose: [plugins/fireHook]
    [api] Exception caught, error with stack trace follows:
    Error: [[error:chat-room-does-not-exist]]
        at Messaging.markUnread (/home/nodebb/backstage_prod/src/messaging/unread.js:34:10)
        at runMicrotasks (<anonymous>)
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
        at async Promise.all (index 2)
        at async Messaging.addMessage (/home/nodebb/backstage_prod/src/messaging/create.js:58:3)
        at async Messaging.addSystemMessage (/home/nodebb/backstage_prod/src/messaging/create.js:77:19)
        at async Promise.all (index 1)
        at async Messaging.leaveRooms (/home/nodebb/backstage_prod/src/messaging/rooms.js:151:3)
        at async Promise.all (index 0)
        at async deleteChats (/home/nodebb/backstage_prod/src/user/delete.js:177:3)

    I'm currently on 1.16.2 and this looks to me like a bug.
    Do you have any idea on how I should clean-up the chat data of these users and then safely operate a "delete user and contents"?

    Cheers, Riccardo

  • Please report this as an issue on GitHub

  • @pitaj here you are 😉

Suggested Topics