Commit graph

432 commits

Author SHA1 Message Date
Philip How
3ceb9a178a
Allow some badges to be awarded multiple times (#20876)
* Add migration, update badgeachievements model and admin view to set flag on badges

* Show multiple badges on profile

* update factory

* badge model validation

* safe navigation to badge?

* add null: false to migratrion
2024-04-23 16:33:43 -04:00
Philip How
ed837eb5b8
add timestamp to users roles table (#20844) 2024-04-09 14:25:51 -04:00
Anna Buianova
51316c747f
Comments count according to display rules in feed (#20753)
* 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
2024-03-28 12:12:05 +00:00
Ben Halpern
a30b86a025
Allow billboards to target specific pages with "fixed bottom" placement (#20748)
* Add page fixed bottom billboard

* Add page fixed bottom billboard

* Fix schema
2024-03-15 14:32:30 -04:00
Ben Halpern
f2968baadb
Add optional client-side dismissal SKU for closable billboards (#20716)
* Add optional client-side dismissal SKU for closable billboards

* Safe nav
2024-03-01 16:13:19 -05:00
Ben Halpern
78f9bec3e7
Allow admin to declare whether to include the badge description in message (#20684)
* Allow admin to declare whether to include the badge description in badge achievement message

* Update spec/services/badges/award_spec.rb

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

* Add proper acceptance to tests

* Tweak tests

* Switch to kwargs

* Clean up test acceptance

* Change interface

* Update spec/requests/admin/badge_achievements_spec.rb

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

* Update app/services/badges/award.rb

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

* Adjust interface

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-28 11:02:58 -05:00
Ben Halpern
205aee8c78
Add billboard for bottom of page with allowance to delay until after reading is finished. (#20616)
* Add delayed behavior

* Add special behavior to billboards

* Fix order for test

* Test clicking outside element when close event is present

* Update app/javascript/packs/billboardAfterRenderActions.js
2024-02-13 11:56:32 -05:00
Philip How
33fd9836be
Add CSS as pages template option (#20512)
* add css as pages option

* don't forget schema

* fix test

* add api support
2024-01-12 15:35:38 +00:00
Ben Halpern
108d753d68
Add articles clickbait_score as factor in final feed ordering (#20493)
* Add articles clickbait_score

* Add attributes

* Fix field test config
2024-01-05 09:37:53 -05:00
Ben Halpern
e376e2b887
Add cookie requirement option for billboards (#20486)
* Add cookie requirement for billboards

* Clean up tests

* Fix up tests

* Adjust tests

* Adjust tests
2024-01-03 16:33:08 +00:00
Ben Halpern
f0673648c2
Add preferred_article_ids to billboards (#20437)
* Add preferred_article_ids to billboards

* Adjust query

* Refactor method

* Refactor method

* Fix input type

* Add feature flag
2023-12-18 19:20:56 +00:00
Anna Buianova
ca16a87a47
Upgrade ahoy_matey (#20404)
* Added index to ahoy_visits

* Upgrade ahoy_matey
2023-12-01 14:27:11 +00:00
Ben Halpern
347fd6d112
Recommended articles list (#20383)
* Add recommended articles list

* Adjust tests

* Adjust tests
2023-11-24 17:57:55 +00:00
Ben Halpern
eccd5fd9e3
Add custom_display_label to billboards and update API (#20355)
* Add a/b test for which comments to show in feed

* Adjust figure

* Started at

* Add custom_display_label to billboards and update API

* Add custom_display_label to billboards and update API
2023-11-15 09:57:39 -05:00
Ben Halpern
e7fc1bb0ce
Add article id and geolocation info to billboard events (#20329)
* Add article id and geolocation info to billboard events

* Confirm destroyed in rollup
2023-11-09 12:43:23 -05:00
Ben Halpern
b0cb5540c0
Add new render mode and template options for billboards (#20282)
* Add new render and template modes for billboards

* Add new fields to /admin

* Adjust test

* Adjust markup in form

* Add tests for script execution

* Add two script test

* Adjust scripts

* Adjust scripts

* Add new test

* Add new explicit tests

* Move JS functionaity around
2023-10-30 14:56:09 -04:00
Anna Buianova
b84a871187
Removed columns that were ignored earlier (#20253) 2023-10-19 12:22:40 -04:00
Anna Buianova
2fa55e4b34
Remove workshop_expirations column (#20250) 2023-10-18 13:21:45 +03:00
Ben Halpern
bc89cf3e38
Store browser accept language header on users (#20212)
* Store browser accept language header on users

* Change to tracking via user context

* Remove async info code

* First draft of spec

* Work out tests

* Delete dependents
2023-10-16 11:59:30 -04:00
Narender Singh
2a489210a2
Remove unique article title validation (#20031) 2023-10-05 14:59:50 -04:00
Ben Halpern
cadebde66f
Add feed_success_score and other count tallies (#20106)
* Add initial feed events score

* Add feed events score

* Clean up code styles

* Adjust how tests are run

* Fix conflicts

* Update app/javascript/articles/Feed.jsx

* Add additional feed events tabulation queries for more reliable eventual consistency

* Add additional feed events tabulation queries for more reliable eventual consistency

* Fix test logic

* Updates from feedback
2023-09-15 12:02:26 -04:00
Ridhwana
aa201060e8
Override Tag Moderation Actions (#20088)
* feat: remove the validation for the article_id and tag_name to be unique on a tag_adjustment

* chore: remove unique index

* feat: update the validate_tag method to align with the removal of unique indexes on the table

* feat: do not allow removal and addition of tags that were added/removed by admins

* spec: add tests for the tag_adjustment_spec

* fix: update the validation of tags

* spec: article validation

* spec: test the action_panel helper

* chore: amend language

* add styles

* Empty commit
2023-09-15 15:06:58 +02:00
Anna Buianova
aa5cb535fa
Add languages to User model (#20059) 2023-09-11 11:44:19 -04:00
PJ
3f7d1fbc1a
Create feed impression and click events (#20043)
* getting started: model setup

* basic controller action & spec

* somewhat working click events

* pick up on impressions

* there was an attempt at batching without duplicates

* (better) bulk upsert service

* fix specs?

* touch up feed events JS

* end-to-end specs??

* workers wip

* fix failing user delete spec
2023-09-11 13:32:36 +01:00
Ben Halpern
22f836edc2
Add priority weight to billboards (#20019)
* Add priority weight to billboards

* Rewrite query as activerecord

* Change naming from priority_weight to just weight
2023-09-05 16:04:18 -04:00
Ben Halpern
ec7adf56fe
Allow admins to set cover image height configs (#19936)
* Initial basic work

* Bulk of related work, including find/replace on the inputs

* Adjust some tests

* Adjust some specs

* Fix a few more tests

* Clean up tests

* Adjust tests

* Test fiddle

* Adjust crop back to be a param

* Update tests

* Set proper defaults

* Fix some styling

* Adjust enrichment logic and tests

* Adjust form JS

* Update test snapshot

* Clean up formatting

* Fix spec name

* Adjust some css and defaults

* Adjust translation for image provider options

* Switch from fill to fill-down

* Proper fallback image

* Fix tests

* Update app/services/images/optimizer.rb

Co-authored-by: Mac Siri <mac@forem.com>

---------

Co-authored-by: Mac Siri <mac@forem.com>
2023-08-21 13:25:16 -04:00
Josh Klar
7db08e34b8
ruby: Upgrade to v3.1.4 (pt. 2, app image) (#19912)
Co-authored-with: Josh Klar <josh@klar.sh>

Co-authored-by: Helio Cola <helio@tcard.io>
2023-08-09 14:18:13 -07:00
PJ
7be865b295
Feature-flagged support for filtering billboards by location (#19834)
* 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)
2023-07-27 18:13:26 +01:00
Ben Halpern
8335a37315
Language detection with CLD3 (#19756)
* Language detection with CLD3 POC

* Update spec/models/article_spec.rb

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

* Update spec/models/article_spec.rb

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

* Update spec/models/article_spec.rb

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

* Update spec/models/article_spec.rb

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

* Update spec/models/article_spec.rb

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

* Update spec/models/article_spec.rb

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

* Update app/models/article.rb

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

* Clean up tests

* Clean up tests

* Move language detection to service

* rubocop

* Update app/services/languages/detection.rb

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

* More linting cleanup

* Remove allow_any_instance_of

* Update tests to better exercise different paths

* Fix flaky spec

* Update spec/services/languages/detection_spec.rb

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

* Update spec/models/article_spec.rb

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

* Update spec/models/article_spec.rb

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

* Update spec/models/article_spec.rb

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

* Update spec/models/article_spec.rb

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

* Update spec/services/languages/detection_spec.rb

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

* Update spec/services/languages/detection_spec.rb

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

* Update spec/services/languages/detection_spec.rb

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

* Update spec/services/languages/detection_spec.rb

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

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-17 08:57:20 -04:00
Ben Halpern
e52d53bc42
Add index to billboard placement area (#19648) 2023-06-29 12:14:38 -04:00
Dhanujha R
c9902fce6a
Remove deprecated Organization's columns (#19396)
Co-authored-by: Lawrence <lawrence@forem.com>
Co-authored-by: Mac Siri <mac@forem.com>
Co-authored-by: Rajat Talesra <rajat@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2023-06-26 10:36:33 -04:00
Ben Halpern
479f7b6c6c
Add unique index constraint to segmented users (#19627)
* Add unique index constraint to segmented users

* Run migration

* Add de-duping query
2023-06-26 09:06:18 -04:00
Ben Halpern
5d6dc64245
Add ability to mark billboard (display_ad) as "priority" (boolean) (#19599)
* Add ability to mark billboard (display_ad) as "priority" (boolean)

* Fix invocation

* Update spec/models/display_ad_spec.rb

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

* Update spec/models/display_ad_spec.rb

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

* Update spec/models/display_ad_spec.rb

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

* Update spec/models/display_ad_spec.rb

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

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-06-12 16:28:15 -04:00
Ben Halpern
ca7c395bd9
Remove unique constraint from segmented users index (#19544) 2023-05-26 11:18:08 -04:00
PJ
795cfc3da0
Manual Audience Segments API write endpoints (#19476)
* add composite index to segmented_users table

* bulk queries for segmented users

* create segment endpoint

* adding and removing users

* deleting segments 😪

* fix time precision in specs

* api docs 🎉

* pluck improvements that couldn't be cherry-picked

* better service objects; also introduce batch upserting

* docs???
2023-05-25 20:37:18 +01:00
Joshua Wehner
6b80d99c1b
Update onboarding suggested tag logic (#19477)
* 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
2023-05-23 17:22:27 +02:00
Joshua Wehner
dc1ab81401
Allow DisplayAd to target users via audience segmentation (#19284)
* 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
2023-04-25 08:41:10 -04:00
Joshua Wehner
d3f8e127fa
Add an article exclusion list to Billboards (#19280)
* 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>
2023-04-05 09:10:22 -04:00
Joshua Wehner
c251f4000d
Add creator to DisplayAd (#19126) 2023-02-22 14:17:22 -05:00
Joshua Wehner
a83a4f4f17
Add 'type_of' to DisplayAds (#18716)
* Add 'type_of' to DisplayAds

* Try compressing public & approved columns
2022-11-17 10:18:55 +01:00
Ridhwana
010cc9f617
Add if_not_exists: true to migration (#18687) 2022-11-04 11:56:00 -04:00
Ridhwana
b2d24f291b
Display Ads: Target by Tag on Posts with matching Tag(s) on the user facing side (#18664)
* feat: Add a pack file that pulls in the MultiSelect Component

* feat: move the tags to its own component

* save tags

* refactor: create a getCSRFToken function in the packs files so that it can be used in the admin

* feat: import the new module in request.js

* feat: remove unnecessary id

* feat: first pass of csrf token test

* chore: update the test

* fix: csrf token

* feat: hide the enw functionality behinda  feature flag

* fix: loading form twice

* refactor: import for csrftoken

* chore: update the description of the function

* feat: use acts_on_taggable to craete a relationship between display_ad and tag

* feat: add a tag field to the display_ad form

* feat: add the selected tags from the multiselect autocomplete component to the input text field that references the tag_list

* feat: add the tag_list to the controller so that we can save it to the db with the display ad parameters

* feat: pull out the tag validation from the article and the display_ads into a concern

* feat: write soem tests for validating the tag on the display_ads model

* feat: add the tag_list as a hidden field

* feat: set the selected tags on edit

* feat: add a js class for the placement area

* feat: use the change in the dropdown to determine whether we show the tags field dropdown

* refactor: rename and brak up fucntions

* feat: show the tags field if the value of the placement area is already set

* fix: move if statement out of the change event

* feat: hide tags field and clear the tag list

* refactor: delete the display ads

* tests: ensure that we test the toggle

* fix:ensure that the tags on the hidden field show up as a string in the input field

* feat: update the jsdoc

* fix: no need to replace space with comma since we showing as string in form

* feat: update the name of the label

* fix: add hidden back

* feat: add cached_tag_list to displya_ads + the index

* feat: udpdate the schema

* refactor: move the scopes into the a module that can be re-used between display_ads and articles

* feat: account for showing display ads with the targeted tags that match the article

* feat: write a spec to show the correct ads based on the article_tags

* refactor: change TagListValidateable to Taggable and move out the not_cached_tagged_with_any scope

* test teh relationship between display ads and tags

* feat: write soem tests for validating the tag on the display_ads model

* chore: change empty to blank

* feat: will show display ads with no tags set if there are no article tags

* feat: add a newline
2022-11-03 15:51:51 +02:00
Anna Buianova
c60b41f025
Drop tables related to HtmlVariant tracking, ignore HtmlVariant.success_rate column (#18615)
* Removed code related to tracking html_variants

* Remove code related to HtmlVariant#find_for_test

* Remove spec for HtmlVariant#success_rate

* Ignore html_variants.success_rate

* Drop tables related to HtmlVariant tracking
2022-10-26 14:46:02 +03:00
Joshua Wehner
1fcafbbd41
Rollup service to compact DisplayAdEvent records (#18508)
* Restore DisplayAdEvents.counts_for

* Try a rollup service for DisplayAdEvent

* Schedule daily rollup worker for one month prior

* Refactor aggregator

* More testing for rollup

* Add test for rollup attribute fidelity

* DisplayAd success_rate based on counts_for
2022-10-19 16:21:47 +02:00
Ridhwana
29421d8fbb
✂️✂️✂️ Part 3: Remove Sponsorship Table (#18529)
* feat: remove initializeSponsorshipVisibility and related code

* feat: remove sponsorships from sidebar

* feat: remove sponsorships from the admin - route, controller, view, spec

* feat: remove the admin menu item

* feat: remove the i8n for admin sponsors controller

* feat: sponsorship decorator was not being used anywhere

* feat: sponsorship slack messenger was not being used anywhere

* feat: remove the sponsorship_headline that gets configures on the admin

* feat: remove the /sponsors page

* feat: remove renedring of single_sponsor partial and associated partials

* feat: remove the navigation link rake task for sponsors

* feat: remove sponsorship from tags

* feat: remove i8n constants used

* remove sponsor references in text to the privacy page

* feat: remove the sponsorship detail from the organization page

* feat: remove the sponsors css that was used for app/views/pages/sponsors.html.erb

* feat: remove the sponsorship i8n that was used in the slack messengers

* feat: swap out the decorators to use Article as an example

* feat: remove spec to show sponsors on home page

* feat: update the specs to use Article Decorator instead of the Sponsorship Decorator

* fix: use direct and not all

* fix: remove tests for tag sponsorship

* fix: remove organization sponsorship test

* feat: remove more i8n

* remove unused css from app/views/organizations/_sidebar_additional.html.erb

* feat: remove sponsorship relationship from tag and organization

* remove seed

* feat: remove all Sponsor related specs

* feat: remove model, associated i8n and specs

* feat: remove sponsor from navbar

* feat: add a guard clause if we're unable to constantinize the purchase_type

* feat; remove sponsorship related tests

* feat: remove sponsorship relationship

* feat: remov especs related to sponsorship

* feat: remove tag sponsorship validation

* feat: remove the sponsorship factory

* feat: drop the sponsorships table
2022-10-06 16:30:48 +02:00
Fernando Valverde
3b575acb56
Remove featured_number from articles table (#18514) 2022-09-29 15:07:17 -06:00
Fernando Valverde
bebd1d459c
Remove brand_color2 from users_settings (#18473)
* Remove brand_color2 from users_settings

* Remove occurences of brand_color2
2022-09-21 11:21:29 -06: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
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
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