Skip to content

Fix Redundant notifications when a component is (re)published#10690

Merged
alecslupu merged 1 commit intodevelopfrom
fix/9853
Apr 13, 2023
Merged

Fix Redundant notifications when a component is (re)published#10690
alecslupu merged 1 commit intodevelopfrom
fix/9853

Conversation

@alecslupu
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu commented Apr 6, 2023

🎩 What? Why?

Added a new method to publicable behavior, that is checking the versions of the resource for any changes on published_at field.

If this method returns true, then the notifications like will not be duplicated.

The #{election_name} election is now active for #{space}
The meeting #{meeting_name} has been added to #{space}
The #{component_name} component is now active for #{space}

If the method returns true, then the above notifications will be displayed.

📌 Related Issues

Link your PR to an issue

Testing

For Spaces:

  1. Go to front panel and follow and a Participatory space
  2. Visit admin section and publish / unpublish some components several times
  3. visit the notifications page, and see the notifications
  4. Apply the patch
  5. Repeat 1,2,3 for other Participatory space
  6. See the notifications are not being displayed.

For resources:

  1. Go to front panel and follow and a Participatory space
  2. Visit admin section and publish / unpublish some resources (meetings/elections) several times
  3. Visit the notifications page, and see the notifications
  4. Apply the patch
  5. Repeat 1,2,3 for other resource
  6. See the notifications are not being displayed.

📷 Screenshots

Please add screenshots of the changes you are proposing
Description

♥️ Thank you!

@alecslupu alecslupu added the type: fix PRs that implement a fix for a bug label Apr 10, 2023
@alecslupu alecslupu marked this pull request as ready for review April 10, 2023 21:54
@alecslupu alecslupu requested a review from a team April 10, 2023 21:55
Copy link
Copy Markdown
Member

@fblupi fblupi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alecslupu Maybe we could refactor the publish_event methods changing their name to send_notification. I think it would make it more consistent as there are too many methods with this name making Decidim::EventsManager.publish(...) and a few with the same functionality with the name publish_event.

This change isn't in the scope of this PR. We could include it in a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redundant notifications when a component is (re)published

2 participants