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

Spam2: system for flagging nodes and comments to moderators and User moderation #8107

Merged
merged 27 commits into from Jul 21, 2020

Conversation

keshavsethi
Copy link
Member

@keshavsethi keshavsethi commented Jul 2, 2020

I have added the feature of Flag Nodes in spam2 in which any user can mark node as a flag. It will not affect the status of the node.

Flag will just increase the flag count by 1. If flag is 0 then it means that the node is not flagged and it is ok. All the flagged nodes will be listed on the flags page of spam2. Right now I have done it for nodes and working for flag comments as well.(refer #8107 (comment))

If flag count is above 10 then flag icon also becomes red.

Here are a few screenshots

Screenshot from 2020-07-02 20-20-22
Screenshot from 2020-07-02 20-21-03

Here flag count in shown in the status column and red icon indicates that the flag count is more than 10. Spamming that node will also unflag it as it is moderated.
Screenshot from 2020-07-02 20-21-05

@jywarren @cesswairimu @VladimirMikulic @ananyaarun @emilyashley @pydevsg @ebarry @Uzay-G Please review
Thanks!!

@codecov
Copy link

codecov bot commented Jul 2, 2020

Codecov Report

Merging #8107 into main will decrease coverage by 0.25%.
The diff coverage is 62.13%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8107      +/-   ##
==========================================
- Coverage   82.10%   81.84%   -0.26%     
==========================================
  Files         100      100              
  Lines        5751     5845      +94     
==========================================
+ Hits         4722     4784      +62     
- Misses       1029     1061      +32     
Impacted Files Coverage Δ
app/controllers/spam2_controller.rb 76.78% <53.57%> (-23.22%) ⬇️
app/controllers/admin_controller.rb 80.24% <100.00%> (+0.24%) ⬆️
app/models/comment.rb 77.51% <100.00%> (+0.62%) ⬆️
app/models/node.rb 91.18% <100.00%> (+0.12%) ⬆️
app/api/srch/search.rb 70.06% <0.00%> (+3.82%) ⬆️
app/services/execute_search.rb 94.44% <0.00%> (+5.55%) ⬆️

@keshavsethi keshavsethi changed the title spam2: Flag Nodes Spam2: Flag Nodes Jul 2, 2020
@ebarry
Copy link
Member

ebarry commented Jul 2, 2020

This is a great idea!
Who sees the red flag, and where?

  • Only moderators looking at the /spam dashboard?
  • Regular users browsing content?

Copy link
Contributor

@VladimirMikulic VladimirMikulic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since everything is centred, you could as well centre this section with control buttons:
https://i.imgur.com/YC7Xn5y.png

@keshavsethi
Copy link
Member Author

keshavsethi commented Jul 2, 2020

This is a great idea!
Who sees the red flag, and where?

  • Only moderators looking at the /spam dashboard?
  • Regular users browsing content?

@ebarry Regular users can just flag a node. List of flag nodes and that red flag icon is only visible to moderators at /spam2/flags.

Thanks!!

@keshavsethi
Copy link
Member Author

Since everything is centred, you could as well centre this section with control buttons:
https://i.imgur.com/YC7Xn5y.png

@VladimirMikulic Sure, I will do that. Thanks!!

Copy link
Member

@pydevsg pydevsg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keshav234156 can you please share screenshot of the change, thanks

@pydevsg
Copy link
Member

pydevsg commented Jul 4, 2020

@keshavsethi , the UI is pretty good, have you made this response as well or it's currently made for the Desktop version?

@keshavsethi keshavsethi requested a review from a team as a code owner July 5, 2020 18:30
@keshavsethi keshavsethi closed this Jul 5, 2020
@keshavsethi keshavsethi reopened this Jul 5, 2020
@keshavsethi
Copy link
Member Author

keshavsethi commented Jul 5, 2020

@jywarren @cesswairimu @VladimirMikulic @ananyaarun @emilyashley @pydevsg @ebarry @Uzay-G
I have also done flag comments in this PR. Here, any user can mark comments as a flag(it will not affect the status of a comment). Moderators can see those flag comments in /spam2/comments that have all the features like publish, spam, etc. moderator can identify flag comments through the icon with node title and active unflag button.
It is sorted as per flag count. I am currently working on its bulk moderation and tests
Screenshot_2020-07-06 🎈 Public Lab _spam_comments(3)
Screenshot_2020-07-06 🎈 Public Lab _spam_comments
@jywarren @cesswairimu @VladimirMikulic @ananyaarun @emilyashley @pydevsg @ebarry @Uzay-G
Please review
Thanks!!

@keshavsethi
Copy link
Member Author

@keshavsethi , the UI is pretty good, have you made this response as well or it's currently made for the Desktop version?

Yes, all the pages in /spam2 are responsive
Screenshot_2020-07-06 🎈 Public Lab _spam_flags

@keshavsethi
Copy link
Member Author

@keshav234156 can you please share screenshot of the change, thanks

@VladimirMikulic @pydevsg I have aligned bulk nav
Screenshot from 2020-07-06 03-12-05
Thanks!!

@keshavsethi keshavsethi changed the title Spam2: Flag Nodes Spam2: Flag Nodes and Comments Jul 5, 2020
if @node.flag == 0
flash[:notice] = 'Node already unflagged.'
else
@node.unflag_node
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might wonna check if the person who flagged it or if (moderator or admin) can only unflag it, this may complicate the feature..but let me know what you think

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added an if statement to check only moderators and admins can unflag item
Thanks

self
end

def unflag_comment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe for this we could reduce the flags...but if its a moderator/admin we set it to 0...what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But for this, we have to show flag count to users as well. Right now unflag means only moderators can unflag (i.e reduce flag count to 0). Other users can just flag nodes i.e increase its flag count by 1

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha, cool, sounds good...thanks for the clarification

@pydevsg
Copy link
Member

pydevsg commented Jul 6, 2020

Ah great work man , this UI is really clean and crisp. Keep up the good work @keshavsethi 🎉

@jywarren
Copy link
Member

jywarren commented Jul 7, 2020

Looking really nice! One suggestion is to use lots of Bootstrap tooltips:

https://getbootstrap.com/docs/4.4/components/tooltips/

to add short explanatory texts over things like the flag icon, without needing a lot of space! What do you think?

Copy link
Member

@jywarren jywarren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @keshavsethi I would also like to request that you add some tests -- to demonstrate how it is supposed to work, and to ensure it's protected against future changes. I know this is a lot, but it is really a critical part of a big feature like this so I appreciate it!

  • unit tests for changes to the models
  • functional tests for controller actions
  • system tests for javascript actions (pressing buttons, complex integrated sequences like several actions chained together)

Does this make sense? Thank you so much!

@keshavsethi
Copy link
Member Author

Looking really nice! One suggestion is to use lots of Bootstrap tooltips:

https://getbootstrap.com/docs/4.4/components/tooltips/

to add short explanatory texts over things like the flag icon, without needing a lot of space! What do you think?

@jywarren I have added a few in bulk moderation nav.

@keshavsethi
Copy link
Member Author

keshavsethi commented Jul 20, 2020

@jywarren @cesswairimu @pydevsg @VladimirMikulic @ebarry, I have added the User moderation page here where the moderator can ban and unban users. I have also added filters for admin moderators and banned users. Can you Please review and merge this PR as I am stuck here. This PR is getting bigger and has so many changes. You can review it in gitpod as well(it might give an error in the dashboard but can just change URL to spam2 and test it). Thanks!!
Screenshot from 2020-07-20 10-52-26
In my future PRs, I am planning to add a search feature and Queue where the moderator can moderate only those nodes which have tags that they are following.
Please review 🙏
Thanks!! ❤️

@keshavsethi
Copy link
Member Author

@jywarren @cesswairimu I have updated the UI a bit and completed user bulk moderation. Please review!!
This PR is getting Bigger, Please review and merge if it is fine. 🙏
Screenshot from 2020-07-21 21-23-26
Please review and merge if it is fine. Thanks!!

@jywarren
Copy link
Member

Reviewing this now! Thanks @keshavsethi for your patience. I hope we can work more modularly and that GitPod helps us review faster, so you get un-stuck!

@jywarren
Copy link
Member

It's booting up in GitPod! 🕐 😄

@keshavsethi
Copy link
Member Author

keshavsethi commented Jul 21, 2020

@jywarren I have made some changes in gitpod #8162 It is working fine there.

@jywarren
Copy link
Member

OK!

Nice!

Screen Shot 2020-07-21 at 1 30 40 PM

@jywarren
Copy link
Member

Hmm. i'm still getting hit by Mysql2::Error: Expression #3 of SELECT list is not in GROUP BY clause so i'm going to try to resolve that first! But the page looks great so i am pretty confident it'll be good to merge today!

@@ -22,5 +22,16 @@ class DashboardTest < ApplicationSystemTestCase
take_screenshot

end


test "User can flag a node from dashboard" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks!

@jywarren
Copy link
Member

I'm content with how this looks so far! Thank you! The tests were super helpful and I loved being able to try it out on GitPod. Thanks and congratulations, @keshavsethi !!!

@keshavsethi
Copy link
Member Author

Thank you so much @jywarren 🎉 🎉 ❤️

dms-yondy pushed a commit to dms-yondy/plots2 that referenced this pull request Aug 7, 2020
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
nadimakhtar97 pushed a commit to nadimakhtar97/plots2 that referenced this pull request Sep 21, 2020
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
shubhangikori pushed a commit to shubhangikori/plots2 that referenced this pull request Oct 12, 2020
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
alvesitalo pushed a commit to alvesitalo/plots2 that referenced this pull request Oct 14, 2020
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
piyushswain pushed a commit to piyushswain/plots2 that referenced this pull request Oct 22, 2020
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
manchere pushed a commit to manchere/plots2 that referenced this pull request Feb 13, 2021
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
lagunasmel pushed a commit to lagunasmel/plots2 that referenced this pull request Mar 2, 2021
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this pull request Oct 16, 2021
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
ampwang pushed a commit to ampwang/plots2 that referenced this pull request Oct 26, 2021
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this pull request Dec 28, 2021
…moderation (publiclab#8107)

* spam2 flag nodes

* nav align

* flag comment moderation

* flag comment order

* spam2 flag comments

* spam2 flag and filters update

* codeclimate issue

* codeclimate issue2

* reduce filters

* spam2 code climate

* test issues spam2

* spam2 flag filters

* spam2 flag tests

* flag spam2 test issue

* flag count and ui update

* spam2 typo in tests

* spam2 syatem test update

* user moderation and search feature

* indentation

* user moderation

* indentation

* UI update of spam2

* spam2 ui update

* bulk user moderation

* bulk user moderation spam2

* refactoring spam2

* spam2 refactoring
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.

None yet

6 participants