* Remove extraneous comment (see 9361d2 and 5c18f8)
* Flexible, multiple reaction types
* Fix reaction counts
* Re-use svg for active state for now
* Update yml, update spec
* Possible temp fix for failing tests
* Colorize reaction icon svgs
* Reaction engagement above post title
* Index reactions engagements (for logged-out)
* Maybe readinglist is special
* Try using crayons' dropdown as a drawer?
* readinglist isn't really public now
* feat: update the styles for the reaction drawer
* Grey background highlight, turn off border/shadow
* Read our feature flag docs, saw this was recommended
* Missed fifth emoji: party/tada
* Fix JS test errors
* Update test with tada
* Suppress flashing engagements when no public reactions
* Liberate jump-to-comments from unicorn replacement
* 'Add reaction' on tooltip
* Don't show reaction emoji on index unless it's been used
* rubocop
* Update heart+ total count when toggling
* Do not include 'readinglist' in drawer/public counts
* Fix semi-public readinglist so that icon is badged for current user
* Tweak heart-plus svg
* Style tweak: border on active reaction
* Show reacted icon on drawer trigger for 1.5 sec
* Tweak styles for engagements bar
* Style tweaks for multiple engagements (#index)
* Trying to get size working through crayons/inline_svg
* Sparkle hearts
* Restore unicorn
* Make heart-plus-active work when user has an active reaction
* Try 'hoverdown' a dropdown that activates with hover
* Long touch?
* Tap *outside* the drawer to close
* Mobile reaction drawer is also supposed to be columns
* More reaction count cleanup
* Final emoticons maybe?
* Fix reaction bug when feature disabled
* Remove readinglist from public reaction counts
* Update specs for new reaction categories
* Shuffle makes specs flaky
* Order does not matter
* rubocop
* Update to preserve readinglist analytics
* Shuffle makes specs flaky
* Fix flickering images, remove icon highlight for now
* Don't update total for readinglist
* reactions_by_user_id
* Try renaming this observer function
* Try unid ids for SVGs
* Remove local test file
* Simplistic test for the unique svg transform
* Fix javascript for current SVG
* Signifcant string literals in this case, rubocop
* Use the right expected output
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
* Try an idempotentish reaction create API
* Add tests for create API endpoint
* Try -> ReactionHandler
* Fix existing tests first
* Tests for .toggle; fix broken handle_existing
* Use the Handler
* Tweak http status for reaction create
* Use the category reader
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
* Try renaming moderator -> super_moderator
* Still finding 'moderator' words
* Fixes for failing specs
* Update test with new role name
* Update app/services/moderator/manage_activity_and_roles.rb
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* building again
* still building
* still building
* stuck
* Suzanne Holmes on the case
* make report content a button not a link
* revert to link
* add tests
* revert changes made trying to get ModCenter to work
* hide nonworking actions_panel btns in Mod Center
* nudge Travis
* incorporate PR comments
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
* building again
* still building
* still building
* stuck
* Suzanne Holmes on the case
* make report content a button not a link
* revert to link
* add tests
* revert changes made trying to get ModCenter to work
* hide nonworking actions_panel btns in Mod Center
* nudge Travis
* incorporate PR comments
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
There are 2 things going on in this pull request:
1. Reducing duplication of knowledge, by favoring constants found in
Reaction.
2. Creating and enforcing the policies regarding the different
categories of reactions.
I chose to conflate these two as I was working on developing the
ReactionPolicy's finder method.
Closesforem/forem-internal-eng#454
Related to forem/forem#17628
* schema file undelete description
* feat: v1 of the script
* Flesh out remaining enums under their categories
* complete UsersSettings data update script
* complete DUS for relevant attributes in users and profiles tables
* complete DUS for users_notification_settings
* alphabetize user_settings sql file
* safeguard against null values for "null: false" settings
* Set up actual UsersSettings DUS and specs files
* fix broken DUS script
* complete specs for UsersSetting DUS
* Address QA of specs
* complete specs for users_notification_settings DUS
* fix the typos (thanks Julianna!)
* begin implementation
* still building
* add missing attribute "email_membership_newsletter"
* complete sync code (except race condition for user profile)
* complete implementation, remains tests
* Address PR review and fix Travis fails
* remove superfluous Profile.new
* fix travis fails
* feat: update the users_notification_setting attributes from the user model
* feat: use the config fonts enums to display the fonts
* feat: loop through the keys
* fix profile = nil blowing up; add specs for notification_setting model
* remove unneeded spec
* remove feed validation until after sync code removed; fixes feed_import spec failures
* remove spec associated with feed_url validation in user_setting model
* fix failing spec 😅
* add TODO
* feat: set the user settings in the user controller and use it in the customization form
* feat: move some update logic to the users settings controller thats being used from customization
* feat: show the updated values form the users_settingd and not the user instance
* Generalize redirect back to current tab
* still trying to reflect changed theme upon refresh
* customizations take effect on refresh
* remove 'with_feed' scope from user model
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* start with takeover for fields previously in profiles table
* Takeover code for `publishing_from_rss` section in Settings (#13914)
* implement takeover code part 1
* implement takeover code
* fix feed fetch
* need rhymes help
* complete implementation; specs pending
* fix STUPID omission that caused so many headaches 😫
* implement profile fields pointing to users_settings 🎉
* run migrations
* implement inbox type & guidelines takeover code; specs pending (#13911)
* Point changes in notification settings to `users_notification_settings` table (#13910)
* implement takeover code; remains specs
* address PR feedback; remove related sync code
* address PR review feedback
* need help with routing and specs
* address pr review
* addressing pr review
* Treat implementation edge cases and omissions 😅
* fix uncommented comment
* fixing implementation cases
* address more PR review feedback
* fixing notifications use-cases
* refactor settings controller
* more pr review changes
* solving bugs
* fix broken onboarding
* handle eperience_level calls
* more fixes
* remove unneeded mappings
* add To-dos for quety updates
* remove done TODO
* purge done TODOs
* update notification_settings-related queries
* start fixing specs
* fixing specs
* fix notification and lrg_forem specs
* fixing broken specs
* still fixing
* fix line dif and remove reloads from user.rb
* run specs
* silence bullet and other fixes
* remove setting migration scripts and specs, fix more settings for specs
* handle missing user for article builder and fix notification specs
* fix some final controller specs and re-add incorrectly removed specs
* remove deprecated data update scripts and related workers, put travis back
* refactor admin tags mods controller, write/move specs for users notifications settings controller
* schema cleanup and other small refactors for consistency
* set field we can invalidate in spec via active record instead of at the db level
* remove I think an uneccessary hook call from subscribe_to_mailchimp_newsletter
* use bnefore_create to setup settings, please dont blow up the test suite
* mailchimp bot fix
* remove decorator in favor of single model method
Co-authored-by: Arit Amana <msarit@gmail.com>
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
Co-authored-by: Jamie Gaskins <jamie@forem.com>
* Enable new Rails/* cops and use autocorrect on them
* Fixed Rails/PluckInWhere leftovers
* Fix Rails/DefaultScope
* Enable and fix Rails/PluckId
* Fix manual mistake with forcing autocorrection on Rails/PluckId
* Apply PR feedback to remove Rails/PluckId inline disables
* Apply PR feedback to get rid of Rails/PluckInWhere inline
* Fix archived readinglist reactions affecting count
The reading list count badge on the home page currently takes all
readinglist reactions into account, but we shouldn't be including those
that are marked "archived."
Secondarily this fixes a bug that affects only admin users: all
reactions created by admins were given the status "confirmed"
instead of the expected "valid" status.
* db
* Add an iframe to host mod actions menu
This iframe is probably the fastest way to get a working mod actions
menu without rewriting existing code. We may eventually re-write this,
but based on Ben's recommendation we are going to go with an iframe
because it gets us a working feature quickly and it seems to be serving
us well in other parts of the application.
* Add the mod actions menu button to articles
When the user is "trusted" they will see a small badge on the lower
right-hand side of the screen. Clicking the icon reveals the mod actions
menu.
* Add header to actions panel (#7395)
* Update iframe border
* Add 'Moderate Post' header and button
* Use inline SVG over <img src='svg'>
* Use Crayons variables for units
* Use flexbox to center chevron
* Add accidentally deleted positioning
* Add chevron-right.svg
* Use a partial for actions panel and revert /mod page
* Load actions panel in iframe and not /mod
* Style UpVote, DownVote and Vomit buttons (#7421)
* Add a iframe to host mod actions menu
* Up and Downvote Icons
* Starting with vomit button
* Completed UI; interactions pending
* Incorporated Andy changes; making mod action-panel
* space reactions away from header
* UI tweaks and corrections 1
* Fixing styles to match crayons
* choose pure white color css variable
* Add thumbs-up emoji; address Lisa comments
* Trying to fix reactions interactions
* remove clearThumbReactions function
Co-authored-by: jacobherrington <jacobherringtondeveloper@gmail.com>
* Add bottom layout for actions panel (#7501)
* WIP for Lisa
* Finalize mod actions bottom section
* Use showing instead of hidden for transition
* Add new optimized SVGs
* Fix weird height issues for actions panel
* Move hover styles below the cascade, yo
* Use margin-top for sticky footer over height: 100%
* Move initialize actions panel button to Webpack (#7506)
* Move actions panel JS code to webpack
* Refactor and use destructuring
Thanks @nickytonline!
Co-Authored-By: Nick Taylor <nick@iamdeveloper.com>
* Rename file
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* Configure Experience Level options for Mod Action Panel (#7507)
* Add a iframe to host mod actions menu
* Click interactions (no toggle of dropdowns yet)
Co-authored-by: jacobherrington <jacobherringtondeveloper@gmail.com>
* Fix the iframe's path (#7509)
* Toggle the 'Set Experience Level' menu on button-click (#7529)
* Add a iframe to host mod actions menu
* Add set-exp dropdown functionality
* WIP: making exp level updates async
* Completes async implementation
* Fix controller for "actions_panel" and "/mod"
Co-authored-by: jacobherrington <jacobherringtondeveloper@gmail.com>
* Add close button interaction (#7552)
* Rename actions panel pack file
* Add close button toggle to actions panel
* DB update
* Move more code to Webpack and add conditional tag adjustments section (#7652)
* Move JS code to Webpack
* Clean up a few style issues
* Add styling for tag adjustments
* Add active/inactive functionality
* Add conditional rendering for tag adjustments section
* Add missing variable oops (#7673)
* update with upstream
* Add missing subtract svg (#7695)
* Create 'Flag User' modal (#7626)
* Add a iframe to host mod actions menu
* Starting task
* Phase 1
* Fix "Close Modal" icon
* Implement open modal
* Working on all "Close Modal" actions
* Almost-complete implementation
* Remove Abuse Report snackbar
* Delete unneeded JS code
* Remove "How does this work?" links
* Link to Community Moderation page
* Addressing code review corrections
* Update api call to use "request" method
* Make else path clearer in api call
Co-authored-by: jacobherrington <jacobherringtondeveloper@gmail.com>
* Mod Actions Panel: Prevent nonsensical reaction pairs (#7699)
* Still implementing
* Completed Implementation
* Address code review feednack; refactor "create" method
* Move scss variables to native-css (for ModPanel code only)
* Correct missing native css
* update to native-css again
* More sccs -> native-css fixes
* Adjust ModPanel Button position on mobile (#7744)
* Adjusted ModPanel position on mobile
* Better adjustment
* Fix phantom schema.rb changes
* Fix phantom schema.rb changes
* Finalize tag adjustments (#7740)
* Finalize tag adjustments and flow
* Fix logic for rendering adjust tags options
* Clean up alert response
* Rename user to trusted user
* Use new CSS variables
* Add/remove tag on article's tag section after adjusting
* Fix logic for admin tag input and some other niceties
* Final bug fixes mod panel (#7772)
* Use correct boolean statement
* Clear the value of the textarea not div
* Use the correct attribute
* Use actions panel for /mod page (#7775)
* Fix loading logic with tag adjust button conditional render
* Link to tag moderation for adjust tags section
* Use top over window.parent
Thanks @nickytonline!
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* Use Webpack alias to import
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* Use place-items shorthand over align-items + justify-content
Thanks @nickytonline!
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
* Fix typo for utilities
* Add new line to end of file
* Disable linter for use for top function
* Use align-items and justify-content center
* Update SVGs to spec
* Remove unnecessary height and use spacing units for open button
* Remove accidentally added comment
* Error handling when selecting reactions; optimize "reactions.each" loop
* Add comment about clearing innerHTML
* Revert schema back to master
* Use each since there should only be two reactions
* Fix typo oops
* Add missing height oops
* Return if there are no reactions to be destroyed
* Center path with GUI tool shrug
* chose more appropriate name for JS pack; rewrote api calls using async-await
* Rename variables and methods and check categories before clearing
* Use addSnackbarItem instead of hardcoded version
* Place articleModerationTools pack behind user_signed_in
* Correct omission
* Implement dynamic imports for ModPanel tools
* Implemented async/await; added snackbar message for null response use-case
* Fix the "/article/mod" page; make sure all reactions, vomit-user and exp-level working as expected
* Update language to reflect new UI
* Close the modal after the "Confirm Action" button is clicked
* Change text for Spam/Abuse button
* Fix schema to use with master
* Update schema to master again
* Use crayons button for actions panel button
* UI tweak to play nicer with site themes
* Make actions panel work for dev.to/mod
* Add snackbar for reactions
* Update how does this work links
* Add "thumbsup" reactions to logging
* Add thumbsup to categories
* Add external link icon
* Changes to reflect "Privileged" and not "Negative" reactions; spec changes pending
* Updated instance variable
* Starting to update the specs
* Update "thumbsup" points from 10 to 5
* Still working on both requests
* Embracing an easier implemantation (thanks Andy!)
* Add tests for actions panel
* Add some basic tests for actions panel
* Change to flag to admins
* Indicate that 'Reason for Tag adjust' is required
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Rename negative_reactions to privileged
* Update rating level to use correct values
* Use a different display value than backend value
* Don't show adjust tags for trusted users
* Add specs for moderation_routes for admin and super_admin
Co-authored-by: Arit Amana <msarit@gmail.com>
Co-authored-by: jacobherrington <jacobherringtondeveloper@gmail.com>
Co-authored-by: Arit Amana <32520970+msarit@users.noreply.github.com>
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Rename positive_reactions_count to public_reactions_count
* Add positive reactions count back in so we can remove it
* Use public_category method for reactions
* Add positive_reactions_count in case any old caches rely on it
* Add positive_rxn_count to account for API endpoints
* Remove unused method
* One more spot...
* Add method back in because of caches
* Update specs to match new functionality
* Fix typo
* Remove unused methods
* Add audit logging for negative reactions
This change saves requests that create negative reactions to the audit
log. We need to be monitoring admin and moderator actions throughout the
app to increase visiblity on how our tools are being used and identify
abuse.
Additionally, this will help east concerns about giving elevated users
more powerful tools.
* Add a basic UI for moderator audit logs
* Log experience level ratings
* Log tag adjustments
* UI tweaks for moderator actions log
* Add logging to internal reactions controller
* Add logging for admin actions on users and articles
* Add searching to the moderator actions table
* Move audit instrumentation out of concern
We are able to use a PORO here instead of using a Rails concern. Moving
this also makes syntax to audit something quite a bit more explicit and
obvious to future developers
* Change moderator logs pagination page length
* Move auditing to after action filters
* Add moderator actions to the internal navbar
* Add request spec for internal moderator actions
* Use request params to populate AuditLog slug
* Do not render or link to empty rss feeds
* s
* Move calculation to worker
* remove xit test
* Also allow implicit rating votes in comments
* Fix alignment issue
* Remove comment logic
* Pluck over map
* Explain why map makes sense there
* Refactor reactions controller a bit and iterate only once
* Use group by instead of N counting queries
* More positive
* Simplify BufferedArticlesController
* Less queries for MailchimpBot
* Use Rails instead of SQL
* Build comment_ids only when needed
* Add UI to vomit on a user from /mod
Co-authored-by: MichaelaHunter <michaela1234@gmail.com>
* Add backend tweaks for vomitting on users
Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com>
* Validate that users can't moderate articles
* Add system spec for article mod page
* Satisfy rubocop after rebase
* Fix typo and formatting
* Use reactable_id instead of user_id
Co-authored-by: Michaela Hunter <60361569+MichaelaHunter@users.noreply.github.com>
Co-authored-by: Andy Zhao <17884966+Zhao-Andy@users.noreply.github.com>
* Add sink user service and specs for mass vomits
* Use new score calculation
* Lower articles' scores instead and make async
* Add lower score functionality to controllers
* Remove unused variable
* Use correct var and add missing arg
* Remove unused status
* Add composite index for reactable_type and ID
* Use alias instead of additional boolean
* Use medium priority for sink worker
* Log to honeybadger and not logs
* Log the error and not a string
* Replace current_user.id with efficient_current_user_id in high-leverage areas
* Update name of efficient_current_user_id
* Replace user_signed_in? in pageviews
* Remove unneeded ?
* Add spec for org reaction notification
* Add organization_id to notifications
* Add validations for user and org IDs
* Move comment json_data out of loop
* Use actual column names instead
* Add organization filters
* Remove extra text-align
* Add organization filtering
* Refactor to reduce complexity
* Add receiver argument to handle orgs
* Add has_many notifications for orgs
* Add follow notifications for orgs
* Add comment notifications for orgs
* Rename some tests for specificity
* Add mark org notifications as read functionality
* Add radix to parseInt
* Define json_data outside of loop
* Notify org followers of a new post as well
* Move test to proper location
* Add test for aggregated method
* Make send org reaction notification more readable
* Test the rest of the notification model
* Refactor tag adjustment spec
* Fix extra html
* Add basic Honeycomb initializers
* Add some basic instrumentation, capture basic IDs
* Correctly alphabetize Gemfile, embed env in dataset names
* Actually reorder Gemfile because I can read
* Add custom tracing instrumentation to RssReader
* Improve timing/tracing info in RssReader
* Even make sure Errors show up in trace if possible
* Make sure we capture this as Rails traffic
* Swap in dev/test Libhoney::Clients as appropriate
* Move context-snagging bits into lib/instrumentation.rb
* Merging Gemfile lines seems to be my Achilles heel
* Move follow and reaction aggregation into Notification model to avoid re-compute
* Ugh. Fixing schema
* Update tests
* Skip some tests in notifications_spec
* Add new columns to notifications table
* Remove stream from notifications and add new methods
* Turn off moderation comment notifications
* Add notifiable_type index to migration
* Stop creation of Stream-based notification model instances
* Add notification model create hooks
* Add badge achievement notification creation hook
* Fix some specs
* Add missing @ symbol
* Fix for tests and rename a few things
* forgot to uncomment code sigh
* Initial automatic cleanup with rubocop
* Fix syntax error introduced by rubocop
* Cleanup seeds file
* Cleanup lib folder
* Exclude bin folder because it contains auto generated files
* Make Rubocop a little bit more chatty
* Block length should not include comments in the count
* Cleanup config folder
* Cleanup specs
* Updated Rubocop version and generated a todo file
* Fix broken ArticlesApi spec
* Fix tests
* Restored rubocop pre-commit hook
* Delete old files and combine into one spec
* Write new reaction request spec
* Use a single route for logged in/out reaction count
* Refactor a bit
* Remove unused file
* Add reaction policy and spec
* Fix eslint issue
* Remove dead route