refactor: have single source of truth#1630
Merged
Merged
Conversation
…ementations to retrieve it from API
…s to retrieve it from API
…ions to retrieve it from API
…s to retrieve it from API
…on in on_info method
5465e7d to
e26fd7f
Compare
…eate_task_event method
…efault constructor
Comment on lines
+55
to
+57
| pub fn into_feedback(mut self) -> Self { | ||
| self.event.name = format!("{}/{}", self.event.name, EVENT_USER_TASK_UPDATE); | ||
| self |
Contributor
There was a problem hiding this comment.
Consider adding a check to prevent duplicate suffixes in into_feedback(). Currently, if this method is called multiple times on the same object, it will repeatedly append the EVENT_USER_TASK_UPDATE suffix to the event name. A simple guard condition would prevent this:
pub fn into_feedback(mut self) -> Self {
if !self.event.name.ends_with(EVENT_USER_TASK_UPDATE) {
self.event.name = format!("{}/{}", self.event.name, EVENT_USER_TASK_UPDATE);
}
self
}The same issue applies to the into_task() method.
Suggested change
| pub fn into_feedback(mut self) -> Self { | |
| self.event.name = format!("{}/{}", self.event.name, EVENT_USER_TASK_UPDATE); | |
| self | |
| pub fn into_feedback(mut self) -> Self { | |
| if !self.event.name.ends_with(EVENT_USER_TASK_UPDATE) { | |
| self.event.name = format!("{}/{}", self.event.name, EVENT_USER_TASK_UPDATE); | |
| } | |
| self |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
c17c73b to
085d0ed
Compare
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.
fixes #1632