-
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
"/comments" page with 2 sub-sections and buttons for moderating #4740
Conversation
Generated by 🚫 Danger |
Currently, /comments show all the comments mixed up so I made 2 divisions at that page All comments and Moderated comments. The later division would be visible only when a user is moderator and admin. I have also added buttons there so that it would be convenient to moderator to moderate comments. Also, we used to redirect to dashboard on marking a comment as spam/approve but I have removed that and added now page will reload so moderators don't have to open the page again and again. @jywarren @SidharthBansal please review. Thanks! |
@@ -12,7 +12,7 @@ | |||
<% end %> | |||
</tr> | |||
|
|||
<% @comments.each do |comment| %> | |||
<% comments.each do |comment| %> |
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.
@jywarren I adjusted user_controller.rb - https://github.com/publiclab/plots2/pull/4740/files#diff-4e05ad0d64e6100656b63ad1e78f32c5R287 to update with this change so working everything fine. Do you remember, if we use this partial _comments anywhere else except profile page and /comments? Let me know, and I will make the change accordingly. Thanks!
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 don't believe we use it anywhere else! So then this should be ready to merge? 👍
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.
yes, the work is complete according to me. you can merge it, if you find all changes good in review. Also, should I test on unstable
once? Thanks!
@@ -151,7 +151,7 @@ def mark_comment_spam | |||
else | |||
flash[:error] = 'Only moderators can moderate comments.' | |||
end | |||
redirect_to '/dashboard' + '?_=' + Time.now.to_i.to_s | |||
redirect_back(fallback_location: root_path) |
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.
Will this bust the cache the way the timestamp code does?
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.
It will redirect to the page from where the request is generated so - If I approve a comment from a research note, then the page will just reload(redirecting to requesting page which is note only). As the behaviour is reload so we don't need to bust cache explicitly (I don't faced cache issue while testing). In case, redirect_back wasn't able to redirect to the page from where request is generated then it will redirect to the root_path which is dashboard
Just one clarification, but otherwise this is great! Feel free to merge it after addressing it. Thanks!!!!! |
great, sounds good!
…On Tue, Feb 5, 2019 at 5:54 PM Gaurav Sachdeva ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app/controllers/admin_controller.rb
<#4740 (comment)>:
> @@ -151,7 +151,7 @@ def mark_comment_spam
else
flash[:error] = 'Only moderators can moderate comments.'
end
- redirect_to '/dashboard' + '?_=' + Time.now.to_i.to_s
+ redirect_back(fallback_location: root_path)
It will redirect to the page from where the request is generated so - If I
approve a comment from a research note, then the page will just
reload(redirecting to requesting page which is note only). As the behaviour
is reload so we don't need to bust cache explicitly (I don't faced cache
issue while testing). In case, redirect_back wasn't able to redirect to the
page from where request is generated then it will redirect to the root_path
which is dashboard
Fallback demo:
[image: fallback_location]
<https://user-images.githubusercontent.com/20878070/52309680-e98b6180-29c6-11e9-979d-7226cee5d55c.gif>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4740 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABfJ0VC-FStYsfyE1-UhyK1_Pj8or4vks5vKguIgaJpZM4adLY2>
.
|
Hi @jywarren, merged this one 🎉. Thanks! |
…iclab#4740) * sections in /comments page * fixing tests * tests added
Fixes #4616
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
rake test
@publiclab/reviewers
for help, in a comment belowIf tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Thanks!