-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Test to ensure admins can edit/update locked pages , closes #397 #1163
Conversation
I made the changes in the link but cannot understand what test to add in wiki_controller_test.rb to ensure admin isn't redirected. Would like your help with this one! @jywarren |
@@ -43,7 +43,7 @@ | |||
<ul class="nav nav-tabs"> | |||
<li class="active"><a href="#"><span class="hidden-xs"><%= t('wiki.show.view') %></span><span class="visible-xs"><i class="fa fa-file-o"></i></span></a></li> | |||
<% if @node.has_tag('locked') %> | |||
<li><a href="/wiki/locked"><i class="fa fa-lock"></i></a></li> | |||
<li><a href="/wiki/edit/pagetitle"><i class="fa fa-lock"></i></a></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry -- pagetitle
will actually have to be <%= @node.edit_path %>?t=<%= Time.now.to_i %>
-- i was typing too fast and wasn't clear enough. Make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we should add a conditional -- <% if current_user && (current_user.role == "moderator" || current_user.role == "admin") %>
with the "real" link, but if not, go to /wiki/locked
-- make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a check. It serves the same purpose. Is it ok?
@jywarren I added the check. It redirects if page is locked and user isn't an admin. |
<ul class="nav nav-tabs"> | ||
<li class="active"><a href="#"><span class="hidden-xs"><%= t('wiki.show.view') %></span><span class="visible-xs"><i class="fa fa-file-o"></i></span></a></li> | ||
<% if @node.has_tag('locked') %> | ||
<li><a href="/wiki/locked"><i class="fa fa-lock"></i></a></li> | ||
<% if @node.has_tag('locked') && current_user && (current_user.role != "moderator" && current_user.role != "admin")%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, actually this doesn't account for if there is no logged-in user... they'd see no lock symbol. So we need to add something like:
<% if @node.has_tag('locked') && (current_user ? (current_user.role != "moderator" && current_user.role != "admin") : true) %>
This uses the ternary operator, and I think it's correct, but if you can think of a simpler way to write it, I'm open to suggestions!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this is a better method. Thanks!
@jywarren Made the required changes. Please have a look! |
Oh, looks good but could you correct the indentation? Thanks, that should be it! |
@jywarren Done! |
Great work! |
@jywarren Thanks! Any other issue you feel I can work with? |
Sure -- perhaps you could tackle some from the Geographic features? Just be sure to coordinate with Mridul, who's also tackling those. This one is complex, but there is example code: Placename autocompletion (break me up) like MapKnitter new map form, as done in this interface, which you can view at https://publiclab.org/profile/info/your_username and it wouldn't overlap with Mridul's work, I think! |
@jywarren If he's already working with those, perhaps I should work with some other issue? |
Sure -- well, would you like to work on something more infrastructural and
database-oriented, or something more interface oriented?
…On Thu, Jan 5, 2017 at 3:48 PM, Swapnil Gupta ***@***.***> wrote:
@jywarren <https://github.com/jywarren> If he's already working with
those, perhaps I should work with some other issue?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1163 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ476E8-uL9YaUKsywlKBv_wnOwxJks5rPVcUgaJpZM4LaF89>
.
|
@jywarren I will co-ordinate with Mridul and work on Geographic features. |
OK, super!
…On Fri, Jan 6, 2017 at 11:16 AM, Swapnil Gupta ***@***.***> wrote:
@jywarren <https://github.com/jywarren> I will co-ordinate with Mridul
and work on Geographic features.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1163 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ7z3dQd5yKiwvun_4WCK4ZfyIoJ7ks5rPmjUgaJpZM4LaF89>
.
|
@jywarren But are there any interface oriented issues for now? Until I learn to work on geographic features. I can work on interface or database oriented issues. Thanks a lot!! |
Yes, there is this one:
#904
It may involve integration of the rich editor, at
https://github.com/publiclab/PublicLab.Editor/
similarly to how it was done here:
https://github.com/publiclab/plots2/tree/master/app/views/editor/rich.html.erb
…On Fri, Jan 6, 2017 at 2:18 PM, Swapnil Gupta ***@***.***> wrote:
@jywarren <https://github.com/jywarren> But are there any interface
oriented issues for now? Until I learn to work on geographic features. I
can work on interface or database oriented issues. Thanks a lot!!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1163 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ9xIGuaRsSbEsYmzOgqekrZCkDN1ks5rPpNugaJpZM4LaF89>
.
|
@jywarren Thanks! |
Make sure these boxes are checked before your pull request is ready to be reviewed and merged. Thanks!
rake test:all
schema.rb.example
has been updated if any database migrations were addedPlease be sure you've reviewed our contribution guidelines at https://publiclab.org/wiki/contributing-to-public-lab-software
We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays. Please alert developers on plots-dev@googlegroups.com when your request is ready or if you need assistance.
Thanks!