Commit graph

3507 commits

Author SHA1 Message Date
Joshua Wehner
a20cf3e02b
Unique cross-model-slug check is likely misconfigured (#19263)
* Page unique_cross_model_slug seems misconfigured

* Update validator test

* More verbose invalid attribute message

* Try dynamic model/attribute registration

* Rubocop

* Use the cross-model-slug existence check

* Register with the dynamic cross-model-slug checker

* Cleanup

* Add missing keys to fr

* Update format regex

* Adjust validation: always presence, unique if changed

* Tests can create reserved-word pages when they need to

* Slugs can be mixed case?

* Case-sensitive is better, actually

* Refactor to use CrossModel check

* Refactor, rename for clarity

* Refactor, avoid mocking oneself

* Refactor, injectable everything

* Add reservedword check to extracted exists? checker

* Move to concerns

* Without dynamic registration

* extend when needed

* Cleanup comments, remove registration references

---------

Co-authored-by: Goran <gorang.pub@gmail.com>
2023-04-07 17:04:45 +02:00
Anna Buianova
eb52b91f75
Ensure rendering parity on DisplayAd, Comment, & Article (#19091) 2023-04-07 09:30:17 -04:00
Mac Siri
0813a0a322
Resolves false-positive UnsafeRedirectError (#19297) 2023-04-07 09:17:56 -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
197b7f7128
Update FilteredAdQuery to better support community ads (#19281)
* 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>
2023-04-03 14:44:35 +02:00
Ridhwana
42b392906b
Migrate initializeUserProfilePage to webpack (#19241) 2023-03-28 12:20:49 -04:00
Goran
0b4a3601a8
Refactor User#temp_username (#19252)
* Refactor User#temp_username

* Remove Authentication::Providers dependency from Users::UsernameGenerator

* Adds brief description and yard docs
2023-03-27 16:21:00 +03:00
yheuhtozr
87c5526c30
Allow BIDI non-deprecated marks in title (#19177) 2023-03-23 09:41:57 -04:00
Joshua Wehner
b812ca5955
(Really) Enable multiple reactions on #index (#19202) 2023-03-22 10:20:00 -04:00
Mac Siri
842e6880b8
Routine rubocop fix on /spec (#19217)
* Softrun rubocop

* Hardrun rubocop (-A)

* Change a rubocop rule

* Add missing cops

* Undo & redo rubocop -A
2023-03-21 09:55:26 -04:00
Joshua Wehner
8086ef68ac
Fix bullet issue with includes commentable (#19145)
* Fix bullet issue with includes commentable

* Flatten view logic

* Restore user comment section logic (but bullet-friendly)

* Try fixing podcast_episode -> podcast

* Add test that would have caught the logic bug

* View specs need describe to specific the path

* Remove unnecessary _comments argument

* Ooops, missed saving this
2023-03-20 16:08:03 +01:00
Joshua Wehner
230e77e5cd
Update FilteredAdsQuery and user settings for opting-out of Billboards (#19208)
* 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>
2023-03-16 15:23:02 +02:00
Mac Siri
45f25647ef
Fix flaky notifications_spec (#19215) 2023-03-10 06:59:30 -05:00
Lawrence
cfad413ca1
Display Rules for In house and Community Billboards (#19189)
* init

* Update app/queries/display_ads/filtered_ads_query.rb

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

* Update app/queries/display_ads/filtered_ads_query.rb

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

* add display ad query and update caller

* set as keyword args and add org id to callers

* Update app/queries/display_ads/filtered_ads_query.rb

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

* Update app/queries/display_ads/filtered_ads_query.rb

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

* Update app/queries/display_ads/filtered_ads_query.rb

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

* Update app/views/articles/_sticky_nav.html.erb

Co-authored-by: Joshua Wehner <joshua@forem.com>

* Update app/views/articles/show.html.erb

Co-authored-by: Joshua Wehner <joshua@forem.com>

* Update app/queries/display_ads/filtered_ads_query.rb

Spacing

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

* Update app/queries/display_ads/filtered_ads_query.rb

More spacing

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

* Update app/queries/display_ads/filtered_ads_query.rb

Co-authored-by: Joshua Wehner <joshua@forem.com>

* Update app/queries/display_ads/filtered_ads_query.rb

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

* fix some broken specs

* add updated spec for billboard rules

* missing comma

* Update spec/queries/display_ads/filtered_ads_query_spec.rb

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

* add placement in spec

* fix external spec

* cleanup

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Joshua Wehner <joshua@forem.com>
2023-03-06 14:15:14 -08:00
Joshua Wehner
727705dc89
Revert "Enable multiple reactions on #index (including front-end render)" (#19197) 2023-03-03 09:59:51 -05:00
Joshua Wehner
8a45a4bf67
Enable multiple reactions on #index (including front-end render) (#19169)
* 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>
2023-03-03 15:17:19 +01:00
Mac Siri
627cb203f6
Address flaky specs (#19188) 2023-03-02 09:40:06 -05:00
Mac Siri
ca33ed8729
Touch reactable after taking admin action (#19185) 2023-03-02 09:35:11 -05:00
Rajat Talesra
1d60c5ff77
Added dropdown to display ads / billboards (#19106)
* Initial setup work with error

* Dropdown working with error fixed

* Removed repition

* Home page billboard dropdowns added

* Created common file for dropdown

* Complete display ad dropdown usage

* Minor indentation fix

* Minor UI updates

* Minor test update

* Dropdown for billboard optimisation

* Added anchor tags

* Display ad unified code

* Design changes

* Design changes

* Changes to display ad click tracking

* Style changes

* Design change to admin display ad

* Nit fix

* Nit fix

* Updated test
2023-02-27 22:57:01 +05:30
Mac Siri
140f85695b
Add forgot_password_throttle (#19175) 2023-02-27 09:25:29 -05:00
Joshua Wehner
db2b571bd6
Require an owner for 'community' billboards (#19167)
* Require an owner for 'community' billboards

* Reduce flakiness in this unrelated test
2023-02-27 14:22:47 +01:00
Joshua Wehner
c251f4000d
Add creator to DisplayAd (#19126) 2023-02-22 14:17:22 -05:00
dancristianb
814080dc3b
Fix nested sidebar active item highlight (#18973)
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Fernando Valverde <fernando@fdo.cr>
Co-authored-by: Joshua Wehner <joshua@forem.com>
2023-02-21 16:18:42 -05:00
Anna Buianova
efe540dfce
Billboards type_of: added field to the API and small admin form changes (#19125)
Co-authored-by: Joshua Wehner <joshua.wehner@gmail.com>
Co-authored-by: Mac Siri <mac@forem.com>
2023-02-21 14:17:40 -05:00
depfu[bot]
59330184ac
[ruby] Update redcarpet: 3.5.1 → 3.6.0 (minor) (#19067)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: Mac Siri <mac@forem.com>
2023-02-21 11:29:46 -05:00
Ben Halpern
df4568d275
Bust article on initial reactions to fix cached HTML issue (#19149)
* Bust article on initial reactions to fix cached HTML issue

* Fix whitespace issue

* Move cache-busting logic to worker

* Update app/workers/reactions/bust_reactable_cache_worker.rb

Co-authored-by: Joshua Wehner <joshua@forem.com>

---------

Co-authored-by: Joshua Wehner <joshua@forem.com>
2023-02-20 16:31:38 -05:00
Mac Siri
c3e3574e09
Fix flaky runkit spec (#19131) 2023-02-17 10:51:17 -05:00
Joshua Wehner
1374ab98e6
Ensure spam doesn't hit logged-out /latest (#19110)
* Ensure spam doesn't hit logged-out /latest

* Restore load-bearing constant

* Narrow selector avoids the new 'latest' banner

* Test scenario for signed-in low-score content

* Remove false-negative test

* Actual test for the logged-in scenario

* Signed-in users get poor quality content

* Feeds (RSS) use an entirely different query

* Pass @stories

* Update tests with new minimum score
2023-02-17 09:29:59 +01:00
Mac Siri
f14b0868f8
Revert "Enable rspec-retry on system and request specs (#19103)" (#19133) 2023-02-16 17:41:51 -05:00
Joshua Wehner
a4654f2d2f
Reaction emoji with consistent underscores (#19116) 2023-02-15 08:32:19 +01:00
Keiichi Kayama
8e0b5bc0f5
Fix force params of the fetch episodes (#18932)
* Fix force params of the fetch episodes

* Fix rubocop@Fix force params of the fetch episodes

---------

Co-authored-by: Joshua Wehner <joshua@forem.com>
2023-02-14 11:37:35 +01:00
Mac Siri
5e792ca0b2
Enable rspec-retry on system and request specs (#19103) 2023-02-13 09:51:37 -05:00
depfu[bot]
b17297ecc6
[ruby] Upgrade hairtrigger: 0.2.25 → 1.0.0 (major) (#19095)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2023-02-10 11:49:33 -05:00
Mac Siri
b931e02855
Expands Follows request specs (#19096)
* Add spec

* Add specs
2023-02-10 09:02:38 -05:00
Joshua Wehner
567e31248a
Try right-to-left for stack effect (#19083)
* Try right-to-left for stack effect

* Reverse order to counter rtl ordering

* Better post-merge reconciliation

* Try to get test ratio boost

* Fix test
2023-02-10 11:01:03 +01:00
Mac Siri
a2461cefce
Do not nullify abuse_report when banishing user (#19084) 2023-02-09 11:32:38 -05:00
Joshua Wehner
ea2154d506
Fixing design issues with multiple reactions (#19020)
* Try disabling text-select (mobile long-tap)

* Try to force button color on mobile safari

* Try making notification decorator more helpful

* More using notification decorator

* Helper so I can see exceptions

* As we toggle feature flag, temporary show 'heart' for unsupported reactions

* Reaction on Comment is a 'reaction'-type notification

* Temporarily add new emojis to i18n

* Render full-color, unique SVGs for multiple_reactions

* Restore card layout

* Aggregate reaction icons also need unique SVGs

* This seems unnecessary?

* Multiple is -more-than-one-

* Display *unique* reaction categories on /notifications

* Comment notification no longer needs to re-render as reaction

* Decorator needs to handle some data gaps

* Fix NotificationHelper

* Try a better name for this

* Tests for the notification decorator

* These partials wound up without an outer layer

* Add a descriptive comment

* index needs force_unique

* Try multiple reactions external img (#19076)

* Try external img SVGs

* Unique SVG might not be necessary if this works

* Can also remove this spec if successful

* Restore flash icon behavior

* Plus external img for #index as well
2023-02-08 11:39:47 +01:00
Fernando Valverde
b2444d032d
/organizations api docs (#19055)
* /organizations api docs

* Remove Listings support
2023-02-03 15:12:03 -06:00
Fernando Valverde
c6419d7300
/tags api docs (#19048)
* /tags api docs

* Merge main
2023-02-03 14:11:38 -06:00
Fernando Valverde
bb7e193b3e
/videos api docs (#19049)
* /videos api docs

* Merge main
2023-02-03 10:22:57 -06:00
Fernando Valverde
13288c5626
API V1 Users docs (#19046)
* /users/me api docs

* Updated api_v1.json

* Missing users api docs
2023-02-03 05:43:48 -06:00
Joshua Wehner
fd7021b001
Pages API: create, update, and delete (#19009)
* Pages API pt 1 (read/get/index+show)

* Update spec/requests/api/v1/docs/pages_spec.rb

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* Update spec/requests/api/v1/docs/pages_spec.rb

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* API Key not required for index & show

* API Feature flag has long since been removed

* Page schema

* Fix spec broken by merge

* Temporary bugfix: slug uniqueness not working for Page

* Pages API endpoints for create, update, and destroy

* Fix swagger error

---------

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2023-02-02 17:24:11 +01:00
Ridhwana
686976ced8
Round Robin Notifications Refactor (#19026)
* 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
2023-02-01 15:21:36 +02:00
Mac Siri
59f6118e92
Update Users::ProfileImageGenerator (#19040)
* Update Users::ProfileImageGenerator

* Update other spec
2023-02-01 06:12:26 -05:00
Mac Siri
b77c1ea2e6
Change rake spec setup (#19012) 2023-01-30 10:51:38 -05:00
Ridhwana
2da1b45c32
Move a portion of the Display Ads tests alongside the query (#19017)
* Remove jQuery

* Added jquery back to videos

* Removed jquery code

* Nit fix

* Revert incorrect code

* Updated jquery code to javascript

* Removed jquery from comments

* refactor: move the spec to test the query

---------

Co-authored-by: rt4914 <rajattalesra4914@gmail.com>
Co-authored-by: Rajat Talesra <rajat@forem.com>
2023-01-30 10:57:34 +02:00
Mac Siri
8e76bc046b
Refactor CreatorSettingsForm & spec (#19011) 2023-01-27 08:39:07 -05:00
Joshua Wehner
909fd7f103
Try having sync_reactions_count as a background job (#18991)
* Try having sync_reactable as a background job

* Update test

* Fix flakey test (order should not matter)
2023-01-27 12:58:13 +01:00
Ridhwana
9ba3df4453
Round Robin Notification Tweaks (#18995)
* Remove jQuery

* Added jquery back to videos

* feat: increase the available moderator count

* Removed jquery code

* Nit fix

* Revert incorrect code

* Updated jquery code to javascript

* Removed jquery from comments

* feat: updates the last_reacted_at value when saving a creation

* feat: update the query for available moderators

* spec: write a test for the available moderators

* fic: update the reaction spec with current time

* fix: add last_reacted_at to the send_spec

* fix: add last_reacted_at to the user

* chore: move the queries around

* fix: change timecop block

* fix: update the last_reacted_at for the user

* chore: try to fix timecop

* Update app/services/notifications/moderation.rb

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

* feat: update the tests

Co-authored-by: rt4914 <rajattalesra4914@gmail.com>
Co-authored-by: Rajat Talesra <rajat@forem.com>
Co-authored-by: Mac Siri <mac@forem.com>
2023-01-26 19:31:45 +02:00
Mac Siri
ec3971a387
Create FindsBin spec (#18992) 2023-01-26 10:46:18 -05:00