Plots2: Basic/Normal User not able to delete own wiki page

Created on 16 Jan 2018  Â·  6Comments  Â·  Source: publiclab/plots2

Hi, this is a first-timers-only issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.

If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!

If you have contributed before, consider leaving this one for someone new, and looking through our general help wanted issues. Thanks!

The Problem

When normal/basic user deletes the wiki page created by him/her , the login screen is shown .

Solution

The delete button on wiki page links to /notes/delete/ .
https://github.com/publiclab/plots2/blob/ac0f56fff35d9a62d7bcc1d0726260b8d7187a31/app/views/like/_like.html.erb#L52
However the if condition in notes#delete method is incorrect here .
We need to change if condition in line :
https://github.com/publiclab/plots2/blob/ac0f56fff35d9a62d7bcc1d0726260b8d7187a31/app/controllers/notes_controller.rb#L237

to :
if current_user && (current_user.uid == @node.uid || current_user.role == "moderator" || current_user.role == "admin")

Feel free to ask any doubt regarding the issue ! Thank you !

Steps to Fix

  • [ ] claim this issue with a comment here, below, and ask any clarifying questions you need
  • [ ] set up a repository locally following the README instructions, and make sure that all tests pass

    • [ ] try to fix the issue following the steps above, but even before you're done, you can:

      commit your changes and start a pull request (see contributing to Public Lab software) but mark it as "in progress" if you have questions or if you haven't finished

  • [ ] alert someone via the developers list (see below) to have your pull request merged. This may take a few extra steps depending on when you do it, but we'll help you out!

Please email the developers list (see https://publiclab.org/wiki/developers) or go to the chatroom if you have questions, and take a look at our first-timers landing page for more information!

HTML Ruby enhancement first-timers-only help wanted

Most helpful comment

Yes @jywarren , i would love to help ! Thanks 😄 .

All 6 comments

Can i take this issue??

On Jan 16, 2018 3:55 PM, "Sagarpreet Chadha" notifications@github.com
wrote:

Hi, this is a first-timers-only
https://github.com/publiclab/plots2/projects/2 issue. This means we've
worked to make it more legible to folks who either haven't contributed
to our codebase before, or even folks who haven't contributed to open
source before
.

If that's you, we're interested in helping you take the first step and can
answer questions and help you out as you do. Note that we're especially
interested in contributions from people from groups underrepresented in
free and open source software!

If you have contributed before, consider leaving this one for someone new,
and looking through our general help wanted
https://github.com/publiclab/plots2/labels/help-wanted issues. Thanks!
The Problem

When normal/basic user deletes the wiki page created by him/her , the
login screen is shown .
Solution

The delete button on wiki page links to /notes/delete/ .
https://github.com/publiclab/plots2/blob/ac0f56fff35d9a62d7bcc1d0726260
b8d7187a31/app/views/like/_like.html.erb#L52
However the if condition in notes#delete method is incorrect here .
We need to change if condition in line :
https://github.com/publiclab/plots2/blob/ac0f56fff35d9a62d7bcc1d0726260
b8d7187a31/app/controllers/notes_controller.rb#L237

to :
if current_user && (current_user.uid == @node.uid || current_user.role ==
"moderator" || current_user.role == "admin")
Feel free to ask any doubt regarding the issue ! Thank you ! Steps to Fix

  • claim this issue with a comment here, below, and ask any clarifying
    questions you need
  • set up a repository locally following the README instructions, and
    make sure that all tests pass
  • try to fix the issue following the steps above, but even before
    you're done, you can:
    commit your changes and start a pull request (see contributing to
    Public Lab software) but mark it as "in progress" if you have questions or
    if you haven't finished
  • alert someone via the developers list (see below) to have your pull
    request merged. This may take a few extra steps depending on when you do
    it, but we'll help you out!

Please email the developers list (see https://publiclab.org/wiki/
developers) or go to the chatroom http://publiclab.org/chat if you have
questions, and take a look at our first-timers landing page for more
information! https://github.com/publiclab/plots2/projects/2

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/publiclab/plots2/issues/2013, or mute the thread
https://github.com/notifications/unsubscribe-auth/AcUuMka3zZSGUGdYQ0qj18vvApRGLDXlks5tLHkLgaJpZM4RfjDk
.

Hi, I'd like to request one more condition -- if any other authors have contributed to a wiki page, we will need to disable the ability to delete your own page, because you might delete someone else's contributions.

So we'll need a check to be sure @node.authors.uniq.length == 1 -- that is, that there is only a single author who's contributed so far.

Can we add this condition to the controller and if it's not met, return a message that You cannot delete a wiki page once someone else has begun to contribute to it.?

Thank you!!!

https://github.com/publiclab/plots2/blob/3df85679c34489ab4bd9a1bf4b0c0deda1ae8654/app/models/node.rb#L216-L218

And yes, @ankitbhardwaj78 if this extra condition seems feasible for you, we'd love to! @sagarpreet-chadha would you be able to help @ankitbhardwaj78 with this extra condition? Thanks!

Yes @jywarren , i would love to help ! Thanks 😄 .

I will do this.. @jywarren

@jywarren and @sagarpreet-chadha please take a review i have made changes #2030

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jywarren picture jywarren  Â·  3Comments

bronwen9 picture bronwen9  Â·  3Comments

noi5e picture noi5e  Â·  3Comments

milaaraujo picture milaaraujo  Â·  3Comments

first-timers[bot] picture first-timers[bot]  Â·  3Comments