Skip to content

Conversation

LianaHarris360
Copy link
Member

Summary

Description of the change(s) you made

This pull request fixes the incorrect folder and resource count displayed when opening the moveModal from the Clipboard component. This pull request also fixes a selection issue in the Clipboard.

Manual verification steps performed

  1. Select folder/resource in the clipboard
  2. Click on the Move button
  3. Observe the title with the correct count when the moveModal opens

Screenshots (if applicable)

Before:
incorrectResourceTopicCount

After:

MovemodalResourceFolderCount.mov

References

Fixes #3744

Comments


Contributor's Checklist

PR process:

  • If this is an important user-facing change, PR or related issue the CHANGELOG label been added to this PR. Note: items with this label will be added to the CHANGELOG at a later time
  • If this includes an internal dependency change, a link to the diff is provided
  • The docs label has been added if this introduces a change that needs to be updated in the user docs?
  • If any Python requirements have changed, the updated requirements.txt files also included in this PR
  • Opportunities for using Google Analytics here are noted
  • Migrations are safe for a large db

Studio-specifc:

  • All user-facing strings are translated properly
  • The notranslate class been added to elements that shouldn't be translated by Google Chrome's automatic translation feature (e.g. icons, user-generated text)
  • All UI components are LTR and RTL compliant
  • Views are organized into pages, components, and layouts directories as described in the docs
  • Users' storage used is recalculated properly on any changes to main tree files
  • If there new ways this uses user data that needs to be factored into our Privacy Policy, it has been noted.

Testing:

  • Code is clean and well-commented
  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Any new interactions have been added to the QA Sheet
  • Critical and brittle code paths are covered by unit tests

Reviewer's Checklist

This section is for reviewers to fill out.

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

nucleogenesis and others added 2 commits July 24, 2024 15:09
- Stops propagation in Checkbox#handleChange w/ second `$event`
paramter, putting `.stop` and/or `.prevent` on the `@input` event
complained and failed
- Fixes checkboxes just not working in the Clipboard
…selectedNodeIds to the correct content node id
@LianaHarris360 LianaHarris360 added the P1 - important Priority: High impact on UX label Aug 9, 2024
@LianaHarris360 LianaHarris360 added this to the Studio: Q2-24 Release milestone Aug 9, 2024
Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

Changes make senses to me. Also, manual QA checks out. Thanks @LianaHarris360!

Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

While the move modal title is correct, this seems to break the move behavior. As you can see in your video, when you select one of the items for moving, and open the modal, the move button is disabled. Testing it myself, I can't seem to get it enabled.

I believe this is because the actual source content node ID is being passed to the move modal. The clipboard holds copies that are 'virtual' in that they don't hold the data of the source node, rather the frontend loads the data from the source for display in the clipboard. While not robustly clear, you can see this in the computed prop, that it loads the content node for "render"-- meaning it should not be used for move/copy/delete operations.

contentNode() {
return this.nodeId ? this.getContentNodeForRender(this.nodeId) : null;
},

Lastly, I'm noticing some regressions with the indeterminate selection of folders as well.

@LianaHarris360
Copy link
Member Author

The move button is disabled until I select a new location for the resource. It appears that the moveModal opens in the current location of the resource, disabling the button since there's no destination. In the bottom video, creating a new folder allows the button to be selected.

Because the moveModal uses getTopicAndResourceCounts() for the header count, we needed to pass the source content node ID from the clipboard to the moveModal.

We were going to create a function to search the contentNodesMap using the node and clipboardNodesMap and noticed that getContentNodeForRender already does this.

MovingResources.mov

@bjester
Copy link
Member

bjester commented Aug 12, 2024

The move button is disabled until I select a new location for the resource. It appears that the moveModal opens in the current location of the resource, disabling the button since there's no destination. In the bottom video, creating a new folder allows the button to be selected.

@LianaHarris360 right, it opens in the current location of the resource which shouldn't exist in the channel because the node is on the clipboard, so this means the wrong ID is being passed and the button should not be disabled. You can compare this behavior with production and see that it's a regression.

@nucleogenesis
Copy link
Member

I believe this is because the actual source content node ID is being passed to the move modal. The clipboard holds copies that are 'virtual' in that they don't hold the data of the source node, rather the frontend loads the data from the source for display in the clipboard

The MoveModal doesn't do anything to disambiguate between clipboard IDs and source node IDs. which is why we ended up at the point of just doing that mapping in the parent component.

Looking at it again, perhaps since there is a movingFromTrash prop we could use a movingFromClipboard prop to tell MoveModal that it's moveNodeIds are coming from the clipboard?

@bjester
Copy link
Member

bjester commented Aug 12, 2024

@nucleogenesis Right the move modal does not need to disambiguate between the two because the move modal is not responsible for handling the move operations. The move modal really only determines the target location for the operation.

Here's a visual to explain where this goes wrong. I have two channels: 'Test' and 'B'. The 'Test' channel has a folder 'F' that has 3 PDFs. I copied the 'F' folder to the clipboard, and deleted one of the nodes from it on the clipboard-- now it shows 2 on the clipboard (note the clipboard also incorrectly counts this but it seems production is doing this correctly so it must be a regression). I then select the 'F' folder from the clipboard and click move. The move modal says it's moving 1 folder and 5 resources. Although, that should be 1 folder and 2 resources. The way clipboard tracks the deletion will not be correctly counted for with the logic the move modal uses. Furthermore, the move modal location is incorrect-- as you can see it's showing the 'F' folder which is in channel 'Test' but the move modal should show channel 'B' instead.

Screencast.from.08-12-2024.01.54.48.PM.mp4

@LianaHarris360
Copy link
Member Author

The MoveModal now has a new property clipboardTopicResourceCount that contains the correct resource and topic count using the clipboardNodesMap. It is used when moving contentNodes from the Clipboard.

I also fixed the icon that displays the resource count in the clipboard, to make sure that if an item within a folder is deleted within the clipboard, the count is updated accordingly.

clipboard.mov

@LianaHarris360 LianaHarris360 requested a review from bjester August 20, 2024 17:09
@nucleogenesis nucleogenesis self-requested a review August 20, 2024 17:39
Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

Nice work!

@LianaHarris360 LianaHarris360 merged commit 7f689c3 into learningequality:unstable Aug 23, 2024
@akolson akolson mentioned this pull request Aug 24, 2024
@akolson akolson mentioned this pull request Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 - important Priority: High impact on UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect folders/resources count when moving from the clipboard
4 participants