Commit graph

7240 commits

Author SHA1 Message Date
Anna Buianova
5ea3490b6e
Renamed leftover @hero_display_ad => @hero_billboard (#19874) 2023-08-01 21:15:05 +03:00
zhangted
beb2800959
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>
2023-08-01 13:09:50 +01:00
Mac Siri
22569b37c8
Exclude Page from ReservedWords checks (#19853) 2023-07-31 11:30:37 -04:00
Anna Buianova
058fd17b58
Renamed display_ad variables to billboard (#19851)
* 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
2023-07-31 17:19:02 +03:00
PJ
9754d14182
Fix intermittently broken reaction images on home feed (#19779)
* move reaction icons to base layout

* fix reactions count specs??

* also fix article specs
2023-07-27 19:48:07 +01: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
Joshua Wehner
cf13879211
Remove feature-flag for subscribe-to-comments (#19774) 2023-07-27 10:31:55 -03:00
Duke Greene
cf7847fadb
remove onboarding background image, use gradient based on brand color (#19815)
* remove background image, rename prop to refer to color, pass primary brand color

* create helper method, send calculated gradient values into frontend props

* test new helper method and refine how color is darkened
2023-07-27 07:27:21 -04:00
Josh Klar
0b63876044
fastly_config: Soft-deprecate FastlyConfig service used only for DEV. (#19837) 2023-07-26 16:45:58 -07:00
Anna Buianova
ffb560c2a7
Rename DisplayAdEvent to BillboardEvent (#19833) 2023-07-26 13:57:02 -04:00
Anthony Nguyen
2208d2329c
Handle nil author_id on note on admin member manager view (#19830) 2023-07-26 11:22:42 -04:00
Ridhwana
8c7d592b96
404 page for a suspended user with no published content (#19789)
* feat: update the logic in the user profile

* feat: remove use case for banished user

* feat: update has_no_content? to has_no_accessible_content? and write a test

* spec: write more tests

* refactor: rename variable

* refactor: small tweaks

---------

Co-authored-by: Philip How <philip.j.how@gmail.com>
2023-07-26 10:58:17 +02:00
Dhurba baral
84b2f0145a
Displays better name for Admin roles (#19819)
* Displays better name for Admin roles

* Updates translations in fr

* Capitalize role label
2023-07-25 10:46:55 -04:00
Joshua Wehner
26c1a87695
Address minimal_admin deprecation (#19807)
* minimal_admin deprecation

* Remove the deprecate and aliases
2023-07-25 10:41:15 -04:00
Anna Buianova
869f29d942
Only query unpublish_all data on a relevant tab in the member manager (#19827)
* Only query unpublish_all data on a relevant tab in the member manager

* Added specs for AuditLog::UnpublishAllsQuery
2023-07-25 17:36:45 +03:00
Jeferson S. Brito
012e625c7c
Add Preact root fragment implementation replacement for replaceNode (#19673)
* feat: add preat-root-fragment implementation of replaceNode

* refact: replace render third argument with root fragment

* chore: reorder preact root imports

* fix: root createRootFragment implementation

* chore: fix base.jsx import order

* fix: add specs for preact-root-fragment

* fix: test ci audit issues

* fix: add insert/append methods specs for root-fragment
2023-07-25 10:11:41 -04:00
Duke Greene
129628b2c2
render left sidebar billboards ('display ads') asynchronously (#19797)
* render left sidebar billboards ('display ads') asynchronously

* remove request spec expectations for ads that are now rendered async

* don't set up path helper for old name style

* refactor from global to imported observeDisplayAds call

* revert refactor attempt, bad export syntax, may fast follow
2023-07-24 13:21:13 -04:00
Ridhwana
03905ce9cf
fix: move the setup dropdown to the callback because ot exists at that point (#19803) 2023-07-24 10:56:35 -04:00
Anna Buianova
963eea8126
Aliased DisplayAdEvent.display_ad_id to billboard_id (#19805)
* Aliased DisplayAdEvent.display_ad_id to billboard_id

* Allow :display_ad_id instead of :billboard_id for billboard_events in case of cache
2023-07-24 17:54:39 +03:00
Dhurba baral
3493c12ad2
Returns an error code when validation fails (#19734)
* Returns an error code when validation fails

Minor fixes

* Adds unit test
2023-07-24 17:01:50 +05:30
Anna Buianova
3adeb14ea0
Take :display_ad_event params as well as :billboard_event (#19810) 2023-07-21 10:53:28 -04:00
Jerin K C
6c2c1660db
Fix blank user's name (#19723) 2023-07-21 09:55:41 -04:00
Joshua Wehner
1f202c6a9a
Try to fix scrolling bug (#19801) 2023-07-21 09:42:50 -04:00
Anna Buianova
e659dbfc00
Renamed display_ad_events variables and associations (#19788)
* Renamed stuff related to display_ad_events (except the model)

* Updated user billboard_events association spec

* Fixed display_ad_event factory
2023-07-21 14:59:28 +03:00
Duke Greene
9a6f04bd37
api v1 endpoint for creating an organization (#19778)
* api v1 endpoint for creating an organization

* address failing specs, regenerate swagger docs

* remove old comment in destroy now that woreker call takes third argument

* refactor our services for profile images into images folder
2023-07-21 07:43:56 -04:00
Duke Greene
f163e2c14e
Dukegreene/moderator notifications copy change (#19775)
* update copy for moderator notifications

* use helper to display mod notification in the view

* add missing translate call
2023-07-19 14:02:39 -04:00
Duke Greene
dd7e34ac53
define api v1 routes for organizations (#19681)
* define api routes and create controllers, sketch out index and create actions

* add api v1 organizations CRUD spec and docs spec, need to run swagger

* swagger dry run on admin organizations routes, typo fix in api.rb

* flesh out specs and sketch out admin actions

* move actions out of concerns/include pattern and into v1 inline

* remove private constant call

* add v1 accept header to doc spec, fix syntax in a before block

* update controllers to address failing specs

* simplify controller and clarify route config

* flesh out tests for errors

* fix long line

* add missing commas

* return username show route to v0 concern controller

* create separate show route and action name, remove nesting from create/update params requirement

* clean up syntax in controller params and update show path in specs; move routes

* fix up syntax in params permit

* create organization in index spec

* one more syntax tweak for org params

* refactoring to one show route that handles username or id

* tweak spec syntax to expect the right array

* tweak controller and specs, simplify routing to show

* remove create route, action, and specs from this branch

* add clarifying comment in show controller action

* add explicit not found return to show route

* fix controller formatting causing 404 errors

* remove comment, update specs

* remove commment and fix id show response and specs

* fix show route and request spec for username param

* update unauthorized user specs to use put for now instead of post, regenerate swagger docs

* adjust update 422 spec to break org validity

* fix admin update spec, rerun swagger

* reorganiza controller actions, update specs, ensure authorized update and delete

* improve spec, handle finding one org more gracefully, delete via worker

* copy routes into api namespace instead of moving them from general namespace

* update param in v0 show route to fit more general naming

* regenerate v1 swagger docs

* use profile image url getter in update controller response

* update swagger docs and remove unneeded comment from org' model

* configure organizations destroy action for super admins only (for now)
2023-07-19 09:51:05 -04:00
Anna Buianova
fbd2ca0453
Rename DisplayAdEventsController to BillboardEventsController (#19771) 2023-07-19 08:51:22 -04:00
Rajat Talesra
f2cc2ae774
Admin Area: Bulk assign user roles (#19733)
* Bulk Assign Roles UI

* Renaming roles to role

* Added role to multiple users without using note.

* Role note added

* Role blank key fix

* Removed roles

* typo fix

* AuditLog Added

* Optimising code

* Good standing role issue

* Good standing role issue fix

* Minor PR changes based on review

* Added cypress tests

* Added spec tests for BulkAssignRole

* Minor fixes
2023-07-18 18:41:54 +05:30
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
Ridhwana
77148d8687
fix: lint rule https://github.com/facebook/react/issues/14920 (#19748) 2023-07-17 12:37:32 +02:00
Ridhwana
272aea6127
Allow admins to delete an organization (#19699)
* feat: update the layout for organizations

* feat: update the layout for an organization

* feat: organization logos are square

* feat: change the text on the org visit button

* feat: initialize the dropdown menu

* feat: trigger the  modal

* feat: update the text in the model

* feat: tweak wording

* WIP/feat: hook up a route with an action that calls an organization delete worker.

* feat: redirect after showing the notice

* feat: update the authorization required to be super admin

* feat: add the notice to localization

* spec: integration test

* spec: fix

* spec: delete worker

* chore: update the link

* feat: add safe navigation

* feat: make sure that we show an error if the organization has credits

* fix: error message for modal unspent credits

* feat add the spec for the helper

* fix: remove rspec preface

* fix: small fixes to tests and I18n

* fix: updated the number of orgs

* feat: update the message

* feat: update the message

* chore: remove inclusion of helper

* feat: change the name of the parameter

* chore: newline
2023-07-17 12:09:24 +02:00
Joshua Wehner
20c282df80
Still trying to fix notification caching when un/subscribing (#19754)
* Revert "Uncache subscribe to comments (#19739)"

This reverts commit 30500805ae.

* Tweak cache key for faster cache change on un/subscribe
2023-07-17 11:23:55 +02:00
Anna Buianova
be1e57d85c
Rename DisplayAdHelper to BillboardHelper (#19750) 2023-07-14 14:48:45 -04:00
Anna Buianova
ef5d126a0f
Rename display_ads API to billboards (#19749) 2023-07-14 14:22:52 -04:00
Joshua Wehner
bd2e349d86
Fix bugs with article moderator notifications (and make tests less flaky) (#19688)
* Try to mitigate flaky spec by clearing mock space

* Fix for flaky article published spec

* Rubocop

* Tidy up the specs a bit, update the comment

* Modernize article factory (thanks, rubocop)

* Update update spec to use factory

* Use PublishWorker instead of callback

* nth_published_at -> from_newish_author

* Separate published/unpublished specs

* published_at is correct if unchanged

* Add spec for scheduled post
2023-07-14 17:29:45 +02:00
Ridhwana
314a1b3761
feat: apply focus styles to crayons-btn (#19751) 2023-07-14 10:26:42 +02:00
depfu[bot]
730f976c08
[js] Update preact 10.12.1 → 10.15.1 (minor) (#19716)
Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com>
Co-authored-by: PJ <pj@forem.com>
2023-07-12 16:24:19 -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
Mac Siri
e98b00b45f
Update search result rendering for Organization (#19740) 2023-07-12 11:53:08 -04:00
Joshua Wehner
30500805ae
Uncache subscribe to comments (#19739)
* Subscribing to notifications should bust caches

* Unsubscribing to notifications should bust caches

* 'Normal' subscription toggle should also bust caches

* Cache busting can work with object or identifier

* Delete cached notification views for article and comment

* Simplify guard clauses

* And update the test expectation
2023-07-12 17:02:19 +02:00
Anna Buianova
7c1721675c
Rename DisplayAdsController to BillboardsController (#19738) 2023-07-12 09:42:46 -04:00
Lawrence
0c93bde6c2
Subscribe to Comment Functionality (#19555)
* Move save over and add button labels

* comment notification design and functionality

* controller error handling

* add ternery operator for background class

* minor cleanup

* add proper styling toggles

* tests and mobile spec

* add for all buttons

* add article as a param

* comment is not required on article preview

* update policy spec

* add test for coverage

* add proper button titles

* use the last user comment as comment id

* add better error handling and remove multiple fetch calls in js

* copy change to threads

* update copy, fix multiple fetch calls, add observer for loading more notifications

* update spec

* add rspecs

* more test specs

* fix test specs

* subscribe button text tests

* add export

* optimistically update ui function tests

* button initialize test

* check for comment ancestry

* add feature flag block

* some cleanup

* update logic and specs

* oops

* rubocop issues

* change config names

* change config names

* fix spec

* add one more conditional

* check for comments

* service-object the toggler

* separate routes

* continual refactoring

* refine spec tests

* clean up policy

* Adjust js and view files to match be params

* some service object refactoring

* separate endpoints on client-side

* broken spec

* service specs

* policy spec fixes

* remove action param

* remove action param from spec

* minor updates

* trigger build

* update to post

* Services don't need permitted params

* Notifications continue to be a mess, decorator specs to follow

* Not toggling now

* This doesn't really belong here

* Fix tests after moving

* Streamline front-end

* There could be errors?

* polymorphic_name is a class thing

* ☠️ json_data in notification views

* Use feature_flag helper to get current_user

* Cannot derive current subscription status from notification, only from subscription

* Default is subscribe to all article comments

* Sync up matching unsubscribe, make subscribe idempotent-ish

* Temporarily comment-out button jest tests to see if I can unstick CI

* Stop trying to detect potential subscribe-to-comment

* Stop trying to detect potential subscribe-to-comment

* Minor spec refactoring

* Add specs for article notification decoration

* NotificationDecorator specs are rather long

* Rubocop likes it?

* Minor spec refactoring

* Doesn't need to stay pending

* Add spec for subscription finder

* Expand Subscribe service specs

* YAGNI, but I don't like hard-coded config

* Refactor Unsubscribe service specs

* nobody expects the infinite scroll

* This *might* work, except for feature flag

* Ancestry can be quite deep actually

* Rubocop

* Update subscribe button for subscribe-to-thread

* Jest tests are just tests

* hasAttribute != getAttribute

* Test knows **nothing** about window size

* Tests have been lying about mobileLabel this whole time

* Make payload/endpoint testable

* Is Jest actually happy???

* Still cleaning up jest/eslint

* Temporarily comment-out cypress tests pending feature flag

* Thanks, Rubocop, what would we do without you

* Preserve round-trip for 'top-level' and 'only-author' subscriptions

* Update specs

* Move save button icon

* Update test with better config param

* Try feature flag specific to cypress env

* Tell cypress to wait for (un)subscribing to work

---------

Co-authored-by: Lawrence S <lawrence@forem.com>
Co-authored-by: Joshua Wehner <joshua@forem.com>
2023-07-10 17:11:46 +02:00
PJ
b0b1ace7d9
Prevent comments by the staff account from being hidden (#19698)
* don't show hide/unhide on comments made by staff account

* block staff account comments from being hidden on the backend as well

* moar specs
2023-07-10 11:46:46 +01:00
zhangted
5fe3a04287
fix scroll when popstate from a full screen code block (#19674) 2023-07-07 15:54:24 -04:00
Dhurba baral
8d78d80da0
Fix select dropdown not working (#19672)
Co-authored-by: Rajat Talesra <rajat@forem.com>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
Co-authored-by: PJ <pj@forem.com>
2023-07-07 14:39:19 -04:00
Dhurba baral
f3453b0d24
Skips newline when validating character count (#19646)
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Philip How <philip.j.how@gmail.com>
Co-authored-by: Mai Irie <mai@forem.com>
2023-07-07 14:35:29 -04:00
Kireeti
982d629fdf
Change Onboarding's button styling (#19654)
Co-authored-by: PJ <pj@forem.com>
2023-07-07 12:46:46 -04:00
Ben Halpern
b14f8c2325
Change feed billboard font size to fs-base and link embed adjustments (#19697) 2023-07-07 09:13:11 -04:00
Anna Buianova
8cc6f37a2d
Rename Admin::DisplayAds controller to Billboards (#19687) 2023-07-07 08:11:35 -04:00