Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Article post_commit when user_id changes with specs #15132

Conversation

lsparlin
Copy link
Contributor

@lsparlin lsparlin commented Oct 20, 2021

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

When an article user_id (Author) is changed by an Admin, NotificationSubscriptions belonging to that article should start sending to the new author instead of the old one.
This pull request adds an after_update_commit to be called only when the user_id changes that will update all the NotificationSubscriptions belonging to the article.

Related Tickets & Documents

Closes #14886

QA Instructions, Screenshots, Recordings

  • Create a post/article (or find one)
  • Log in as an Admin
  • Change the author ID on the post through the Admin interface
  • Observe that new comments on the article create notifications for the new Use rand not the original

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

[Forem core team only] How will this change be communicated?

Will this PR introduce a change that impacts Forem members or creators, the
development process, or any of our internal teams? If so, please note how you
will share this change with the people who need to know about it.

  • I've updated the Developer Docs or
    Storybook (for Crayons components)
  • This PR changes the Forem platform and our documentation needs to be
    updated. I have filled out the
    Changes Requested
    issue template so Community Success can help update the Admin Docs
    appropriately.
  • I've updated the README or added inline documentation
  • I've added an entry to
    CHANGELOG.md
  • I will share this change in a Changelog
    or in a forem.dev post
  • I will share this change internally with the appropriate teams
  • I'm not sure how best to communicate this change and need help
  • This change does not need to be communicated, and this is why not: please
    replace this line with details on why this change doesn't need to be
    shared

@lsparlin lsparlin requested a review from a team as a code owner October 20, 2021 02:20
@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Oct 20, 2021
@github-actions
Copy link
Contributor

Thank you for opening this PR! We appreciate you!

For all pull requests coming from third-party forks we will need to
review the PR before we can process it through our CI pipelines.

A Forem Team member will review this contribution and get back to
you as soon as possible!

Copy link
Contributor

@msarit msarit left a comment

Choose a reason for hiding this comment

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

With two accounts open (one in an incognito tab), I tested as follows:

  • Published an article as User1, commented on said article as User2, and ensured that User1 got the notification
  • Changed the author of article from user1 to User2, commented on said article as User1, and ensured that (1) User1 received no notifications (2) User2 got the notifications

Changes work as expected. 🚀

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 20, 2021
@citizen428 citizen428 merged commit e621659 into forem:main Oct 25, 2021
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 25, 2021
citizen428 pushed a commit that referenced this pull request Oct 29, 2021
* Add Article post_commit when user_id changes with specs

* Add example in requests/admin/articles_spec for updating user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When changing author's of a post, new author does not receive notifications about that post
4 participants