* Add fakeredis gem
* Mock Pusher::PushNotifications in specs
* Remove Redis from Travis
* Add Android tests to ConsumerApp specs
* Use mock for push notification tests and refactor ConsumerApp and Device code
* Fix remaining broken specs
* Use symbols
* Cleanup rpush helpers
* Pusher::PushNotifications is no more
* Use human friendly platform in Admin::ConsumerApps index page
* Add tsvector index on listings
* Fix sorting order when fetching tag flares
* Add published_at as a sorting condition for Homepage::ArticlesQuery
* Re-added param needed by ES, this got lost somewhere down the line
We can't rely on the database returning published articles in ID
order, since there are indexes on published_at and on published which
could very well be in any order (btree), and no explicit `ORDER BY id
ASC` was in the query.
I checked the query that's run in the test against blazer, and confirmed that under
real conditions the results are pretty far from ordered:
```
SELECT articles.id FROM articles WHERE (published_at <= '2021-04-27') AND articles.published = true LIMIT 10 OFFSET 0;
----
id
166916
637099
132444
431420
501939
141182
565391
515964
146231
677241
```
Change the expectation to assert Article does not receive :order, and
remove the expectation that the ids are returned in the order created.
* Re-order test cases to increase tests readability
* Add user_id filter for articles query
* Add organization_id and tags filters
* Add new params to SearchController#feed_content
* Add current_user param so that it can be tested for a small pool of users
* Revert change to options hash within Articles::ActiveThreadsQuery#call
- Reverts double splat change back to options hash
- Reverts changes to active_threads_query_spec.rb options
* Adds another check for tags to Articles::ActiveThreadsQuery#call
- Adds a .tags.present? check to #call
- Removes redundant and broken relation from #call
* Reverts change to options hash within _sidebar_additional.html.erb
* Removes before block from active_threads_query_spec
* Moves tag filter before conditional in Articles::ActiveThreadsQuery#call
- Adds before block back to active_threads_query_spec for proper
testing of filtering of tags within spec
* Adjust options to use new kwargs in Articles::ActiveThreadsQuery
- Adjust active_threads_query_spec to use new args
- Remove useless code from Articles::ActiveThreadsQuery
* Adjust published_at in else block
* Rename banned and comment_banned roles
* Add data update script to rename roles containing 'ban'
* Add named error for Suspended users
* Update unidiomatic method names
* Rename misc banned to suspended
* Apply suggestions from code review
Co-authored-by: Michael Kohl <me@citizen428.net>
* Add unit tests for suspended methods
This commit also adds TODO comments for removing banned and
comment_banned from the codebase after data update scripts have
successfully run on all of our Forems.
Co-authored-by: Michael Kohl <me@citizen428.net>
* Adjust active_threads class method to display posts in homepage sidebar
* WIP: add specs around active_threads class method
* Uses newer AR query syntax in Article#active_threads
* WIP: Updates article_spec.rb to get tests passing
* WIP: Adjust test to return articles that dont fall into constraints
* Adjusts spec to update articles properly
* Adjust article.update_columns to match initial article columns
* Extracts .active_threads into a query object and removes class method
- Removes class method from Article model
- Removes class method tests from article_spec.rb
- Adds Articles::ActiveThreadsQuery to app/queries/articles
- Adds active_threads_query_spec.rb to spec/queries/articles
- Replaces Article.active_threads with Articles::ActiveThreadsQuery
in _homepage_content.html.erb and _sidebar_activity.html.erb
- General code clean up
* Rename number to count in Articles::ActiveThreadsQuery
* WIP new specs
* Update spec
* Repleaces let! with before block to appease rubocop
* Refactors Articles::ActiveThreadsQuery#call per PR review suggestion
* Calls Articles::ActiveThreadsQuery within articles_helper instead of view
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
* Makes the ModeratorsQuery not return an exception on invalid role
The current implementation of the query would yield an exception when
recieving an invalid state parameter. As per the [GH issue
discussion](https://github.com/forem/forem/issues/10060#issuecomment-692295217),
Zhao recommended to change its behaviour and not trigger an exception in
this condition.
This commit does just that. If the state argument is invalid, the query
now returns an empty result set.
* Adds a warning when there are no matching mods
* Re-trigger the build
* First draft - all the big changes
* Changing some more references to 'internal'
* Relocate internal request tests to admin
* Relocate internal system tests to admin
* Fix trailing space
* Test fix
* Move queries from internal to admin
* Docs updates
* Rename internal stimuls controllers to admin (plus docs)
* Rename admin layout
* Fix routing after rebase
* Fixes for latest added admin interfaces
* Serviceworker ignore paths