Skip to content
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

Merged
merged 3 commits into from
Feb 10, 2019

Conversation

grvsachdeva
Copy link
Member

@grvsachdeva grvsachdeva commented Jan 31, 2019

Fixes #4616

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts 📁
  • PR is descriptively titled 📑
  • screenshots/GIFs are attached 📎 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If 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!

@grvsachdeva grvsachdeva changed the title sections in /comments page "/comments" page with 2 sub-sections and buttons for moderating Jan 31, 2019
@plotsbot
Copy link
Collaborator

plotsbot commented Jan 31, 2019

2 Messages
📖 @gauravano Thank you for your pull request! I’m here to help with some tips and recommendations. Please take a look at the list provided and help us review and accept your contribution! And don’t be discouraged if you see errors – we’re here to help.
📖 It looks like you haven’t marked all the checkboxes. Help us review and accept your suggested changes by going through the steps one by one. If it is still a ‘Work in progress’, please include ‘[WIP]’ in the title.

Generated by 🚫 Danger

@grvsachdeva
Copy link
Member Author

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.

comment_div1

Moderator options view:
ezgif com-optimize 3

@jywarren @SidharthBansal please review. Thanks!

@@ -12,7 +12,7 @@
<% end %>
</tr>

<% @comments.each do |comment| %>
<% comments.each do |comment| %>
Copy link
Member Author

@grvsachdeva grvsachdeva Feb 5, 2019

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!

Copy link
Member

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? 👍

Copy link
Member Author

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)
Copy link
Member

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?

Copy link
Member Author

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

Fallback demo:
fallback_location

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019

Just one clarification, but otherwise this is great! Feel free to merge it after addressing it. Thanks!!!!!

@jywarren
Copy link
Member

jywarren commented Feb 5, 2019 via email

@grvsachdeva grvsachdeva merged commit 5379e97 into publiclab:master Feb 10, 2019
@grvsachdeva
Copy link
Member Author

Hi @jywarren, merged this one 🎉. Thanks!

SrinandanPai pushed a commit to SrinandanPai/plots2 that referenced this pull request May 5, 2019
…iclab#4740)

* sections in /comments page

* fixing tests

* tests added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants