Fix - Attachment - When opening the last one, the first added Public Image is opened#55901
Conversation
|
@abdulrahuman5196 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] |
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-03-05.at.16.06.19.movAndroid: mWeb ChromeScreen.Recording.2025-03-05.at.16.01.05.moviOS: NativeScreen.Recording.2025-03-05.at.15.47.37.moviOS: mWeb SafariScreen.Recording.2025-03-05.at.15.53.30.movMacOS: Chrome / SafariScreen.Recording.2025-03-05.at.15.43.40.movMacOS: DesktopScreen.Recording.2025-03-05.at.15.46.44-compressed.mov |
|
@roryabraham Please assign this PR to me as well. |
|
@FitseTLT Please pull |
|
@FitseTLT
Screen.Recording.2025-03-05.at.15.59.25.mov |
|
@FitseTLT
Screen.Recording.2025-03-05.at.16.00.46.mov |
|
Wow, What a catch! 👏 Appreciate it BTW @dominictb I will ping as soon as I reach a fix Thx |
|
Problem fixed 👍 @dominictb |
|
Can you summarize the root cause and your solution? @FitseTLT |
@dominictb my previous approach was based on identifying an attachment with its report action id but u came up with a tricky test case where multiple attachments can exist in a report action so now I have implemented an attachment-id approach which is the report action id concatenated with its attachment index inside the report action. Moreover, I initially didn't consider video attachments but I have included it now because videos can still exist in a markdown format (for e.g. if you comment a text and add a video attachment) |
|
So far I cannot find any other issues but as this is a substantial amount of changes, I need more time to proof test this. Screen.Recording.2025-03-21.at.02.46.34.mov |
|
Appreciate that Thx take ur time 👍 |
| const hasBeenFlagged = decision === CONST.MODERATION.MODERATOR_DECISION_PENDING_HIDE || decision === CONST.MODERATION.MODERATOR_DECISION_HIDDEN; | ||
| const html = getReportActionHtml(action).replace('/>', `data-flagged="${hasBeenFlagged}" data-id="${action.reportActionID}"/>`); | ||
| htmlParser.write(html); | ||
| const html = getReportActionHtml(action).replaceAll('/>', `data-flagged="${hasBeenFlagged}" data-id="${action.reportActionID}"/>`); |
There was a problem hiding this comment.
Why do we replaceAll here?
There was a problem hiding this comment.
WE need to add hasBeenFlagged and data-id for the case where we will have multiple attachments inside a report action.
src/components/Attachments/types.ts
Outdated
| /** Report action ID of the attachment */ | ||
| reportActionID?: string; | ||
|
|
||
| /** The attachment id, which is the id of the report action it is in appended with its attachment index. */ |
There was a problem hiding this comment.
| /** The attachment id, which is the id of the report action it is in appended with its attachment index. */ | |
| /** The attachment id, which is the concatenation of the report action id it is in and its order within that report action, starting from 1. */ |
I wonder if "order" here makes sense?
There was a problem hiding this comment.
order makes sense but starting form 1 is too much detail WDYT
src/components/Attachments/AttachmentCarousel/extractAttachments.ts
Outdated
Show resolved
Hide resolved
|
@FitseTLT Also update the |
Done |
|
@FitseTLT Also please update the |
Updated |
|
✋ 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/roryabraham in version: 9.1.22-0 🚀
|
|
🚀 Deployed to production by https://github.com/grgia in version: 9.1.22-10 🚀
|
Details
This PR will allow the identification of identical attachments (attachments with the same source url) in report actions. So we add attachment-id to all attachments inside report action message which is the report action id concatenated with the specific order index the attachment appears in the report action then we use this attachment id to correctly navigate between attachments in attachment carousel.
Fixed Issues
$ #53690
PROPOSAL: #53690 (comment)
Tests
Test 2:
Offline tests
Same as above
QA Steps
Same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
a.IM.mp4
Android: mWeb Chrome
aw.imd.mp4
iOS: Native
i.MD.mp4
iOS: mWeb Safari
iw.IMD.mp4
MacOS: Chrome / Safari
w.IMD.mp4
MacOS: Desktop
d.IMD.mp4