Commit graph

3419 commits

Author SHA1 Message Date
yheuhtozr
5519fe563c
views/admin/users i18n (#18582) 2022-11-11 15:29:48 +02:00
Anna Buianova
2eda11d6bc
Fix removing published_at for a scheduled draft (#18682)
* Fix removing published_at for a scheduled draft

* Fix Article spec
2022-11-08 14:17:29 +03:00
Ben Halpern
6aacf2996a
Remove expensive query which is not necessary within app logic (#18689) 2022-11-07 17:04:54 -05:00
Rajat Talesra
b6d90a65b4
Replace comments box on non-signed-in User profile page with signup CTA #18608 (#18635)
* Basic implementation of CTA in place of Recent Comments

* Updated & Added Tests

* Nit fix

* Test fixes

* I18n strings

* Changed UI in main feed too

* Fixed tests

* Nit fix

* Initialised tracking
2022-11-05 02:27:06 +05:30
kudakwashe siziva
240de52884
Add a guard for email message content that does not have an html tag (#18636)
* Add a guard for email message content that does not have an html tag

* Return empty string if content is nil

* Add tests for handling content with and without html tags and nil
2022-11-04 13:31:35 -06:00
Rajat Talesra
768eb219ef
Redesigned home feed auth CTA (#18681)
* Redesigned home auth CTA

* Nit fixes

* Nit fixes

* Updated test

* Applied review changes

* Applied review changes

* Refractored login path code

* Added aria-label
2022-11-04 20:58:03 +05:30
Joshua Wehner
4446441ede
Fix readinglist count when article is unpublished (#18662) 2022-11-03 17:00:38 +01: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
Mac Siri
43829bdb96
Change requirement for response_template (#18601) 2022-11-02 12:16:17 -04:00
Fernando Valverde
227fc66705
Timecop freeze ab_experiment spec (#18655) 2022-11-01 11:35:37 -04:00
Anna Buianova
4d413af4cc
Keep published_at when updating author of a scheduled article from the dashboard (#18653) 2022-11-01 16:49:59 +03:00
Joshua Wehner
3f26694976
Refactor reaction categories as abstract class collection (#18540)
* Try a ReactionCategory abstract 'model'

* Use ReactionCategory

* Lookup category, pre-reaction

* Lookup category > constant

* Category can sometimes be nil?

* Try something friendlier for code reloading

* Refactor: extract point calculation out of Reaction

* Reaction Category can have color

* Rename reaction points service to follow convention

* method signature changed as well, calculate -> call

* Fix typo, leading comment, and rename data structures for clarity
2022-11-01 10:50:37 +01:00
Anna Buianova
f3d2d1b156
Fix a spec failing because of the daylight savings (#18661) 2022-10-31 17:23:09 +03:00
Ridhwana
cae4c929ec
Save selected tags to the display ad model (#18633)
* 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
2022-10-27 20:22:29 +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
Fernando Valverde
2517a4dac9
Remove rack attack throttle for admin users in API requests (#18612)
* remove rack attack throttle for admin users

* Add tests

* Optimize cache admin secrets for 24h with invalidation when needed

* Make ApiSecret callback only execute on create
2022-10-25 09:26:38 -06:00
Anna Buianova
f7a93aabbb
Remove html variants tracking (#18594)
* Removed code related to tracking html_variants

* Remove code related to HtmlVariant#find_for_test

* Remove spec for HtmlVariant#success_rate
2022-10-21 14:57:20 +03:00
Fernando Valverde
d14d882b13
Make reason for adjustment optional in moderator tag adjustment (#18606)
* Makes reason for adjustment optional for mod tag adjustments

* Makes reason for adjustment in notification conditional on adjustment reason

* Fix cypress element lookup by placeholder text
2022-10-20 09:54:52 -06: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
Mac Siri
9d77384586
Add Codecov (#18580) 2022-10-18 10:08:23 -04:00
Anna Buianova
9bb5b81fc5
Display information about "unpublish all" actions in the member manager (#18576)
* 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
2022-10-14 15:46:53 +03:00
Fernando Valverde
0a0e2b0a7f
Ensure super moderator actions Note & AuditLog (#18569)
* Specs - before including changes requires

* Include AuditLog Subscribe listen/forget directives

* Ensure Notes (w/ default content) + AuditLog

* Remove old spec - no longer needed
2022-10-12 09:36:41 -06:00
Ben Halpern
ef63738454
Feed experiment for 10-11-2022 (#18566) 2022-10-11 08:56:49 -06:00
Joshua Wehner
201f4d998a
Try hiding low-quality comments (#18513)
* Try hiding low-quality comments

* Message indicating when negative comments are being hidden

* Adjust comment show count for logged-out visitors

* Remove unusued comments_to_show_count from article decorator

* Remove unusued comments_to_show_count from podcast episode decorator

* Add test for hidden negative comment

* Update spec/system/articles/user_visits_an_article_spec.rb

Co-authored-by: Fernando Valverde <fernando@fdo.cr>

* Don't create twice; do test logged-in and -out

* Comment caching needs to account for signed-in status

Co-authored-by: Fernando Valverde <fernando@fdo.cr>
2022-10-11 14:15:40 +02:00
Joshua Wehner
f97b5de96e
Remove social_preview views (except articles) (#18523)
* Remove social_preview views (except articles)

* Remove unreachable controller actions
2022-10-11 12:28:55 +02:00
Anna Buianova
184ee8039f
Create a note when a users' articles are being unpublished via API (#18545)
* Moved a comment about soft delete from controller to the service

* Create a note when unpublishing all users' articles via api

* Create a note with the default text when unpublishing all via api, added docs
2022-10-10 16:25:56 +03:00
Fernando Valverde
5caca502d3
ActiveSupport::Notifications listen/forget fix (#18549)
* active support notifications debug

* Match missing .forget listeners
2022-10-07 11:00:37 -06:00
Ben Halpern
f70bc2b0b8
Add internal tool to preview feed configs (#18544)
* Add internal tool to preview feed configs

* Update app/services/articles/feeds/variant_query.rb
2022-10-06 07:48:44 -04:00
Anna Buianova
9d755a9d2f
Save list of previously-published articles when user is subject to an "un-publish all" action (#18535)
* Moved logging and deleting comments to Moderator::UnpublishAllArticlesWorker

* Added logging for admin action (unpublish_all_articles)

* Extracted code from UnpublishAllArticlesWorker to the service

* Make it possible to add a note while unpublishing all via admin action

* Added ability to add notes for unpublishing all from moderator action panel

* Fixed setting slug for the AuditLog on unpublishing + spec
2022-10-06 14:17:20 +03: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
Ridhwana
9361d2426f
✂️✂️✂️ Part 1: Remove Sponsorship (#18512)
* 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
2022-10-03 16:26:32 +02:00
Fernando Valverde
e5e36a2e2d
Comment fragment link when signed out (#18517)
* Comment fragment link when signed out

* Optional chaining for article path

* Fix comment liquid tag rendering

* Extract signed in/out logic into helper

* Debugging specs

* Fix specs

* Use named empty anchor to link comments with id_code
2022-10-03 07:58:34 -06:00
Joshua Wehner
ed2bfe59c1
Restore DisplayAd search (#18511)
* Restore DisplayAd search

* Add tests for search behavior
2022-09-29 10:27:09 +02:00
Fernando Valverde
c57acc25ea
Remove featured number usage from articles (#18510) 2022-09-28 08:59:03 -06:00
Ben Halpern
cd5c86c760
Feed experiment for 09-26-2022 (#18501)
* Feed experiment for 09-26-2022

* Fix variant

* Add proper tests
2022-09-27 08:48:15 -06:00
Joshua Wehner
98077a8df6
DisplayAdEvent tracking changes (#18460)
* Make user_id optional for DisplayAdEvent

* Track when DisplayAd is visible to user

* Tidy up a bit

* Deleting a user account should nullify related DisplayAdEvents

* Update tests with new association details
2022-09-26 16:33:03 +02:00
Ridhwana
9dee48dbc2
Add tracking for the registration flow - "Clicked on Create Account" (#18459)
* refactor: move trackEvents to a utilities folder so that it can be re-used

* feat: add a function called trackCommentClicks and use it on the articlePage

* feat: update the auth widget to take the correct properties

* feat: add create account tracking method for hamburger

* feat: add create account tracking method for sidebar left

* feat: whoops, sidebar tracking info added

* feat: add the feed card create account tracking

* feat: whoops add the id to the dom

* feat: add top nav create account tracking

* feat: create account tracking for the registration modal

* fix: callback instead of invoking + rename class

* fix: js-prepend

* feat: some showLogin event tracking

* use the tracking propert

* x - feed.jsx

* fix: oops I removed hidden

* track from the search login

* feat: add tracking for follow button

* fix: main_stories is only being called in view/articles and both are including the FollowButtons pack

* comments track

* feat: remove punc (.)

* chore: cahnge working

* chore: remove tracking-id from modal

* feat: remove ecmascript features

* refactor: rename some events

* feat: referrer page

* feat: add a secondary source for the follow buttons

* feat: remove file that is not used

* chore: rename key

* feat: use @utilities

* feat: add spec for create account clicks

* feat: add key referrer

* fix: tests

* fix: oops

* chore: add commented test

* test for tracking

* feat: update the change by 1

* feat: aggregate_failures

* feat: add data-no-instant back

* feat: try a different way of testing

* refactor: change secondary_source to referring_souce

* feat: change ahoy event test

* feat: add a version number to ahoy tracking

* feat: change the href to pathname

* feat: reply comment tracking

* fix: to be present syntax

* feat: use href instead of pathname

* chore: do not track tags and podcasts follow and remove referrer

* feat: add readinglist

* fix: remove referrer from test

* feat: fail gracefully in instances where there is no tracking data
2022-09-22 16:03:49 +02:00
Mac Siri
41987116c7
Replace webdriver with cuprite (#18476)
* Replace webdriver with cuprite

* Fix broken spec

* Fix broken spec

* Fix broken spec

* Fix broken spec
2022-09-22 08:23:42 -04: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
Fernando Valverde
f4155984c5
Article collection cleanup callback (#18456)
* Collection cleanup callback

* Fix cleanup check

* fix specs
2022-09-16 14:08:20 -06:00
Anna Buianova
455399bdba
Rubocop fixes (#18461)
* Rubocop fixes

* Fixed most Capybara/SpecificMatcher violations

* Moved flash notice texts to locales
2022-09-16 15:25:48 +03:00
VISHAL DEEPAK
b84fa1da08
Sort comments reopen (#18349)
* Sort comments in articles page

* Clickable area in sort comments article is now more approriate

* Comments subtitle is now responsive in articles page

* Consider comments sort order for cache in articles page

* On selecting sort option the refreshed page lands to comments section
2022-09-13 11:37:48 -06:00
Rajat Talesra
5559067e34
Revert "Revert "Entire profile badge redesign" & "Badges page redesign" (#18446)" (#18447)
This reverts commit d7f70eb85b.
2022-09-13 22:06:37 +05:30
Rajat Talesra
d7f70eb85b
Revert "Entire profile badge redesign" & "Badges page redesign" (#18446)
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-09-13 11:39:46 -04:00
Rajat Talesra
f1176900f0
Badges page redesign (#18419)
* Badges homepage redesign

* badges.scss

* Attempt at solving badge ci check

* Added badge prompt

* Merged with main

* Removed /badge/.. related code

* Revert removing badge page

* Fixed Safari design issue

* Removed not-requried css property

* Trying to remove /badge/

* Updated profile badges

* Fixed userprofile badge

* Accessibility changes + removed failed tests

* Tests passed
2022-09-13 03:07:59 +05:30
Joshua Wehner
2b24167fba
Try fixing comment like count bugs (#18438)
* Try fixing comment like count bugs

* Tests for the CommentCreator
2022-09-12 10:12:46 +02:00
thejwuscript
fea90d2e84
Fix inconsistent published date of Article and Comment (#18412)
* Revise system specs for viewing a comment

* Add system specs for viewing comment date

* Add conditional to SetTimeZone middleware

* Revise comment_date partial

* Refactor viewing a comment system specs

* Add more system specs for viewing a comment

* Fix format of comment date with short year

* Fix edited comment date

* Fix comment date when posting new comments
2022-09-09 14:12:15 -06:00
Joshua Wehner
892ad01264
Restrict Reactions API to admins (#18424)
* Restrict Reactions API to admins

* Also update API docs spec

* Removed unneeded pundit_user
2022-09-08 17:56:42 +02: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
Mac Siri
2413ece281
Use remote_ip in Rack::Attack (2nd attempt) (#18409) 2022-09-06 10:06:29 -04:00