-
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
Created a locked tag which can be added to notes by mods / admin #9709
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -140,7 +140,7 @@ function promptTag(val) { | |
break; | ||
|
||
default: | ||
addTag(expr); | ||
addTag(val); | ||
break; | ||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -359,7 +359,7 @@ def delete | |
node_tag = NodeTag.where(nid: params[:nid], tid: params[:tid]).first | ||
node = Node.where(nid: params[:nid]).first | ||
# only admins, mods, and tag authors can delete other peoples' tags | ||
if node_tag.uid == current_user.uid || logged_in_as(['admin', 'moderator']) || node.uid == current_user.uid | ||
if node_tag.uid == current_user.uid || logged_in_as(['admin', 'moderator']) || (node.uid == current_user.uid && node_tag.name != "locked") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From line 359 above, we have the I am curious as to whether checking to see if Should checking if the tags returned contain There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh you're totally right, my bad! Yes, let's change this, we can use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Manasa2850 what do you say? Thanks all! |
||
|
||
tag = Tag.joins(:node_tag) | ||
.select('term_data.name') | ||
|
@@ -385,6 +385,9 @@ def delete | |
end | ||
end | ||
end | ||
elsif node_tag.name == "locked" | ||
flash[:error] = "Only admins can delete the locked tag." | ||
redirect_to Node.find_by(nid: params[:nid]).path | ||
else | ||
flash[:error] = I18n.t('tag_controller.must_own_tag_to_delete') | ||
redirect_to Node.find_by(nid: params[:nid]).path | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,10 @@ | |
</table> | ||
<% end %> | ||
|
||
<% if current_user && ( current_user.role == "admin" || current_user.role == "moderator") && !(@node.has_tag('locked')) %> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if, in follow up, we moved this button into the advanced tagging menu? This would then appear on wikis too! |
||
<a href="javascript:window.location.reload(true)" onClick="addTag('locked');">Lock Note</a> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this may be an issue in Firefox, but I could be wrong. I noted this in #9726 too! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jywarren I use Firefox and it works fine! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Manasa2850 I just tested the Screen.Recording.2021-06-10.at.17.35.10.movThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @RuthNjeri I'm not really sure why that's happening on the stable site. I tried it out on localhost both on Chrome as well as Firefox and the tag gets added on reload. There's no need to refresh the page. I'll take a deeper look at this to find out why that's happening on the stable site. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also think you need to be an admin to test this out on the stable site, I don't know how to make someone an admin on the stable site, but if you share your username with Jeff, he will be able to do that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My username on the stable site is Manasa2850. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I figured out how to make you an admin, you are now one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @RuthNjeri I tried it out on stable and this is what I observer
I will try to find out why this is happening just on Chrome. Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the update @Manasa2850 |
||
<% end %> | ||
|
||
<% if current_user && | ||
( current_user.role == "admin" || current_user.role == "moderator" || | ||
current_user.id == @node.id || current_user.is_coauthor?(@node) ) && | ||
|
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.
This change is not directly related to the 'locked' tag but is required in the
promptTag
function.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.
Ah, was it a bug from before? Cool. Thanks!