I have some messages I'd like to move to the chat moderation Trashcan. Some of them were left by a chat user who is now deleted. However I cannot move those messages: I can select them to go through the message relocation process, but at the end instead of them getting moved... nothing happens at all. Chat doesn't even give me an error message.

I can still delete them, but I can't move them, and I'd rather move them than leave a tower of (removed) behind. This occurs even with all my userscripts and privacy addons disabled.

I do however I get the following 500 error in my network tab:

enter image description here

These network requests are: (1) after I hit the Room dropdown, (2) the room option list loading after I search for the room name I want to move the messages to, then (3) and (4) after I hit the "choose" button on the room I want. 302 is a POST then redirection to a page that gives me a 500.

  • 4
    I believe that moving comments to chat also fails if any commenter's account is deleted. This probably means the problem is at the "write" end, when the code tries to write a chat message and link it to a user. There's probably some "only actual users can post chat messages" logic impeding moves. Jul 29, 2018 at 22:20
  • This definitely happens for ROs. However, I thought moving them worked for moderators. For ROs, IIRC, the AJAX call to move the posts will just silently fail if any of the messages in the list of selected messages are authored by a deleted user (i.e. no messages are moved). I may be not be remembering this exactly correctly, as it's been a couple of years since I had to work around this issue.
    – Makyen
    Jun 3, 2020 at 10:26
  • @Makyen That's exactly what happened for me, and I was a diamond moderator at the time of reporting this. Jun 3, 2020 at 12:58
  • @doppelgreener I guess I might not be remembering what happened some of the times we encountered this issue. What I thought happened was that another RO asked a moderator to move the message and the moderator did so. What I was remembering was that request/action sequence happened on at least two or three messages at different times.
    – Makyen
    Jun 3, 2020 at 18:52
  • @Makyen I dunno how the moderator succeeded then! That screenshot is me, an RPG.SE diamond moderator at the time, trying and failing to move chat messages of a deleted user out of an RPG.SE chat room into trash. And it silently failed just like you described on account of that 500 error. Jun 3, 2020 at 19:30

1 Answer 1


This is fixed.

The problem was a bad abstraction in the audit log code. The audit logs take an IUser abstraction when recording who was affected by a change; this can be a user, a room, or a message. Users and rooms both have concrete primary non-null Ids. Messages have nullable foreign user Ids that get nulled out when a user is deleted.

Unfortunately, the abstraction had interface IUser { int UserId { get; } } so messages had int IUser.UserId => UserId ?? 0;. When we tried logging that a message by a deleted user was deleted, we got a foreign key error in the logging table because there is no user zero.

To resolve this, I made that property nullable and then had to resolve every case where the protocol UserId was consumed. In most of the cases, thankfully, it was in methods that only ever took a concrete type anyway.

  • 4
    You could also create a dummy user with UserId of 0, and save yourself any code change. Kudos for taking the long way. :-) Aug 3, 2020 at 17:53
  • @ShadowWizardWearingMask when can you award a bounty? I'm guessing you can't now or you'd have done it already :)
    – Ollie
    Aug 3, 2020 at 19:14
  • @Ollie 24 hours from the time of starting it. 21 hours left. ;) Aug 3, 2020 at 20:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .