Skip to content
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

Tag creator can't delete own powertags -- needs test written #826

Closed
jywarren opened this issue Sep 19, 2016 · 1 comment
Closed

Tag creator can't delete own powertags -- needs test written #826

jywarren opened this issue Sep 19, 2016 · 1 comment
Labels
help wanted requires help by anyone willing to contribute Ruby testing issues are usually for adding unit tests, integration tests or any other tests for a feature

Comments

@jywarren
Copy link
Member

Katie made a tag activity:coqui on this page: https://publiclab.org/notes/donblair/01-14-2015/riffle-coqui-development-plan

but couldn't delete it herself. she's not a mod or admin. So I it looks like the permission check is OK:

https://github.com/publiclab/plots2/blob/master/app/controllers/tag_controller.rb#L148

if node_tag.uid == current_user.uid || current_user.role == "admin" || current_user.role == "moderator"

But we don't test this out, so we should add a test here: https://github.com/publiclab/plots2/blob/master/test/functional/tag_controller_test.rb

This could be a good starting draft:

test "should allow deletion if you created tag" do
  UserSession.create(rusers(:bob))
  node(:blog).add_tag('super', rusers(:bob))
  tag = DrupalNodeCommunityTag.last

  get :delete, tid: tag.tid, uid: tag.uid

  assert_redirected_to node(:blog).path
  # assert node not deleted! 
end
@jywarren jywarren added testing issues are usually for adding unit tests, integration tests or any other tests for a feature help wanted requires help by anyone willing to contribute Ruby labels Sep 19, 2016
@jywarren
Copy link
Member Author

I believe this is fixed in #917!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted requires help by anyone willing to contribute Ruby testing issues are usually for adding unit tests, integration tests or any other tests for a feature
Projects
None yet
Development

No branches or pull requests

1 participant