وسوم الموظفين تسبب فهرس وسوم مكرر

Continuing the discussion from ActiveRecord::RecordNotUnique on idx_tag_users_ix1: How to fix?:

The error was reproduced. I think I’m on a trail to figure this bug out.

Steps to reproduce

  1. Create a tag #foo

  2. Limit tag #foo usage to Staff

  3. Create a group Bar

  4. Assign a Watching notification of tag #foo for group Bar

  5. Have a non-privileged user join group Bar

  6. and change their personal notification for #foo to Normal

  7. Non-privileged user should be unable to read a page anymore

I suspect this is what is happening, since it happened twice to different people. The error goes like this: https://oxygen.offdem.net/logs/show/f70207d3affa8967932b9122d2be212b

Maybe the title is a bit limiting. I think it has more to do with tag restriction to groups and personal notifications.

All new users now have a duplicate entry which must be removed from the console:

 r = TagUser.connection.execute("SELECT user_id, tag_id, count(*) FROM tag_users GROUP BY tag_id, user_id HAVING count(*) > 1")
r.values.each { |uid,tag,_| TagUser.where(user_id: uid, tag_id: tag).last.destroy }

I’m not sure I’m doing the repro right…

  • Create tag group
  • Create #staff-tag tag in tag group
  • Set ‘Tags are visible to everyone, but only the following groups can use them’ to staff

  • Create group
  • On /manage/tags, add #staff-tag to Watching
  • Add test user (TL2) to group
  • Confirm #staff-tag is Watching for test user in Preferences/Tracking

  • Navigate to /tags/staff-tag and change bell icon to 'Normal`

Everything seems to work?

I’m not sure about this step. I used the group notifications to add the tag in the watching notifications for the group

I meant this page here:

I maybe over-abbreviated the link - /g/GROUPNAME/manage/tags

Or do I need to try from another spot?

I don’t know really. I cannot spend much time on it before OFFDEM. For now I’m running the SQL requests to fix the issue for new users as they come. Maybe I overlooked a detail. Like… All categories are muted by default, that might affect the notifications.

That may be relevant. Are you using the mute all categories by default setting for that?

إعجاب واحد (1)

Yes I do use this setting.