Issues with post_edits report

AI-generated summary

Issues with post_edits report

Carleas is experiencing issues with the /admin/reports/post_edits report. The report does not include users’ edits to their own posts by default, and there is no URL parameter to see these edits for all users at once.

Even when filtered to a specific user, the report does not show all edits. For example, Carleas has 75 edits, but the log only shows 51. The type of excluded edits is unknown.

Carleas investigated the code and found that the report’s logic for filtering edits is unexpected. The export also does not include the post content, only the date, editor, post author, and reason.

Carleas suspects that the count mismatch might be due to the report counting multiple edits to the same post, but only showing the post once. However, this explanation is not entirely convincing given the large discrepancy in edit counts for some users.

I have some questions about the /admin/reports/post_edits.

The default report doesn’t include users’ edits to their own posts. To see a user’s self-edits, I can filter by editor to that user, i.e. /admin/reports/post_edits?filters={"editor"%3A"username"} (done automatically when clicking from the link on the user’s admin page), but that’s only for one user at a time. Is there a URL parameter to see these for all users? I tried filters={"editor"%3A"*"}, no luck.

Even when it’s filtered to a specific user, it doesn’t show all edits. For example, my user page says I have 75 edits, but the log only shows 51, as does the export. What kind of edits are excluded? Is there a way to see them all?

My forum is less than a month old, and there are edits from the first day the forum was live, so I don’t think it’s that the logs are truncated.

The export also doesn’t include the post, it only shows the date, the editor, the post author, and the reason (there is a column for post but it’s empty). Is that expected?

For the self-edits, I found this from app/models/concerns/reports/post_edits.rb:

if editor_username
        builder.where("editor.username = ?", editor_username)
      else
        builder.where("editor.id > 0 AND editor.id != author.id")
      end

That is, if the username exists, show edits from that username, if not show edits where editor doesn’t equal author. That’s unexpected.


For the count mismatch, it might be that it’s counting multiple edits to the same post, but only showing the post once. I’m hesitant to accept that because I have users with 150+ edits that show <50 edits in the log. It’s hard to believe that they’re editing post an average of three times, but I guess it takes all kinds :slightly_smiling_face: