Skip to content

Fix star/bookmarking feature in Content Library#3070

Merged
rtibbles merged 5 commits intolearningequality:hotfixesfrom
sairina:starred
Apr 12, 2021
Merged

Fix star/bookmarking feature in Content Library#3070
rtibbles merged 5 commits intolearningequality:hotfixesfrom
sairina:starred

Conversation

@sairina
Copy link
Contributor

@sairina sairina commented Apr 6, 2021

Summary

Description of the change(s) you made

  • Added ChannelListPagination class for ChannelViewSet
  • Added tests in tests_channel.py to test bookmarking feature
  • Added update_from_changes method to ChannelViewSet class to override the one in UpdateModelMixin so that any user can bookmark any channel (the initial problem was that update_from_changes in UpdateModelMixin only worked with channels that a user could edit, not ones they could only view)

Manual verification steps performed

  1. Log in as a non-admin user w/view-only access to a Published Channel
  2. Click on the "Content Library" tab
  3. Bookmark the "Published Channel" by clicking on the star icon on its card
  4. After a few seconds, click on the "Starred" filter checkbox on the left-hand side under "Formats" to filter all bookmarked channels
  5. Check to see that there is 1 matching result
  6. Unstar "Published Channel" by clicking on the star icon on the card
  7. Uncheck the "Starred" filter. Wait a few seconds
  8. Click on the "Starred" filter again
  9. Check to see that there are "0 results found"

Note: There is a known bug (also see below) where quick clicking on the star icon and on the "Starred" filter will yield incorrect results, and the user will have to refresh the page in order for the accurate results to occur. If this occurs, please refresh the page to see that the correct results do show up after the refresh.

Screenshots (if applicable)

2021-04-09 22 12 52

Does this introduce any tech-debt items?

We will need to revisit pagination for channels.


Reviewer guidance

How can a reviewer test these changes?

Please manually test, and note that there is an edge case where if a user bookmarks and clicks on the "Starred" filter very quickly, it will not work (they will have to refresh the page).

Fixes #2933


Contributor's Checklist

Studio-specifc:

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

@codecov
Copy link

codecov bot commented Apr 6, 2021

Codecov Report

Merging #3070 (dd077ae) into hotfixes (28587f8) will increase coverage by 5.17%.
The diff coverage is 93.05%.

Impacted file tree graph

@@             Coverage Diff              @@
##           hotfixes    #3070      +/-   ##
============================================
+ Coverage     80.80%   85.97%   +5.17%     
============================================
  Files           281      304      +23     
  Lines         12659    16467    +3808     
============================================
+ Hits          10229    14158    +3929     
+ Misses         2430     2309     -121     
Impacted Files Coverage Δ
contentcuration/contentcuration/decorators.py 56.60% <50.00%> (-37.60%) ⬇️
...ntentcuration/contentcuration/db/models/manager.py 91.05% <90.83%> (-8.95%) ⬇️
contentcuration/contentcuration/db/models/query.py 94.23% <93.75%> (-5.77%) ⬇️
contentcuration/contentcuration/forms.py 82.35% <94.04%> (+33.89%) ⬆️
contentcuration/contentcuration/api.py 92.06% <100.00%> (+1.43%) ⬆️
contentcuration/contentcuration/apps.py 100.00% <100.00%> (+11.11%) ⬆️
contentcuration/contentcuration/celery.py 90.00% <100.00%> (-1.67%) ⬇️
...tentcuration/contentcuration/context_processors.py 100.00% <100.00%> (ø)
...ontentcuration/contentcuration/db/advisory_lock.py 100.00% <100.00%> (ø)
...tcuration/contentcuration/db/models/expressions.py 95.23% <100.00%> (-4.77%) ⬇️
... and 190 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 016aa65...dd077ae. Read the comment docs.

@sairina sairina changed the title WIP: Starred Fix star/bookmarking feature in Content Library Apr 10, 2021
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Code looks clean, and tests are spot on!

I need to manually test still. Also, would be good to clean up the commit history slightly!

@sairina sairina marked this pull request as ready for review April 12, 2021 18:59
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

Code looks good. Good test coverage. Manual testing showed no issues!

@rtibbles rtibbles merged commit 7ddca73 into learningequality:hotfixes Apr 12, 2021
@bjester bjester added this to the Sprint 2021-04-12 milestone Apr 12, 2021
@pcenov
Copy link
Member

pcenov commented Apr 13, 2021

Hi @sairina as and end user I was expecting that if the Starred filter is applied and I click the star icon to remove a starred channel, the unstarred channel will immediately disappear from the list. Currently this is not the case and it remains visible:

2021-04-13_10-23-33

This is also not consistent with unstarring a channel from the Starred tab where the channel disappears immediately after having been unstarred so the question is can this be applied here as well?

@sairina
Copy link
Contributor Author

sairina commented Apr 14, 2021

Hi @pcenov, thank you for catching this! I didn't realize that was the expected behavior. Can you file an issue for this specific thing as a follow-up so that we can work on fixing that?

@radinamatic
Copy link
Member

I can't recall if that was specified as the expected in original designs (cc @jtamiace & @khangmach to chime in), but ➕ for what @pcenov is suggesting: to me it also seems that more consistent user-facing behavior would be for a channel to disappear from the view when unstarred, in both the Content library (with the Starred filter on), and the Starred tabs.

@rtibbles
Copy link
Member

I imagine it was previously unspecified - but definitely good for it to be consistent.

@khangmach
Copy link
Contributor

This wasn't intentionally specified in the mocks but what ya'll are saying makes sense so I'm on board with running with this.

So when the user is..

  1. under the content library tab
  2. has the starred filter applied
  3. sees channels appear

If they they un-star that starred channel

  1. the channel should disappear from that view
  2. the channel should disappear from the starred view
  3. the snackbar should appear per usual

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content Library - filtering by Starred is not working even if there are Starred channels

6 participants