Commit graph

1845 commits

Author SHA1 Message Date
Anna Buianova
455399bdba
Rubocop fixes (#18461)
* Rubocop fixes

* Fixed most Capybara/SpecificMatcher violations

* Moved flash notice texts to locales
2022-09-16 15:25:48 +03:00
VISHAL DEEPAK
b84fa1da08
Sort comments reopen (#18349)
* Sort comments in articles page

* Clickable area in sort comments article is now more approriate

* Comments subtitle is now responsive in articles page

* Consider comments sort order for cache in articles page

* On selecting sort option the refreshed page lands to comments section
2022-09-13 11:37:48 -06:00
Joshua Wehner
2b24167fba
Try fixing comment like count bugs (#18438)
* Try fixing comment like count bugs

* Tests for the CommentCreator
2022-09-12 10:12:46 +02:00
Joshua Wehner
892ad01264
Restrict Reactions API to admins (#18424)
* Restrict Reactions API to admins

* Also update API docs spec

* Removed unneeded pundit_user
2022-09-08 17:56:42 +02:00
Ridhwana
172dfef4bf
Add logged-in vs. logged-out targeting option for Display Ads #18390 (#18400)
* feat: add a migration that creates a display_to column on the display_ads table

* feat: add an enum for display_to

* feat/WIP: add rough draft of the field to the UI and permit it in the controller

* feat: take into account on whether an ad needs to be shown on logged in or out or both + update cache keys on sign in

* fix: if a user is not signed in then we want to display all and logged out

* fix: display_for spec in model

* feat: add some tests for display_to

* feat: style the label

* feat: show the display_to on the index page

* feat: add a seed for e2e

* chore: force true
2022-09-07 17:21:27 +02:00
Fernando Valverde
1f6c53a20c
Update per_page_max in API endpoints + docs bump (#18415)
* Update per_page_max in API endpoints + docs bump

* Small tweak

* Fix spec typo
2022-09-02 14:07:19 -06:00
Ridhwana
3d3e5156a3
Add "name" field to Display Ads (#18396)
* feat: create a migration to add the display ad name column to the tanle

* feat: add a display ad name to the interface

* feat: add a display ad name after create

* feat: whoops the migration file

* feat: add a DUS to update previous Display Ads names

* fix: test

* refactor: update the name after_save

* fix: add name to params
2022-09-02 16:29:33 +02:00
Andy George
be27fe74ab
Utilize ApplicationConfig["API_PER_PAGE_MAX"] (#18394)
* add ENV["API_PER_PAGE_LIMIT"]

* cast to int

* add private_constant PER_PAGE_MAX

* use 1000 int

* typo

* use reduced count for ListingsController

* typo

* set max/default in ArticleApiIndexService

* update initializer in ArticleApiIndexService

* Update app/controllers/concerns/api/articles_controller.rb

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>

* Apply suggestions from code review

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>

* update API docs

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
2022-08-30 13:46:39 -05:00
Joshua Wehner
2ff67bda24
Try an idempotentish reaction create API (#18377)
* 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>
2022-08-30 16:43:18 +02:00
Ridhwana
7f25a25fe1
Update the error message when a user with role "comment_suspended" tries to comment (#18367) 2022-08-26 10:23:52 -05:00
Joshua Wehner
b6efce21fe
API for Reactions: Create endpoint (#18355)
* Extract reaction create from controller to service

* Success is having no errors

* Confirm http status successful

* V1 API endpoint for Create Reaction

* Actually reset cache count

* Tweak JSON response

* Reaction create -> toggle

* Try rswagger docs for reaction toggle
2022-08-24 17:02:34 +02:00
Fernando Valverde
808149a424
Remove api_v1 feature flag (#18213) 2022-08-23 16:00:08 -04:00
Joshua Wehner
31296499da
Extract reaction create from controller to service (#18350)
* Extract reaction create from controller to service

* Success is having no errors

* Confirm http status successful
2022-08-23 10:09:47 +02:00
Fernando Valverde
2ad02cf31c
API v1 without api key restriction (#18340)
* Remove :api_v1 feature flag

* Reworking the auth configs throughout V1 + specs

* Fix remaining v1 specs

* Enhanced inline docs

* deprecation warning update

* Use headers variable for most v1 specs

* Cherry pick spec changes

* Fix specs

* group let! statements - rubocop

* Bring back ||= on api v1 authentication methods

* Bump swagger/v1/api_v1.json
2022-08-19 14:04:41 -06:00
Joshua Wehner
3f6cc95f79
Try context-based sorting for username search (#18311)
* Try context-based sorting for username search

* Use the search

* Comment cleanup

* Working on specs for new context behavior

* Front-end provides context

* Try refactoring away from class-level methods

* Comments don't always have context

* Try refactor query to avoid joins and get under timeout

* If we stub the request, the tests might work

* Cleanup unused join fragments
2022-08-18 17:08:46 +02:00
Anna Buianova
ad270fc842
Fix updating articles from scheduled to published (immediately) (#18331)
* Fixed publishing scheduled articles when removing published at date

* Fixed specs for editor v1
2022-08-15 08:53:31 -04:00
Joshua Wehner
445fd0f9e5
Try renaming moderator -> super_moderator (#18261)
* 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>
2022-08-10 16:43:30 +02:00
Suzanne Aitchison
f1df37f431
Add "only display when logged out" as an option on Navigation Links (#18275)
* add new column with enum value

* refactor to use display_to column

* add some more specs to application_helper

* test for the backfill DUS

* fix line length

* refactor
2022-08-08 10:55:24 +01:00
Josh Puetz
74e44aeb61
Documentation for Negative Behavior APIs (#18187)
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-28 14:30:32 -05:00
Arit Developer
450af1cd45
Redeploying the Flag/Unflag User functionality (#18235)
* 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>
2022-07-28 09:03:37 -04:00
Arit Developer
3fa350c7f2
Revert "Relocate and Refactor "Flag User" Action (#18182)" (#18232)
This reverts commit 8f544ab6ed.
2022-07-27 12:10:22 -04:00
Fernando Valverde
c93062b3cf
Add missing action of comment deletion in unpublish API endpoint (#18202)
* Add missing action of comment deletion in unpublish api

* reorganize controller action + inline comments

* Improve spec to check for AuditLog integrity
2022-07-27 09:18:18 -06:00
Arit Developer
8f544ab6ed
Relocate and Refactor "Flag User" Action (#18182)
* 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>
2022-07-27 10:47:17 -04:00
thejwuscript
9bc0d83130
Fix reply button visibility on locked discussion (#18023)
* Add specs for unlocked discussion

* Add specs for locked discussion

* Edit wording for discussion lock specs

* Set instance variable on CommentsController

* Fix legacy comments index view

* Empty commit - Trigger CI

* Modify test assertions

* Add data-testid attribute to reply button

* Add cypress custom command createComment

* Add cypress specs for locked discussion

* Add cypress specs for unlocked discussion

Co-authored-by: Fernando Valverde <fernando@fdo.cr>
2022-07-27 09:29:55 +01:00
Mac Siri
0c8fc2ea0d
Update WelcomeController's daily_threads query (#18203) 2022-07-26 10:03:16 -04:00
Arit Developer
253cb27559
Refactor :moderation_routes? method to use correct policies (#18183)
* complete implementation

* add spec coverage; remove test-db cleansers
2022-07-25 07:58:41 -04:00
Fernando Valverde
f77b5f83a9
Include audit log for API admin endpoints (#18167)
* First commit for audit log - specs need fixing

* Fix notification subscription issues + specs

* Use single line in notification subscribe initializer

* Remove conditional in unpublish endpoint
2022-07-22 11:35:30 -06:00
Anna Buianova
656d698da1
Modify datetime picker for scheduling articles (#18153)
* Accept separate date and time for published_at

* Separate date and time inputs for published_at in post options (scheduling)

* Removed the commented line

* Removed unused htmlFor publishedAt

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Added aria-label for published at date

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Added aria-label for published at time

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Added htmlFor for schedule label

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-21 13:53:54 +03:00
Fernando Valverde
0d942e6161
API V1 skip authenticity token validation (#18142)
* Skip authenticity token on API V1

* Test execution experiment - should fail

* Fix specs test

* Remove listings v1 controller before_action hook
2022-07-20 07:51:33 -06:00
Joshua Wehner
9bd93602ba
Admin can attach user via username (#18056)
* Admin can attach user via username

* Formatting

* Match @username as seen elsewhere

* Matching for accessibility

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Formatting cleanup after merge

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-18 14:17:45 +02:00
Fernando Valverde
c6c39813a1
New suspend user API endpoint (#18043)
* New suspend user API endpoint

* Restrict admin access only to suspend action

* Add suspended? check on new endpoint spec

* Replace POST with PUT action

* Replace redundant response payload with empty 200 response

* Rely on user_policy instead of before_action method

* Use alias with matching method name instead of unpublish

* Use already existing toggle_suspension_status? method in policy

* Remove manual creation of note

* Update suspend success spec
2022-07-15 09:07:57 -06:00
Josh Puetz
6f135a46b1
Add 299 warning messages for V0 api requests when v1 is enabled (#18092) 2022-07-14 14:28:52 -05:00
Fernando Valverde
5df1855103
Unpublish comments+articles by user id in API v1 (#18058)
* unpublish comments+articles by user id in API v1

* Update spec/requests/api/v1/users_spec.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Rely on user_policy instead of before_action method

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-07-14 11:47:44 -06:00
Suzanne Aitchison
5e8fae9ddc
Member index: Filter by status (#17980)
* show the statuses in the modal

* filter the results

* add some todo around good standing

* Enable Rails framework 7.0's isolation_level, partial_inserts, & raise_on_open_redirects (#17970)

* Member index: Show applied org filters (#17977)

* show applied org filters

* correct casing

* API V1 transition (#17835)

* API Articles v0-v1 restructure

* Remove unused helper

* Bulk move API controllers into concerns + add V1 controllers

* Extract API routes + some fixes

* Fix v1 api_controller authenticate! + add more article_controller specs

* Completed spec/requests/api/v1/articles_spec.rb

* specs up to listings

* All v1 specs except for 9 skips

* mime_types cleanup + authenticate! relocation

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>

* Fix email confirmation logic when registering via Omniauth (#17878)

* Move .skip_confirmation! call to .find_or_create_user! method

* Add regression tests to avoid email confirmation delivery

* Keep the original place where we had user.skip_confirmation! too

* Update logic to require email confirmation from omniauth

* test confirmation is required with SMTP

* Keep :notice instead of :global_notice

* Forem Account bypass email confirmation reorg

* inline comment reorder + clarification

* Apply suggestions from code review

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Member Index View Actions: "Adjust Credit Balance" (#17974)

* Adds the Adjust credit balance modal to index view

* Adds e2e tests for adjusting credit balances via modal

* Adds the ability to update credits to #user_status

* Adjusts the e2e to address failures

* Introducing a quick and dirty fix for abtests/admin (#17982)

This is a "quick and dirty" hack.  Do I like it?  No.  Do I want to delve
into further debugging/refactoring of [a 72 line method][1]?  Not at the
moment.  There are a few pathways forward, but for now, this is the
pathway to hopefully give us insight into the

**Why will this likely address the issue?**

Prior to this commit, for an experiment we would render each of the
goals (anywhere from 8 to 11); each of which would require 2 expensive
queries; which means about 16 expensive queries.

After this commit, the experiment page has none of those expensive
queries; instead each goal now runs the 2 expensive queries.

The hope is that this will help us show the results (albeit on multiple
pages) while coming in under the response time out handlers we have in
place.

**Why no tests?**

Ugh; I know right?!?  I'm beginning to ask that myself.  But for now,
because this is only visible to tech_admins, the consequences of
breaking are limited.  In otherwords, this is not a customer facing
feature, so it can be a bit less robust in it's testing.  At least
that's the rationalization I'm establishing.

Further, local tests would not reveal the production environment
complications of large data sets.  The aforementioned expensive queries
are blisteringly fast on my local machine...in part because I don't much
field_test experiment data.

Closes forem/forem#17981

Related to:

- forem/forem#17895
- forem/forem#17869

[1]:ab2d7d29d0/lib/field_test/experiment.rb (L98-L160)

* Adding test for redundant roles

* Adding filter for roles

* forget about good standing status

* remove good standing specs

* Update app/helpers/admin/users_helper.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* appease rubocop

* simplify

* add e2e tests

* add the applied filter pills for status

* make sure clear all button shows

* add a comment to explain good standing

* tweak

* set the registered dates of test users

Co-authored-by: Mac Siri <mac@forem.com>
Co-authored-by: Fernando Valverde <fernando@fdo.cr>
Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-07-14 17:32:31 +01:00
Suzanne Aitchison
76c7932b09
Member index: Filter by joining date (#17975)
* add the date picker into view

* allow date picker to overflow modal

* allow aria labels to be passed to inputs

* filter records

* add missing comment

* set earliest date

* specs and a small fix

* cypress spec

* fix typo

* tidying up

* fetch date_format

* commit code review suggestion to params

* Revert "commit code review suggestion to params"

This reverts commit 84fb0e0d3acc13257a362eb41c17b2bb8089606a.

* show added filter pill

* add cypress specs for applied filters

* woops! fix unintended change to filter code
2022-07-14 14:52:42 +01:00
Joshua Wehner
5dee4a11c1
Allow trusted user to access response templates (#17978)
* Allow trusted user to access response templates

* Add request specs for trusted user templates

* WIP: was just investigating...

* Move permission check to authorizer

* Revert "WIP: was just investigating..."

This reverts commit c38c60f7ab19ce43c174729c2542a9041e9322e2.

* Improved accessibility

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-12 11:37:59 +02:00
Fernando Valverde
b8abbda72e
Unpublish post service class + V1 API endpoint (#18031)
* Unpublish post service + API

* Apply PR feedback

* Use module_function on service class
2022-07-08 09:08:55 -06:00
Anna Buianova
ff76cdd3c5
Scheduling articles (#17939)
* Article query spec for scheduled articles

* Added scheduled article badge on the user dashboard

* Added published_at field to editor options

* Accept and validate published_at from editor

* Refactor published_at validation

* Allow 1-minute difference in published_at

* Notice on an unpublished article page

* Added specs for 'Click to edit' link on scheduled article preview page

* ContextNotification model

* Articles::Publish worker

* Added specs for articles publish worker

* Schedule publish articles worker

* Added tests to check for scheduled posts in feeds

* Don't allow managing scheduled articles

* Don't send notifications for scheduled articles

* Set published_at in Articles::Updater when publishing

* Published_at value in post options

* Pass timezone and set published_at accordingly

* Limit setting published_at to the future

* Readonly published_at for articles that were already published

* Chagning published_at format in editor v1 (start)

* Changed published_at format in frontmatter, specs

* Added specs for updating published_at from frontmatter

* Fixed accepting past published_at for articles published_from_feed

* Enabled published_at validation: don't allow updating published_at for already published articles

* Validate published_at on create

* Added a spec for updating published_at for exported articles

* Fixed specs related to creating articles with past published_at

* Fixed specs related to past published_at for articles

* Added a hack so that admins would be able to update published_at

* Switch button text schedule/publish when changin publishedAt

* Fixed saving published_at with timezone

* Added a feature flag for scheduling articles

* Default text in markdown editor depends on feature flag

* Enable article editor cache again

* Fixed the default value in the markdown editor

* Fix sitemaps spec

* Removed tooltip

* Fixed articles update specs

* Added missing locales

* Fixed article create specs

* Fixed spec

* Removed commented code

* Returned enabling extensions in the schema

* Returned accidentally deleted constraint

* Make articles query spec more stable

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Removed commented code

* Removed unused code

* A clearer policy

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Use StringInquirer for article current state

* Added a note and todo to articles factory past trait

* Remove duplicated PropType

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Refactor query in the Articles::PublishWorker

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Refactor articleForm.jsx

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Removed specs that are no longer relevant

* Removed useless onKeyUp on a hidden input

* Refactored articleForm

* Hide scheduling from post options when published_at is readonly

* Run sends notifications worker every 5 minutes instead of every minute

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-07-07 17:32:49 +03:00
Anna Buianova
6a229f00b7
Fixed removing notifications on admin unpublishing (#18047) 2022-07-06 18:35:20 +03:00
Dwight Scott
50e2131079
mod panel update unpublish all posts action 17709 (#17923) 2022-06-27 16:50:31 -04:00
Arit Amana
750d379807
Allow ModRole & Admin to Suspend & Unsuspend User (#17946)
* gotta commit at some point

* out of gas

* IT'S WORKING NOW! 💥

* Cypress tests

* fix Travis failures

* incorporate PR review suggestions

* fix one failing Cypress test

* update API call

* add Unsuspend flow; fix Travis failures

* add tests for unsuspend flow

* remove unnecessary atrribute

* add article_policy spec

* fix failing Travis

* nudge Travis

* fix apparent typo  o o 🤷

* refactor a bunch of duplication

* nudge Travis

* fix Cypress failure related to authorizing moderator for user_status action

* rename modal partial

* remove unnecessary button-exists check

* address PR review suggestions

* hide suspend user btn after action

* toggle btn based on author suspension status

* add data-testids

* use data-testids

* controller refactor
2022-06-27 12:45:35 -04:00
Jeremy Friesen
b8533172e3
Introducing a quick and dirty fix for abtests/admin (#17982)
This is a "quick and dirty" hack.  Do I like it?  No.  Do I want to delve
into further debugging/refactoring of [a 72 line method][1]?  Not at the
moment.  There are a few pathways forward, but for now, this is the
pathway to hopefully give us insight into the

**Why will this likely address the issue?**

Prior to this commit, for an experiment we would render each of the
goals (anywhere from 8 to 11); each of which would require 2 expensive
queries; which means about 16 expensive queries.

After this commit, the experiment page has none of those expensive
queries; instead each goal now runs the 2 expensive queries.

The hope is that this will help us show the results (albeit on multiple
pages) while coming in under the response time out handlers we have in
place.

**Why no tests?**

Ugh; I know right?!?  I'm beginning to ask that myself.  But for now,
because this is only visible to tech_admins, the consequences of
breaking are limited.  In otherwords, this is not a customer facing
feature, so it can be a bit less robust in it's testing.  At least
that's the rationalization I'm establishing.

Further, local tests would not reveal the production environment
complications of large data sets.  The aforementioned expensive queries
are blisteringly fast on my local machine...in part because I don't much
field_test experiment data.

Closes forem/forem#17981

Related to:

- forem/forem#17895
- forem/forem#17869

[1]:ab2d7d29d0/lib/field_test/experiment.rb (L98-L160)
2022-06-24 09:26:46 -04:00
Julianna Tetreault
ec55329a3a
Member Index View Actions: "Adjust Credit Balance" (#17974)
* Adds the Adjust credit balance modal to index view

* Adds e2e tests for adjusting credit balances via modal

* Adds the ability to update credits to #user_status

* Adjusts the e2e to address failures
2022-06-23 14:30:10 -06:00
Fernando Valverde
1eafd7388e
Fix email confirmation logic when registering via Omniauth (#17878)
* Move .skip_confirmation! call to .find_or_create_user! method

* Add regression tests to avoid email confirmation delivery

* Keep the original place where we had user.skip_confirmation! too

* Update logic to require email confirmation from omniauth

* test confirmation is required with SMTP

* Keep :notice instead of :global_notice

* Forem Account bypass email confirmation reorg

* inline comment reorder + clarification

* Apply suggestions from code review

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2022-06-23 16:26:26 -04:00
Fernando Valverde
8c836430ca
API V1 transition (#17835)
* API Articles v0-v1 restructure

* Remove unused helper

* Bulk move API controllers into concerns + add V1 controllers

* Extract API routes + some fixes

* Fix v1 api_controller authenticate! + add more article_controller specs

* Completed spec/requests/api/v1/articles_spec.rb

* specs up to listings

* All v1 specs except for 9 skips

* mime_types cleanup + authenticate! relocation

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
2022-06-23 14:26:00 -06:00
Mac Siri
2f029fe896
Enable Rails framework 7.0's isolation_level, partial_inserts, & raise_on_open_redirects (#17970) 2022-06-23 10:30:58 -04:00
Suzanne Aitchison
d57e4cabb7
Member index: filter by organizations (#17943)
* show the organizations checkboxes

* apply clear filter button and indicator

* filter by org in users query

* add some rspec tests

* add cypress specs

* correct cypress spec

* Fixing UsersQuery to ensure singular user by organization

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
2022-06-21 13:32:50 +01:00
Joshua Wehner
07e1364f54
Trusted users can view & use moderator response templates (#17867)
* Trusted users can use moderator response templates

* Iron out container reveal logic

* Explanatory comment on controller endpoint confusion
2022-06-16 14:05:49 +02:00
Jeremy Friesen
b4f17ed7dc
Allowing UserQuery to filter on multiple roles (#17919)
I had looked at using `User.with_any_roles` but that creates one User
query per role passed.  Which is not ideal, given that we want to have
an ActiveRecord::Relation object on which we'd paginate.

This adjustment does it's best to mimic Forem's role structure and
adhear to how Rolify builds the underlying query.

An astute reader will notice that in these specs we use `role: "admin"`
and `roles: ["Admin"]`; the primary reason relates the user interface
being worked on in forem/forem#17884.  It is my understanding that the
`role` approach and `roles` approach will be separated by a feature
flag (we're rolling out the `roles` approach).

Related to
- forem/forem#17491
- forem/forem#17884
2022-06-15 08:50:03 -04:00
Arit Amana
d15d36da54
Allow Moderator Role to adjust post tags (#17858)
* building

* Implement flow; tests pending

* complete backend work

* add e2e tests

* fix error in specs

* address Pr review comments

* add specs for article_policy changes

* method refactor

* refactors

* add max_tag_List_size constant

* destroy all test tags

* test db cleaned!

* COMPLETED T THE SPECS!!! 💃💃

* optimization

* reverse "optimization" 😅
2022-06-14 10:55:19 -04:00