* Move calculating comments score from worker to a service
* Display displayed comments count in feed
* Recalculating displayed comments counts on article show (if needed)
* Rubocop fixes
* Fixed lambda
* Comment counts for signed in users
* Adjust comments count for articles
* Fixed counts for signed out users, added specs for Comments::Count
* Fixed counts for signed out and added specs for Comments::Count
* Removed debug info from the view
* Removed separate count for signed out users
* Remove irrelevant specs
* Remove unused scope
* Add downstream score effects from spam role
* Move async score calc down low
* Add tests
* Add stub
* Fix typo
* No need for guard
* No need for guard
* Try suppressing all negative-follow tags
* userData isn't always available
* Bolster test coverage for tag filter scenarios
* Antitags for the non-basic 'strategy'
* Rename antitags -> hidden_tags
* Rename 'anti_tags' -> 'hidden_tags' as well
* Use userData.followed_tags to derive hidden_tags
* Renamed display ad variables and constants
* Renamed display_ads associations
* Fixed variable name in display ads
* Renamed display_ads variables in views
* Fixed admin billboard view spec
* Fixed variable name in FilteredAdsQuery
* add migrations
* add countries gem?
* first pass at location model
* specs ✨
* add location to filtered ads query
* feature flag and nicer errors
* cosmetic fixes
* more tweaks (remove unnecessary index, add initializer)
* feat: fix of there is no article
* feat: set the feed order in a data structure rather than in a view
* feat: update yarn.lock
* feat: push the items to the array
* feat: update feed to only show billboards if we have the correct length of items in the feed
* fix: organizedFeedItems.legth
* feat: rename 'featured' to 'image'
* feat: rename 'featured' to 'image'
* feat: rename 'featured' to 'image'
* feat: add some utilities for the feed that we can use in the FeedTest
* feat/WIP: the setup for the feed tests and a first working test
* test: imageItem
* fix: the podcasts can be passed through as an array of objects in the feedItems so that they can be grouped in one card
* feat: remove podcastEpisode state and the attribute in the object
* fix: check that the items exist before trying to slice them
* feat: setup the userdata and the podcast data in the test
* whoops - commit the podcast episodes
* feat: write soem more tests for the feed and including the podcasts
* feat: add some more tests
* feat: add more billboards tests to chcek the order of stuff
* feat: set the timeframe not empty
* feat: update the logic for organizaed feed by inserting the last on first
* doc: jsdoc for functions
* refactor: break the code up into smaller functions
* refactor: make the code more readable and easier to follow
* refactor: pull function out into a utlity
* feat: add specs to utility
* feat: chcek if pinned post
* test the latest timeframe correctly
* chore: update var name
* move the podcast items out of the object clause
* feat: update text
* feat: add a pack file that duplicates initializeDisplayAdVisibility
* feat: create callbacks that will help us to determine when the feed has been rendered so that we can observe the dsplay ads accordingly
* chore: rename to billboards instead of display ad
* feat: abstract out a function that will work for any tagged resource and also limit the article tags within a scope of the article_id
* feat: update the spec for the previous changes
* feat: write tests for the user_tags
* feat: add user_tags to for_display adn the query
* feat: add user_tags to the endpoint where we query the tags to send it through to for_display
* feat: pass through the suer tags to the async request
* feat: update the user_tags fiter query + tests
* feat: update the admin view to show targeted tags on the new feed option billboards too
* feat: add tests for targeted tags field on admin
* refactor: consolidate all of the options into one
* feat: move comment close to attribute
* feat: use a helper method
* feat: include helper on ads query
* feat: move the query from the frontend to live on the backend
* feat: first pass at some error handling whilst maintaining the order of the items
* test: for feed error
* feat: abstract out some code
* update the feed items for errors
* chore: comment
* feat: update the variable names
* feat: update honeybadger message
* feat: update the name of the variable
* refactor: do not conflate the duty of the untagged_ads
* refactor: rename the variables + add note for clarity
* fix: update var
* Prepare: relocate user suggestions
* Prepare: relocate users suggestion service -> query
* Organization query for orgs with above-average scores
* Rubocop
* Limit to last 3 weeks
* Tweak recent scope, limit to 5 orgs
* Onboarding routes are also always JSON
* Divide by zero makes NaN means
* Add Orgs suggester into suggestions
* Rubocop
* select distinct orgs
* Fix for weird edge-case with bad local data
* Include type_identifier in JSON payload
* Update follows API to allow org_ids as input
* Update onboarding front-end to distinguish users/orgs
* Fix: i18n issues
* Fix: type_identifier in json output
* Fix: distinct is weird
* Fix: JS linter
* Continue tweaking front-end
* Audit import order
* Cleanup @todo note
* Try renaming controller action
* Move Article average calculation to postgres and fix math
* Refactor decorated type_identifier
* Refactor SuggestProminent, return more orgs, fix spec math
* Use FeatureFlag for organization suggestions
* This might fix the jest
* Onboarding suggested tags should include supported
* Migrate tags to add suggested boolean column
* Use new suggested attribute
* Sync Settings.suggested_tags with new form setting
* Better sort order
* Test logic update
* Add a little comment
* feat: add the ./wellknown/ai-plugin.json file
* feat: add a logo
* feat: firts attempt at open_api file with endpoint we thought we'd use
* feat: add a search action to teh articles controller that build up teh appropriate json
* feat: add a query param to the article index
* feat: add some chatgpt endpoints and file paths to CORS
* feat: update the openapi yml file to reflect the article search endpoint
* fix: use the correct concept
* feat: replace the logo
* feat: update the ai-json file
* feat: update the openapi file
* feat: update the api and it's params
* feat: update the search query
* fix: ordering
* feat: cors debug
* fix: logic with markdown
* chore: fix test
* spec: article
* spec: article
* spec: article
* Update public/.well-known/ai-plugin.json
* Update public/openapi.yml
---------
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
* Refactor for_display to pass article instead of params
* Refactor: use options in FilteredAdsQuery, deconstruct article in DisplayAd.for_display
* Typo
* Restore applicable comments
* Trying some models for audience segmentation
* AudienceSegment basics
* Attach AudienceSegment to DisplayAd
* Possibly use a DUS to populate AudienceSegments
* Add to display ad form UI
* Add to display ad API
* Refresh strategy for audience segments
* Add user_id to async ads query
* Maybe :testing -> :manual, for no-refresh segment
* Test & tweak segment refresh
* Testing audience_segment#refresh logic
* Coverage: testing human_readable
* Scope segment refresh to recently active users
* Tweak logic for when to refresh
* Tweak experience levels to match SettingsHelper
* Test for front-end logic
* Fix test, hope this helps coverage?
* Better test names
* One worker for all, many workers for each, perform_bulk
* Fix audience segment UI, needs to use id, not enum
* cron/schedule should RefreshAll
* Singular id in RefreshWorker
* Add exclude_article_ids int array
* Add specs, normalize inputs better
* Add to form & controller
* Add exclude_article_ids to DisplayAd API
* Use exclude_article_ids in query
* Rubocop
* Comment typo
* Tweak rspec example length config
* Arguments all the way down
* Typo
* Update spec/requests/api/v1/docs/display_ads_spec.rb
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
* Update spec/requests/api/v1/docs/display_ads_spec.rb
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
* Swagger schema for Display Ad
---------
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
* Update FilteredAdQuery to better support community ads
* Maybe organization_id could be blank?
* Try an explanatory comment for filter ordering
* Update app/queries/display_ads/filtered_ads_query.rb
Co-authored-by: Anna Buianova <lightallloy@gmail.com>
* Rubocop
* Tidy up type matching logic
---------
Co-authored-by: Anna Buianova <lightallloy@gmail.com>
* Users can only opt-out of external ads
* Move random sampling out of FilteredAdsQuery
* Refactor filtered_ads_query_spec
* Add test for new permit_adjacent setting
* Rubocop
* Use permit_adjacent_sponsors on article sidebar and post-comments
* Remove, unused
* Update copy
* type_matched -> type_of_ads
* Remove non-applicable test
* feat: update the bullet safe list and add eager loading with organizations
* feat: add an indicator round for promoted
* feat: update the css
* feat: add il8n
* fix: styling changes
---------
Co-authored-by: Joshua Wehner <joshua@forem.com>
* Users can only opt-out of external ads
* Move random sampling out of FilteredAdsQuery
* Refactor filtered_ads_query_spec
* Add test for new permit_adjacent setting
* Rubocop
* Use permit_adjacent_sponsors on article sidebar and post-comments
* Remove, unused
* Update copy
* type_matched -> type_of_ads
* Remove non-applicable test
---------
Co-authored-by: Ridhwana <ridhwana.khan16@gmail.com>
* Revert "(Temporarily) Remove multiple reactions from #index (#19142)"
This reverts commit a45d300639.
* Clean up reaction category count mechanism for #index
* Remove, unnecessary
* Expose reaction categories in JSON response
* Update test with new categories
* Fix flaky sample / minimum floor
* buildArticle (infinite scroll) with multiple reactions
* If we're doing #index front-end, we aren't feature-flag'd
* nbsp
* react (home feed) has multiple_reactions
* Update app/assets/javascripts/utilities/buildArticleHTML.js
Co-authored-by: Rajat Talesra <rajat@forem.com>
* Clean up Reactable#reaction_categories
* Use 'multiple_reactions_icons_container'
* Try adding a ReactionCount test
* Adapt memory fix from 76dd53d
* Try adding categories to fixture
* Attempt to eager-load distinct public categories
* Setting dependent to the default for rubocop
* Try making image assets more public?
* Revert "Fix flaky sample / minimum floor"
---------
Co-authored-by: Rajat Talesra <rajat@forem.com>
Co-authored-by: Mac Siri <mac@forem.com>
* chore: rubocop
* feat: rename the worker in accordance to our guidelines and to be more verbose
* refactor: move the NotificationsModeration service to be a users query, and move the constants out to new files
* refactor: removed subscribed_to_mod_roundrobin_notifications? which was only being used once in a test
* refactor: remove the aliass from the user method and add them to notification_setting + update references
* feat: sample relevant ads display ads
* Remove jQuery
* Added jquery back to videos
* refactor: pass the relevant paramenters to the newly created service, move the code over to the service, pass through display ads, use the display ads parameter for queries, use instance vars
* refactor: approve and published display ads
* feat: tagged post comment ads
* refactor: display_ads for tagged postcomments
* refactor: authenticated ads
* refactor: sample ads
* fix: oops pass teh parameter)
* refactor: use ... to forward and delegate arguments to the method
* feat: use a filtered_display_ads instance variable in the service instead of passing the relation variable around
* feat: make sure that the instance variable stays upto date
* feta: update the header for comment
* feat: remove the service test for now
* refactor: change the names to make it more readable
* feat: use named parameters
* refactor: we are ordering by success rate just before we sample so why order twice
* chore: remove the reader
* refactor: move into two separate functions
* fix: rename placement_area_ads
* refactor: user_authentication_ads
* Update app/services/display_ads/sample_relevant_ads.rb
Co-authored-by: Joshua Wehner <joshua@forem.com>
* Removed jquery code
* Nit fix
* Revert incorrect code
* Updated jquery code to javascript
* Removed jquery from comments
* refactor: move to query and rename
* chore: move params on diff lines
Co-authored-by: rt4914 <rajattalesra4914@gmail.com>
Co-authored-by: Joshua Wehner <joshua@forem.com>
Co-authored-by: Rajat Talesra <rajat@forem.com>
* Query audit_log + target records for display in the member manager
* Display information about logged unpublished articles and comments
* Display information if the post was republished
* Added specs for unpublish_log tab on user's page in the member manager
* Fixed specs
* Change the wording for displaying info about unpublish all actions
* 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>
* 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.
Closesforem/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>
* 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
* 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>
* prevent ID conflicts in filters modal by caching content
* show roles with expandable section
* minor tweak
* don't use the hidden field
* send array of role
* role -> roles. small refactor
* set initial checked status
* show an indicator when a filter is applied
* add JS to toggle filter clear buttons and indicators
* update some comments, make sure users only appear once in list
* add some cypress specs, fix some bugs
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