Edits not being stored in user_actions table

I thought that every time a user edits someone else’s post, this action would be recorded in the user_actions table, but I’ve just realized this only happens sporadically (only for some users some of the time).

Is this the intended behavior or is there another condition I’m not considering?

It’s hard to give a step-by-step to reproduce this issue, but this is how I detected it:

  1. Find a post with an edit notification:
    image
  2. Query user_actions for the given acting_user_id (the editor), the given user_id (the edited) and the given topic_id. In my case:
select * from user_actions ua 
where ua.acting_user_id = 229 
and ua.user_id = 259 
and ua.target_topic_id = 1907;

This is what I get:

  • Action type 2 means that the edited user received a LIKE from the editor.
  • Action type 6 means that the editor responded to the edited user.
  id   | action_type | user_id | target_topic_id | target_post_id | target_user_id | acting_user_id |         created_at         |         updated_at
-------+-------------+---------+-----------------+----------------+----------------+----------------+----------------------------+----------------------------
 78476 |           2 |     259 |            1907 |          17893 |                |            229 | 2020-03-20 03:39:12.255619 | 2020-03-20 03:39:12.395574
 78478 |           6 |     259 |            1907 |          17900 |                |            229 | 2020-03-20 03:44:04.847102 | 2020-03-20 03:44:04.847102

I can confirm both of these actions in the UI, but I would also expect to find an action_type 11 indicating the EDIT.

Besides seeing the edit in the UI, I can also confirm its existence in the post_revisions table querying using the target_post_id:

select id, user_id, post_id, number, created_at, updated_at from post_revisions pr where post_id = 17893;

  id  | user_id | post_id | number |         created_at         |         updated_at         |
------+---------+---------+--------+----------------------------+----------------------------+--------
 8927 |     229 |   17893 |      2 | 2020-03-20 03:40:06.644576 | 2020-03-20 03:43:32.769535 |

So, why doesn’t this action show up in user_actions?

1 Like

Edits are not meant to be stored there, they are stored in post_revisions.

2 Likes

Right, not the edit. I mean the user_action EDIT event:

The thing is that it’s triggered 90% of the time. I don’t understand why it doesn’t work the other 10%

1 Like