-
Notifications
You must be signed in to change notification settings - Fork 3k
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 report action draft still present after deleting the workspace #30049
Conversation
@aimane-chnaif Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Additional video showing the draft is deleted when the workspace is deleted from another client/device Screen.Recording.2023-10-20.at.11.35.22.mov |
if (!_.isString(reportActionDraft)) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: Is there any non-string case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One case is when the action draft is already migrated to an object, so we skip it.
I don't know if it is possible that a user have both old and new structure of action draft, but just to be safe.
Reviewer Checklist
Screenshots/VideosWebweb-ios.movMigration testBefore: before.migration.movAfter: after.migration.movMobile Web - Chromedesktop-mchrome.movMobile Web - Safariandroid-msafari.movDesktopdesktop-mchrome.moviOSweb-ios.movAndroidandroid-msafari.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
const reportActionID = onyxKey.split('_').pop(); | ||
const newOnyxKey = onyxKey.replace(`_${reportActionID}`, ''); | ||
newReportActionsDrafts[newOnyxKey] = { | ||
...(newReportActionsDrafts[newOnyxKey] || allReportActionsDrafts[newOnyxKey]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does || allReportActionsDrafts[newOnyxKey]
do in here? do we ever set allReportActionsDrafts[newOnyxKey]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's to cover a case where there is already an existing migrated draft of newOnyxKey
.
the example is on the 2nd unit test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment to make that obvious please? I see the test, and with one of the values for reportID 2 set to {}
and one to null, but is that something that can happen, like having a migration run half-way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the comment.
but is that something that can happen, like having a migration run half-way?
I'm not sure actually, but I see the other existing tests and they include that kind of case.
newReportActionsDrafts[newOnyxKey] = { | ||
...(newReportActionsDrafts[newOnyxKey] || | ||
// Includes the existing migrated draft | ||
allReportActionsDrafts[newOnyxKey]), | ||
[reportActionID]: reportActionDraft, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now very hard to read, can we make it less fancy and more readable, maybe like this?
newReportActionsDrafts[newOnyxKey] = { | |
...(newReportActionsDrafts[newOnyxKey] || | |
// Includes the existing migrated draft | |
allReportActionsDrafts[newOnyxKey]), | |
[reportActionID]: reportActionDraft, | |
}; | |
// If newReportActionsDrafts[newOnyxKey] isn't set, fall back on the migrated draft if there is one | |
const currentActionDrafts = newReportActionsDrafts[newOnyxKey] || allReportActionsDrafts[newOnyxKey]; | |
newReportActionsDrafts[newOnyxKey] = { | |
...currentActionDrafts, | |
[reportActionID]: reportActionDraft, | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! I have updated the code.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/cead22 in version: 1.3.91-1 🚀
|
🚀 Deployed to production by https://github.com/marcaaron in version: 1.3.91-8 🚀
|
🚀 Deployed to staging by https://github.com/cead22 in version: 1.3.93-0 🚀
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.93-1 🚀
|
Details
When we delete a workspace, all workspace-related chat is archived, and not allowed to edit any message, but every message on edit is still present allowing to user to edit it but eventually, an error is thrown from the BE.
Fixed Issues
$ #26887
PROPOSAL: #26887 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Prerequisites: have a workspace
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2023-10-20.at.11.49.04.mov
Android: mWeb Chrome
Screen.Recording.2023-10-20.at.11.27.12.mov
iOS: Native
Screen.Recording.2023-10-20.at.11.33.22.mov
iOS: mWeb Safari
Screen.Recording.2023-10-20.at.11.28.20.mov
MacOS: Chrome / Safari
Screen.Recording.2023-10-20.at.11.10.25.mov
MacOS: Desktop
Screen.Recording.2023-10-20.at.11.13.00.mov