fix: Display complete/reopen actions in milestone notification#4389
Merged
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider avoiding multiple Repo.preload calls for author and company by preloading nested associations in one call (e.g.,
Repo.preload(activity, author: :company)) to reduce unnecessary queries. - The
headline_text/2function raises on unknownactionvalues; it may be safer to handlenilor unexpected values gracefully (e.g., defaulting to the comment-only headline) to avoid runtime errors whencomment_actionis missing or malformed. - The conditional logic that sets
{excerpt_html, excerpt_text}could be made clearer by pattern matching onaction(e.g., separate clauses for"none"vs others) instead of using an inlineif, which would also avoid creating an unused map just for destructuring.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider avoiding multiple Repo.preload calls for author and company by preloading nested associations in one call (e.g., `Repo.preload(activity, author: :company)`) to reduce unnecessary queries.
- The `headline_text/2` function raises on unknown `action` values; it may be safer to handle `nil` or unexpected values gracefully (e.g., defaulting to the comment-only headline) to avoid runtime errors when `comment_action` is missing or malformed.
- The conditional logic that sets `{excerpt_html, excerpt_text}` could be made clearer by pattern matching on `action` (e.g., separate clauses for `"none"` vs others) instead of using an inline `if`, which would also avoid creating an unused map just for destructuring.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Signed-off-by: Adriano Lazzaretti <lazzaretti136@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.