Commit graph

587 commits

Author SHA1 Message Date
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
c5201ca888
Remove dead code associated with old roles (#20175)
* Remove dead code associated with old roles

* Remove test references

* Removed from seeds

* Removed unused roles from locales

---------

Co-authored-by: lightalloy <lightallloy@gmail.com>
2023-10-01 09:33:25 +07: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
Anna Buianova
2d6b740940
Renamed DisplayAd model to Billboard (#19993)
* Renamed Resource Admin: DisplayAd to Billboard

* Renamed DisplayAd to Billboard

* Added a data update script for roles
2023-08-28 08:09:36 -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
Ridhwana
399a0158da
Tag Page partial UI updates (#19866)
* feat: remove the top card color branding

* feat: update the heading

* feat: remove the rotation on the badge

* feat: remove rotation and justify-between the badge

* feat: add number_with_delimiter to the tag count

* feat: change the follow button to be 'primary'

* feat: add a flex column so that the buttons row sticks to the card bottom

* feat: add the posts to the right hand side on the header

* refactor: move the styles to teh css page

* feat: spacing

* fix: tests

* fix: test

* Exclude Page from ReservedWords checks (#19853)

* move initializeSettings to webpack (#19737)

* move initializeSettings to webpack + add tests

* add initializeSettings to InstantClick change block

* dont use classes, use modules

---------

Co-authored-by: PJ <pj@forem.com>

* Renamed leftover @hero_display_ad => @hero_billboard (#19874)

* Reorganize devDependencies & revert strong_migrations (#19870)

* ruby: Upgrade to v3.1.4 (pt. 1, base image only) (#19871)

In #19776 we discovered that basing both the base container *and* the
app container off of `.ruby-version` causes a chicken-and-egg problem
wherein upgrading Ruby versions requires a few stop-and-gos. Let's make
those stops reviewable as separate chunks instead: use a new
`.ruby-version-next` for building base images, not the `.ruby-version`,
thus allowing GitHub Actions to fire off an automated build (which, when
complete, we can take the SHA sum from and use it to open a second PR
updating the app image to use it, and `.ruby-version` can be updated to
match `.ruby-version-next`).

* feat: add the bullet unused_eager_loading query

* feta: update the seeds

* feat: add a smaller gap and make the grid-col 4 on large screens

* feat: do not let the button take the height of the container

* sway the search with the following tags

* feat: keep the description at font size 14px

* tweak elements to ensure an ideal card height of 195px

---------

Co-authored-by: Mac Siri <mac@forem.com>
Co-authored-by: zhangted <tedcbook@gmail.com>
Co-authored-by: PJ <pj@forem.com>
Co-authored-by: Anna Buianova <lightallloy@gmail.com>
Co-authored-by: Josh Klar <jklar@forem.com>
Co-authored-by: Duke Greene <dukegreene@gmail.com>
2023-08-08 18:57:14 +02:00
PJ
6e7a898828
possibly flaky test fix (#19856) 2023-07-28 19:50:19 +05:30
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
PJ
cee84b49ef
Exclude manual segments from dropdown in billboard admin form (#19677)
* exclude manual segments from audience segments dropdown

* specs 🎉

* fix deleteDisplayAds specs

* add seed for display ad with manually managed segment

* moar specs
2023-07-12 20:23:50 +01: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
Mac Siri
a475fb9169
Update seed file (#19480) 2023-05-18 07:53:48 -04:00
Mac Siri
a1ca675e6f
Add DisplayAd to seeds (#19453) 2023-05-11 15:33:10 -04:00
Mac Siri
b4a4b30153
Add Staging specific seed file (#19434) 2023-05-10 16:10:19 -04:00
Dhanujha R
857dd285d5
Remove Dark and Light Nav Logo Image from Organization (#19309) 2023-05-08 17:01:03 -04: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
Anna Buianova
784afdf41e
Routine rubocop fixes (#19254)
* Rubocop fixes

* Rubocop fixes

* Fixed rubocop violation

* Fixed policies rubocop violations

* More rubocop fixes
2023-03-24 14:37:44 +03: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
Ridhwana
36f5d168d8
✂️✂️✂️ Part 2: Remove Sponsorship (#18522)
* 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
2022-10-04 19:02:44 +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