* fix: remove hardcoded paths
* fix: use path helpers
* swap href for link_to
* feat: use path helpers
* feat: use a data path to send through the path that we will be calling
* feat: pass route through to js
* dus index path
* chore: change to use path_helpers
* feat: update DUS controller
* chore: oops remove these paths
* feat: make the sidebar more dynamic
* refactor: use the action in the same controller instead of the whole path
* feat: remove hardcoded routes
* feat: move routes into file
* feat: use rails 6 draw for the admin routes
* add a helper method
* oops: fix super
* feat: add the hacky helper methods :( )
* WIP: created different path helpers for the new routes and point the old helpers to the new ones if the FF is toggled
* feat: update the module
* chore: add new paths
* feat: change link_to's use paths instead
* feat: feedback_messages to scoped admin route
* chore: update the feature flag urls helpers
* feat: feedback_messages issue
* chore: remove all the workarounds
* chore: rubucop
* fix: oops remove helper
* chore: comment out the tests that touch the tabbed navbar which is affected by the rails application needing to be reloaded
* feat: ensure that we chcek if the db table exists
* Remove pro role on user, expose pro dashboard to all users as analytics
* Remove pro from Elasticsearch mappings
* Update user role docs to use :trusted over :pro
* Remove pro from Role model spec
* Remove more references to pro, as noted by @rhymes
* Added credits_awarded to /admin/badges forms
* Award credits only if badge has them
* Removed information about credits and listings in the new badge email when not needed
* Specs for number of credits awarded for badges
* Added missing newline
* Fix typo
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
* Improve new_badge_email.text.erb
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
* Fixed number of credits in notification
* Added specs for number of credits in notifications
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
* WIP: Adds a Users::RemoveRole service to encapsulate Admin::UsersController#destroy
* Adds #role_display_name helper to application_helper.rb for extensibility
* Adjusts Member is Suspended banner to Member is Banned for consistency
* WIP: Extract Admin::UsersController#destroy into remove_role.rb service
* Cleans up Admin::UsersController#destroy and remove_role.rb service
- Removes unneccessary code from Admin::UsersController#destroy
- Replaces args with keyword args in Admin::UsersController#destroy
- Replaces args with keyword args in remove_role.rb service
- Refactors code to be more extensible and cleaner overall
* Adds a remove_role_spec.rb to test Users::RemoveRole service
* Fix typo in Admin::UsersController#destroy
* Refactors role_display_name helper method and reverts change to banner
* Use #role_display_name in _current_roles.html.erb
* Refactors conditional, names, and adjusts spec to account for refactors
* Raises StandardError if there is an issue with role removal
* Add the ability to remove a role from a non-super_admin in Admin::UsersController
- Adds a #destroy action to the Admin::UsersController
- Adds a destroy route for the action
* Add a removal button to non-super_admin roles on admin user pages
- Pulls Current Roles out of _activity and into own partial
- Adds a _current_roles partial to /admin/users/show
- Adds REMOVE buttons to non-super_admin roles
- Conditionally renders REMOVE buttons for certain roles only
* Add tests around the removal of roles to users_manage_spec
* Adjust formatting of link_to in _current_roles.html.erb
* Use :aggregate_failures in role-related tests in users_manage_spec.rb
* Refactors Admin::UsersController#destroy and role params
* Update admin/users_spec.rb to take into account _current_roles partial
* Replace REMOVE text with X on role removal buttons
* Add additional elsif to handle single_resource_admin removal
- Adds resource_type params to Admin::UsersController
- Adds elsif to handle removal of single_resource_admin roles
- Adds resource_type to the removal button in _current_roles
- Adds a spec around removing single_resource_admin roles
* Add .constantize to resource_type in Admin::UsersController
* Move .constantize to resource_type arg rather than params in #destroy
* Use .safe_constantize rather than .constantize for params[:resource_type]
* Remove .safe_constantize from params and onto inline var instead
* Add nil check to removal of :single_resource_admin role in #destroy
* Update users_manage_spec.rb to remove proper role in test
* Add resource_name to current user and super admin _current_roles list
* Add additional test around removing :single_resource_admin role
* feat: add tech_menu_items to the admin helper
* feat: add the tech resources to /admin if the user has the correct role
* feat: use a partial that will show the data update scripts in the navbar with the correct role
* chore: use a method
* test: chore
* feat: setup the data to need permission single_resource_admin with DataUpdateScript permissions
* chore: remove the if current_user.tech_admin?
* chore: remove line
* feat: add a DUS for single_resource_admin roles to be added to users with tech_admin roles
* fix: move all teh routes outside of the block where tech_admin is required.
* chore: use the constant and remove the method
* chore: add a comma
* Update config/routes.rb
Co-authored-by: rhymes <rhymes@hey.com>
* feat: add a tech admin role to the dropdown
* feat: add the tech admin role along with single_resource_admin
* chore: oops
* refactor: amend the spec to use let blocks
Co-authored-by: rhymes <rhymes@hey.com>
* Simplify special snowflake onboarding images and center around primary/secondary logos
* Remove left and right navbar customization
* Update app/lib/constants/site_config.rb
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
* Remove spec onboarding images
Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
* feat: add an error column to the data update script
* feat: save the error to the error field
* feat: save the error when the script fails
* feat: show the script error on the data update script page
* chore: pass the error to mark_as_failed instead of having its own function
* refactor: use presence
* test: ensure that we test an error case of a data update script
* chore: rename errorneous to failing
* test: update some specs, working on the others
* chore: update tests now that there are two files
* chore: change error from a string to a text to allow for more char
* feat: order the data update scripts by the latest script that ran
* feat: when the script has succeeded reset error to nil
* feat: create a model function that will allow the script to be force run
* chore: oops remove the functions form the worker to the model so it can be re-used
* feat: create an endpoint that will call the model method force run when we hit the api by clicking the button
* feat: ensure that the we add an ajax call that calls the controller endpoint
* chore: remove newline
* refactor: change to a more Restful route
* refactor: use Stimulus
* fix: move the code from the model back into the worker so that we can reuse it in the controller
* feat:call the worker in the force_run action and create a show route
* feat: very first draft of using a polling mechanism on the show method after we kickoff the sidekiq job (still need to error handle)
* chore: some syntax changes and unused variables
* fix: call the method correctly with the paramters
* feat: do some error handling
* feat: error handing on the frontend
* chore: use e instead of err
* refactor: just pass the id instead of the whole script
* chore: remove the button
* fix: allow the id to be passed
* feat: handle errors better
* feat: limit the filename column width
* refactor: use a common function to set the banner error
* test: add a test fro rerun button
* test: v1 of the data update script request
* test: write some specs for the js controller
* Update app/controllers/admin/data_update_scripts_controller.rb
Co-authored-by: Michael Kohl <me@citizen428.net>
* tests: update the data worker spec
* chore: clean up the js controller and its tests
* chore: remove whitespaces
* chore: swap the functions based on the controller
* chore: updates to the UI
* chore: remove the standard error catch
* chore: update the alert and error messages
* chore: remove test for error handling for sidekiq run
Co-authored-by: Michael Kohl <me@citizen428.net>
When `acts-as-taggable-on`'s `.tagged_with()` is used with `any: true`,
the gem will use `SELECT *` regardless of any previous (or following) requests
of selecting a limited amount of columns.
Given that the `articles` table has [73 columns](https://dev.to/admin/blazer/queries/314-number-of-columns-in-all-tables)
that will amount to wasted RAM memory for columns we don't need.
By "unscoping" any previous `select()` we can optimize used memory.
Before:
```ruby
[24] pry(main)> Article.tagged_with([:ruby], any: true).select(:id, :name).to_sql
=> "SELECT \"articles\".*, \"articles\".\"id\", \"name\" FROM \"articles\" WHERE EXISTS (SELECT * FROM \"taggings\" WHERE \"taggings\".\"taggable_id\" = \"articles\".\"id\" AND \"taggings\".\"taggable_type\" = 'Article' AND \"taggings\".\"tag_id\" IN (SELECT \"tags\".\"id\" FROM \"tags\" WHERE (\"tags\".\"name\" LIKE 'ruby' ESCAPE '!')))"
```
Note, how the SQL query is `articles.*, articles.column_a`
After:
[25] pry(main)> Article.tagged_with([:ruby], any: true).unscope(:select).select(:id, :name).to_sql
=> "SELECT \"articles\".\"id\", \"name\" FROM \"articles\" WHERE EXISTS (SELECT * FROM \"taggings\" WHERE \"taggings\".\"taggable_id\" = \"articles\".\"id\" AND \"taggings\".\"taggable_type\" = 'Article' AND \"taggings\".\"tag_id\" IN (SELECT \"tags\".\"id\" FROM \"tags\" WHERE (\"tags\".\"name\" LIKE 'ruby' ESCAPE '!')))"
```
`articles.*` is gone :-)
- https://github.com/mbleigh/acts-as-taggable-on/issues/936
- 47da5036de/lib/acts_as_taggable_on/taggable/tagged_with_query/any_tags_query.rb (L2-L8)
* Use Ransack for admin/tags
* Update admin tags index to use search with Ransack
* Add feature to sort tags in /admin/tags
* Add test for viewing /admin/tags pages
* Add aria labels for sort links
* Make links a bit more accessible
* Create Bufferizer::MainTweet service
* Create Bufferizer::SatelliteTweet service
* Rename text to tweet
* Create Bufferizer::FacebookPost service
* Create Bufferizer::ListingsTweet service
* Remove old Bufferizer
* Update spec wording
* Update admin_id argument
* Use constants for size limits
* feat: add a basic table template with the basic info for the data scripts
* feat: add nav element to sidebar
* feat: add twemoji
* feat: success and failed icon
* feat: don't wrap the status title
* feat: make data update scripts accessible only be tech_admin
* chore: add the file name to the table
* test: write tests for the data_update_script_controller
* chore: remove icons and add status
* Removes collective_noun and collective_noun_disabled from app
* Config Generalization: replaces community_qualified_name with community_name
- Generalizes SiteConfig after the removal of collective_noun field
- Updates copy where necessary to be readable with community_name
- Makes the community_name SiteConfig description more explicit
- Adds flexibility for Admins by removing appended "community"
* Adds a data_update script to remove collective_noun and collective_noun_disabled
* Removes appended community from stories_controller.rb
* Removes unnecessary quotation marks around SiteConfig.community_name.to_s
* Makes SiteConfig community_name description more explicit
* Removes topic from #email_from and replaces arg with _
* Removes argument from #email_from (facepalm)
* Reverts changes to application_mailer and notify_mailer_spec
* Removes default "Community" topic from application_mailer and makes topic optional
* Refactors #prepopulate_new_form to resolve Code Climate failures
* Refactors #email_from even further by use of a ternary operator per review suggestion
* Simplifies the data_update script used to remove collective_noun per review request
* Adds a data_update script to append community to community_name
* Updates data_update script to correctly append Community to community_name
* Removes RemoveCollectiveNounFromConfig and updates other script
* Removes superfluous false from data_update script
* Updates data_update script to be more idiomatic
* Remove GitHub repositories when user deletes their own GitHub identity
* Remove GitHub repos also from the admin remove identity
* Add a notice in Settings/Extension
* Add data update script to cleanup orphan GitHub repos
* Add gem omniauth-apple
* Integrate omniauth-apple
* Integrate callback
* Add fields
* Add tests, fix bugs and make it all work
* Show only enabled providers for the current user
* Add default profile image for Apple
* Remove localhost patch
* Bring over the changed Apple username if the user changes it
* More specs fixed
* Incorporate feedback from PR
* Fix specs
* Simplify code and fix spec
* Fix Broadcast generators to take into account the new provider
* Fix spec
* Generate a truly unique apple_username
* Fix user specs
* Add omniauth-apple-0.0.2 to vendor cache
* Fix merge conflict and spec
* Update VCR fastly sloan cassette
* Revert "Generate a truly unique apple_username"
This reverts commit 2462875575b0bbd6b3c1d56b25afcd3189671608.
* Fix user specs
* Fix specs
* Fix specs
* Hide Connect Apple button behind a feature flag
* Revert "Hide Connect Apple button behind a feature flag"
This reverts commit 105bde0373389a4eb9b6e948f60734c7e0e99cba.
* Fix line lengths
* Fix spec
* ES tag
* CSRF bypass for Apple callback
* custom user_nickname in Apple provider with small tweaks + omniauth-apple bump
* Fixes username specs
* Makes Apple users default image Users::ProfileImageGenerator
* Fallback to mascot_image_url in test environment to avoid breaking Travis
* Fixes Apple CSRF error + makes default nickname more readable
* Trigger Travis
* Better devise config
* Apple SiteConfig entires in /admin/config
* Fixing specs
* Adds beta_access? to Authentication::Providers::Provider
* Fixes specs
* Codeclimate double quote fix in Gemfile
* Fixes /admin/config allowed params & adds feature flag for provider beta_access?
* Remove Enfile & adds temporary docs
* Adds custom apple auth provider settings
* Fix authenticator spec
* Fix configs spec (use last instead of first to avoid apple special case)
* Remove dangling fields from /admin/config
* updates feature flag
* More test fixes
* Hide config behind feature flag too
* omniauth-apple bump
* Takes care of edge case fallback
* Reverse apple_username update
* Adds auth_time to info hash in apple omniauth mock
* Switch to next instead of nesting for feature flag
* Fixes CVE-2015-9284
* Fixes specs after auth providers initiatior refactor from GET to POST
* Spec fixes
* More spec fixes
* Fix Rails codebase reference link
Co-authored-by: rhymes <rhymesete@gmail.com>
Co-authored-by: rhymes <rhymes@hey.com>
* added podcast_owner role
* changed view files
* added owner functions
* changed function name in view file
* removed owner role
* removed changes in view file
* controller changes
* added permitted attributes
* fixed the failing tests
* deleted the remove_owner feature for now
* changed controller
* fixed the build error
* added route to add_owner
* added another test
* made suggested changes
* Display gdpr delete requests for deleted users in admin
* Added a test for destroy a gdpr request
* Reorganized gdpr requests menu
* Update schema version
* Added a link to the flash notice after user delete by admin
* Fix namespace for tests
* Aligh schema.rb with master
* Added a missing newline
* Removed unused partial
* Fix typo
Co-authored-by: Michael Kohl <me@citizen428.net>
* Replaced string with symbols for AR
Co-authored-by: Michael Kohl <me@citizen428.net>
* Added an AuditLog record on gdpr delete confirmation
* Make email and user_id required in Users::GdprDeleteRequest
* Checked out package.json from master
* Fix Gdpr => GDPR
* Added missing space
* Remove unneeded freeze
Co-authored-by: Michael Kohl <me@citizen428.net>
* Adds ability for admins to create new tags via /admin/tags
* Merge branch 'master' of github.com:forem/forem into fdoxyz/admin-new-tags-11026
* Fix rubocop pre-hook
* UI Tweaks
* replaces show with edit action & other minor changes
* Reverse unrelated changes
* Removed more unrelated edits
* Fix specs
* Fix moderator link
* Allow authors to restrict which emails can sign up
* Add form and tests
* Check for email presence in allowed email flow
* Fix test domains
* Fix codeclimate issue
* Simplify admin and add links to help pages
* Add line
* Add line
* Update app/views/layouts/admin.html.erb
* Update app/controllers/admin/configs_controller.rb
* Move svg to own file