Skip to content

[TAN-8027] Bugfix: Editing cosponsors of an idea results in invitation notifications (and emails, if possible)#14163

Merged
jinjagit merged 3 commits into
masterfrom
TAN-8027-bugfix-updating-cosponsors-results-in-invitation-notifications
Jun 24, 2026
Merged

[TAN-8027] Bugfix: Editing cosponsors of an idea results in invitation notifications (and emails, if possible)#14163
jinjagit merged 3 commits into
masterfrom
TAN-8027-bugfix-updating-cosponsors-results-in-invitation-notifications

Conversation

@jinjagit

@jinjagit jinjagit commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

When cosponsorship(s) created via an idea create, everything seems to work fine.

However, when cosponsorship(s) were edited via an idea update, the LogActivityJob(s) needed to create the activities, in turn needed to trigger the notifications inviting the user(s) to accept the cosponsorship, were never created. 😬

Changelog

Fixed

  • [TAN-8027] Bugfix: Editing cosponsors of an idea results in invitation notifications (and emails, if possible)

@jinjagit jinjagit self-assigned this Jun 23, 2026
@notion-workspace

Copy link
Copy Markdown

@cl-dev-bot

cl-dev-bot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator
Messages
📖 Changelog provided 🎉
📖 Notion issue: TAN-8027
📖

Run the e2e tests

📖 Check translation progress

Generated by 🚫 dangerJS against 422955e

Comment on lines +494 to +507
# phase_ids/cosponsor_ids must be assigned *after* SideFxIdeaService#before_update so it
# can snapshot the prior associations. Assigning them via assign_attributes (which mutates
# the persisted record immediately) would make the before/after diff empty — e.g. no
# newly-added cosponsors would be detected, so their invite notifications wouldn't be sent.
def extract_deferred_relationship_ids(update_params)
phase_ids = update_params.delete(:phase_ids) if update_params[:phase_ids]
cosponsor_ids = update_params.delete(:cosponsor_ids) if update_params.key?(:cosponsor_ids)
[phase_ids, cosponsor_ids]
end

def assign_deferred_relationship_ids(input, phase_ids, cosponsor_ids)
input.phase_ids = phase_ids if phase_ids
input.cosponsor_ids = cosponsor_ids unless cosponsor_ids.nil?
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The use of phase_ids was not changed, but included here as I needed to refactor something to get past the 'Method has too many lines' Rubocop rule, and this refactor seemed the best way to include the new code whilst not making the method longer.

@jinjagit
jinjagit requested a review from jamesspeake June 23, 2026 15:39

@jamesspeake jamesspeake left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me. One small comment

Comment thread back/app/controllers/web_api/v1/ideas_controller.rb Outdated
@jinjagit
jinjagit merged commit 42ea649 into master Jun 24, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants