500 error when attempting to approve moderated comments on a work you are not a creator of

Description

While extending the comments controller test coverage in (pull request https://github.com/otwcode/otwarchive/pull/2734), we found the following issue.

There is a pending test for it in spec/controllers/comments_controller_spec.rb.

Steps to reproduce

  1. Log in as testy, who has archivist privileges and can thus add anyone as a co-creator

  2. Post a work with a co-creator, and turn on comment moderation for the work

  3. Log out as testy and leave a few comments on the work

  4. Log back in as testy and return to the work

  5. Follow the “Unreviewed Comments” link on top of the work, but don’t do anything yet

  6. Now, still logged in as testy, open another another tab or browser window and go to the work

  7. Follow the “Edit” link on the work and choose the “Remove Me as Co-Creator” option

  8. Now that you are no longer a creator of the work, switch back to the tab/window where you opened the Unreviewed Comments page

  9. Press “Approve All Unreviewed comments”

What happens

A 500 error.

What should happen

You should be redirected to the homepage or the page you were previously on with a red flash message saying, "What did you want to review comments on?"

Activity

Show:
C. Ryan Smith
February 10, 2020, 6:57 AM

Followed steps to reproduce. No 500 error happened! Yay! \o/ However…

I was redirected to my Dashboard page instead of the Archive homepage. Wasn’t sure if this was intended behavior, so reporting it just in case. See attached screenshot.

 

Sarken
February 10, 2020, 7:11 AM

Thanks for pointing that out! It is indeed expected behavior: the redirect should take you to either the page you were previously on or the homepage, if it can’t figure out where you were before. I’ll update the issue to reflect that.

 

lydia-theda
February 10, 2020, 7:17 AM

Followed listed instructions. The red (well, blue since testy uses Reversi) “What did you want to review comments on?” message is shown, though I was directed back to the page of the work/the Proceed page, not the homepage. Going back a page does bring one back to the Unreviewed Comments page but any action from there kicks you back out (back 2 pages: what did you want to review comments on message, refresh: you do not have permission message, approve single comment: 404 page).

Also tested removing a co-creator who was not testy, same results.

DeployedToBeta

Assignee

james_

Reporter

james_

Roadmap

Comments

Priority

Medium

Affects versions

Fix versions

Components

BackEnd

Difficulty

Medium

Milestone

Internal 0.9
Configure