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

Fix missing observer in some observation mails #486

Merged
merged 2 commits into from
Apr 30, 2024

Conversation

tsubik
Copy link
Collaborator

@tsubik tsubik commented Apr 19, 2024

Sometimes, for example when backoffice admin updates observation through observation tool the observer is missing from modified_user as that user is of admin type and has no observer attached. In that case, we will use observer from the user who created observation if somehow that one is null then just use first observer from observation.

PT: https://www.pivotaltracker.com/story/show/187390044

@tsubik tsubik requested a review from santostiago April 19, 2024 14:49
mail to: user.email, subject: I18n.t(subject_i18n_key, observer: @observer.name, id: observation.id)
end

private

def observer
@observation.modified_user.observer
@observation.modified_user.observer || @observation.user&.observer || @observation.observers.first
Copy link
Contributor

Choose a reason for hiding this comment

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

and modified_user is never nil?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Right, probably not, but just to be safe I will change it.

@tsubik tsubik merged commit 0db3293 into develop Apr 30, 2024
4 checks passed
@tsubik tsubik deleted the fix/observations-mails branch April 30, 2024 10:34
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.

None yet

2 participants