Skip to content

Authorizable comment action for proposals#6916

Merged
mrcasals merged 22 commits intodecidim:developfrom
Platoniq:feature/authorizable-comment-action
Apr 28, 2021
Merged

Authorizable comment action for proposals#6916
mrcasals merged 22 commits intodecidim:developfrom
Platoniq:feature/authorizable-comment-action

Conversation

@verarojman
Copy link
Copy Markdown
Contributor

@verarojman verarojman commented Nov 23, 2020

🎩 What? Why?

By default, all registered users can create comments in a proposal (if comments are enabled). With this feature, admins will have the possibility to choose the verification method required for users to create comments in proposals.

This PR introduces the comment and vote_comment authorizable actions for proposals

Note: Only works for comments linked to components, not participatory spaces (meaning that this do not apply to questions in consultations as a question is treated as a participatory space). This is because the whole system of dealing with permissions in modals and other checks require a component (current_component) available. This should be refactored in another PR. See note in

# actions are linked to objects belonging to a component
# In consultations, a question belong to a participatory_space but it has comments
# To apply :comment permission, the modal authorizer should be refactored to allow participatory spaces-level comments

📌 Related Issues

Testing

  • In the admin, visit any participatory space that has a proposals component.
  • Go to the proposals list
  • Click on the 🔑 icon to set permissions for one of those proposals
  • Choose a verification method for the "Comment" action
  • Choose a verification method for the "Vote Comment" action
  • Visit the public page for the proposal
  • Try to comment
  • Try to vote an existing comment

How-to-test

📋 Checklist

  • Manage permissions in admin for vote and vote_comment actions for a Proposal.
  • Restrict commenting a Proposal if user not authorized
  • Restrict voting a comment in a Proposal if user not authorized
  • Add permissions to proposals globally
  • Add permissions to proposals per-resource (individual)
  • Show a button with the verification page i user is not?
  • Give feedback to the user when trying to vote a comment and it is not allowed
  • Tests cases with different verification statuses (at component level or resource level):
  • I can comment but not vote
  • I can vote but not comment
  • I can comment and vote
  • I cannot comment nor vote
  • Add test cases for the controller comment and vote_comment permission class
  • Add screenshots

📷 Screenshots

Authorize_Vote_Comments

Cannot comment message

@verarojman verarojman changed the title Authorizable comment actions Authorizable comment action for proposals Nov 24, 2020
@verarojman verarojman changed the title Authorizable comment action for proposals [Feature] Authorizable comment action for proposals Dec 1, 2020
@andreslucena andreslucena changed the title [Feature] Authorizable comment action for proposals Authorizable comment action for proposals Dec 4, 2020
@mrcasals
Copy link
Copy Markdown
Contributor

@microstudi @verarojman I now it's not ready for review, but just a heads-up: tests seem to be failing!

@verarojman
Copy link
Copy Markdown
Contributor Author

Thanks @mrcasals, we've frozen this PR until we finish other tasks with higher priorities ;) As soon as we can we'll make the necessary changes and make sure tests pass.

@mrcasals
Copy link
Copy Markdown
Contributor

@verarojman oh, ok! Thanks for the explanation! 😄

@decidim decidim deleted a comment from qlty-cloud-legacy bot Apr 19, 2021
@verarojman verarojman marked this pull request as ready for review April 28, 2021 08:56
@verarojman
Copy link
Copy Markdown
Contributor Author

Hi @mrcasals, this is finally ready for review thanks to @aitorlb ❤️

@verarojman verarojman closed this Apr 28, 2021
@verarojman verarojman reopened this Apr 28, 2021
@mrcasals mrcasals merged commit 85bce72 into decidim:develop Apr 28, 2021
entantoencuanto added a commit that referenced this pull request Apr 30, 2021
* develop:
  Remove creation date from meeting card (#7922)
  Use NPM instead of yarn on CI (#7919)
  Validate nickname using correct regexp (#7900)
  Make webpacker build available in production (#7915)
  New Crowdin updates (#7911)
  Open attachments in new tab (#7912)
  Fix JS errors in the admin panel (#7903)
  Fix editor: remove br tags from inside a tags (#7901)
  Authorizable comment action for proposals (#6916)
  NoMethodError raised when voting comments from threads (#7880)
  Fix not signed in needs permission redirect for internal links (#7890)
  Fix meeting registrations questionnaire free text choice answers export (#7892)
  Store election verifiable results data in election (#7882)
  New Crowdin updates (#7884)
microstudi added a commit to Platoniq/decidim that referenced this pull request May 3, 2021
Co-authored-by: Ivan Vergés <ivan@platoniq.net>
Co-authored-by: Aitor Lopez Beltran <aitorlopezbeltran@gmail.com>
@microstudi microstudi mentioned this pull request Jul 21, 2021
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants