Skip Display to own activities not working as expected

Created on 28 February 2025, 4 months ago

Problem/Motivation

On the site where I am wanting to use this module, there are 14 notifications, two of which come from my own user's actions. If I have the "Skip Display to own activities" checkbox checked, I see no notifications. If I uncheck the box, I see two. None of the other 12 show.

Proposed resolution

The patch I am attaching shows me 12 items when I have "Skip Display to own activities" checked and 14 items when I have it unchecked.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States andileco

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @andileco
  • Pipeline finished with Success
    4 months ago
    Total: 149s
    #437177
  • πŸ‡ΊπŸ‡ΈUnited States andileco
  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    Thanks for the merge request!

    I don't remember by hearth how notifications are stored, so I'll need to manually test this change.

  • Issue was unassigned.
  • Status changed to Needs review 26 days ago
  • I was starting to think I was the only one unable to make this module work. I have the recommended configuration in the block.
    - Notification content: As logged-in user
    - Skip Display to own activities

    But by default, after installing and uninstalling the module several times (both 1.x and 2.x versions) No notification showed.

    If I turned off: Skip Display to own activities checkbox, a user would see notices for their own activities, but not other people's. Setting the block to show notifications "As Admin" seemed to show everything to everyone.

    I applied the patch from @andileco, and that makes the module work as I expected it to. Authenticated users now see notifications of actions by other users.

    I recommend merging this with the next module release.

  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    Thanks for testing. Merged and will tag a new release

  • πŸ‡ΊπŸ‡ΈUnited States tjhellmann Indianapolis, IN

    We applied the latest alpha today and the notifications counts for all of our users were all off, showing all notifications to all users. Tracking backwards it was this commit that caused the issue and specifically the part that removed this line from the query:
    $query->condition('n.entity_uid', $uid); When that line is re-applied the notification counts are all correct again.

    In case it's helpful for context we're using the notifications_widget.logger service in a custom module to add a custom notification for each user in a comment thread (except the comment author) when a new comment is added.

    Going to mark this as needs work in case others are experiencing the same thing.

  • πŸ‡§πŸ‡ͺBelgium BramDriesen Belgium πŸ‡§πŸ‡ͺ

    Hmm that should not happen. I think the whole if/else section could be simplified to also improve readability.
    And o boy, what a bad variable naming happened when this module was created πŸ˜…
    I think a small description for what "Skip Display to own activities" does would also help.

Production build 0.71.5 2024