Commit graph

1288 commits

Author SHA1 Message Date
Jhonatan Hidalgo
d4b71dd89b
Change all tooltip texts on heart/like reactions to like (#18135)
* Change all tooltip text on heart/like reactions icons

All texts of like reactions were changed to 'Like' instead of 'Heart' as well as the style used to display these tooltips.

Some tooltip styles have been changed to maintain consistency in the style between new 'Like' reaction tooltip style

* Add button accessible name

* Append new Like tooltip hasn't been added

Append the missing tooltips and refactored the code. The related E2E test has been updated

* Remove unnecessary tooltips

the new non-required tooltips that were aggregated were deleted

* Fix error code

* Refactoring code

* Adjust hover media queries
2022-08-03 12:44:36 +01:00
Jhonatan Hidalgo
998d39cd4c
Focus comment box when entering by "comments" button from home feed (#18132) 2022-07-28 14:17:46 -05:00
Arit Developer
450af1cd45
Redeploying the Flag/Unflag User functionality (#18235)
* building again

* still building

* still building

* stuck

* Suzanne Holmes on the case

* make report content a button not a link

* revert to link

* add tests

* revert changes made trying to get ModCenter to work

* hide nonworking actions_panel btns in Mod Center

* nudge Travis

* incorporate PR comments

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-28 09:03:37 -04:00
Arit Developer
3fa350c7f2
Revert "Relocate and Refactor "Flag User" Action (#18182)" (#18232)
This reverts commit 8f544ab6ed.
2022-07-27 12:10:22 -04:00
Arit Developer
8f544ab6ed
Relocate and Refactor "Flag User" Action (#18182)
* building again

* still building

* still building

* stuck

* Suzanne Holmes on the case

* make report content a button not a link

* revert to link

* add tests

* revert changes made trying to get ModCenter to work

* hide nonworking actions_panel btns in Mod Center

* nudge Travis

* incorporate PR comments

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-27 10:47:17 -04:00
Josh Puetz
76bb397137
Feed experiment for 2022-07-26 (#18227) 2022-07-27 08:19:32 -05:00
Fernando Valverde
f77b5f83a9
Include audit log for API admin endpoints (#18167)
* First commit for audit log - specs need fixing

* Fix notification subscription issues + specs

* Use single line in notification subscribe initializer

* Remove conditional in unpublish endpoint
2022-07-22 11:35:30 -06:00
Josh Puetz
fc1031f52a
Add Google Analytics 4 Support (#18124) 2022-07-21 09:26:13 -05:00
Anna Buianova
2c166b65df
Change "posted on" to "scheduled for" on the scheduled articles preview page (#18177)
* Improved information about article posted/scheduled

* Added specs for sheduled/posted label

* Scheduled to => scheduled for
2022-07-20 16:09:34 +03:00
Jeremy Friesen
510d85dc74
Adding 2022-07-19 variant (#18156)
Diff between `20220617-variant-a` and `20220719-variant-a` (e.g. the new
incumbent with minor tweaks):

```
3c3
<   "description": "Blend of 20220603-variant-b and 20220603-variant-a",
---
>   "description": "Copy of 20220617-variant-a with tweak to negative privileged user",
84,85c84,85
<       "negative_reaction_threshold": -10,
<       "positive_reaction_threshold": 10
---
>       "negative_reaction_threshold": -9,
>       "positive_reaction_threshold": 4
```

**Note**: In the above I'm adjusting the `negative_reaction_threshold`
and `positive_reaction_threshold` to reflect the value of the privileged
user reaction points:

```ruby
class Reaction < ApplicationRecord
  BASE_POINTS = {
    "vomit" => -50.0,
    "thumbsup" => 5.0,
    "thumbsdown" => -10.0
  }.freeze
```

See the [current state of app/models/reaction.rb](817db3e6f8/app/models/reaction.rb (L1-L6))

Further, the thresholds are exclusive (e.g. `<` or `>` not `<=` or `>=`).

Diff between `20220719-variant-a` (e.g. the new incumbent) and
`20220719-variant-b` (e.g. the challenger)

```
3c3
<   "description": "Copy of 20220617-variant-a with tweak to negative privileged user",
---
>   "description": "Copy of 20220619-variant-a with tweak to comments range",
37,46c37,54
<         [0, 0.8],
<         [1, 0.82],
<         [2, 0.84],
<         [3, 0.86],
<         [4, 0.88],
<         [5, 0.9],
<         [6, 0.92],
<         [7, 0.94],
<         [8, 0.96],
<         [9, 0.98]
---
>         [0, 0.5],
>         [1, 0.6],
>         [2, 0.66],
>         [3, 0.7],
>         [4, 0.75],
>         [5, 0.8],
>         [6, 0.85],
>         [7, 0.88],
>         [8, 0.9],
>         [9, 0.92],
>         [12, 1.0],
>         [18, 1.0],
>         [22, 1.0],
>         [25, 1.0],
>         [30, 1.0],
>         [35, 1.0],
>         [40, 1.0],
>         [45, 1.0]
48c56
<       "fallback": 1
---
>       "fallback": 0.98
```

Closes forem/forem#18155
Related to forem/forem-internal-eng#453
2022-07-19 14:59:53 -04:00
Fernando Valverde
c6c39813a1
New suspend user API endpoint (#18043)
* New suspend user API endpoint

* Restrict admin access only to suspend action

* Add suspended? check on new endpoint spec

* Replace POST with PUT action

* Replace redundant response payload with empty 200 response

* Rely on user_policy instead of before_action method

* Use alias with matching method name instead of unpublish

* Use already existing toggle_suspension_status? method in policy

* Remove manual creation of note

* Update suspend success spec
2022-07-15 09:07:57 -06:00
Fernando Valverde
5df1855103
Unpublish comments+articles by user id in API v1 (#18058)
* unpublish comments+articles by user id in API v1

* Update spec/requests/api/v1/users_spec.rb

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

* Rely on user_policy instead of before_action method

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-07-14 11:47:44 -06:00
Mac Siri
7880f46829
Remove yaml_column_permitted_classes (#18108) 2022-07-13 18:43:39 -04:00
Mac Siri
52676c3cac
Update yaml_column_permitted_classes (#18110) 2022-07-13 17:34:33 -04:00
Mac Siri
b30f016604
Update yaml_column_permitted_classes (#18106) 2022-07-13 16:26:43 -04:00
Mac Siri
66761cb89b
Update yaml_column_permitted_classes (#18101) 2022-07-13 11:55:17 -04:00
Fernando Valverde
aa130cc456
Fix Honeybadger typo in Rpush reflection callback (#18071) 2022-07-13 09:13:40 -06:00
Mac Siri
1c40cd0305
Bump Rails to 7.0.3.1 (#18096)
* Bump Rails to 7.0.3.1

* Add yaml_column_permitted_classes

* Update yaml_column_permitted_classes

* Fix broken spec
2022-07-13 10:57:08 -04:00
Mac Siri
9599d3349f
Enable framework 7's cache_format_version (#18064) 2022-07-12 15:44:23 -04:00
Jeremy Friesen
8fa5c31cb8
Starting 2022-07-12 Experiment (#18083)
This involves declaring the 20220603-variant-a the winner of the past
experiment; note in the past experiment there was not a statistically
significant winner.

This new experiment adds a variant that deviates from the new
incumbentby way of reintroducing the follows an author and adjusting the
tag follow weights.

Closes forem/forem#18082

```shell
$ diff config/feed-variants/20220617-variant-a.json \
  config/feed-variants/20220712-variant.json
```

Results in:

```shell
3c3
<   "description": "Blend of 20220603-variant-b and 20220603-variant-a",
---
>   "description": "Builds from 20220617-variant-a (see https://github.com/forem/forem/issues/18082)",
50a51,57
>     "following_author": {
>       "cases": [
>         [0, 0.8],
>         [1, 1]
>       ],
>       "fallback": 0.8
>     },
70,73c77,80
<         [0, 0.5],
<         [1, 0.85],
<         [2, 0.9],
<         [3, 0.95],
---
>         [0, 0.3],
>         [1, 0.9],
>         [2, 0.95],
>         [3, 0.98],
```
2022-07-12 14:51:47 -04:00
Joshua Wehner
5dee4a11c1
Allow trusted user to access response templates (#17978)
* Allow trusted user to access response templates

* Add request specs for trusted user templates

* WIP: was just investigating...

* Move permission check to authorizer

* Revert "WIP: was just investigating..."

This reverts commit c38c60f7ab19ce43c174729c2542a9041e9322e2.

* Improved accessibility

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2022-07-12 11:37:59 +02:00
Mac Siri
5579f3360c
Add DD service name for active_support and active_record (#18060) 2022-07-11 10:14:42 -04:00
Fernando Valverde
b8abbda72e
Unpublish post service class + V1 API endpoint (#18031)
* Unpublish post service + API

* Apply PR feedback

* Use module_function on service class
2022-07-08 09:08:55 -06:00
yheuhtozr
64dd92d60d
Supplement some new i18n keys (#18034)
* missing i18n updates

* i18n key typo hotfix

* more on actions panel template
2022-07-07 09:38:29 -06:00
Anna Buianova
ff76cdd3c5
Scheduling articles (#17939)
* Article query spec for scheduled articles

* Added scheduled article badge on the user dashboard

* Added published_at field to editor options

* Accept and validate published_at from editor

* Refactor published_at validation

* Allow 1-minute difference in published_at

* Notice on an unpublished article page

* Added specs for 'Click to edit' link on scheduled article preview page

* ContextNotification model

* Articles::Publish worker

* Added specs for articles publish worker

* Schedule publish articles worker

* Added tests to check for scheduled posts in feeds

* Don't allow managing scheduled articles

* Don't send notifications for scheduled articles

* Set published_at in Articles::Updater when publishing

* Published_at value in post options

* Pass timezone and set published_at accordingly

* Limit setting published_at to the future

* Readonly published_at for articles that were already published

* Chagning published_at format in editor v1 (start)

* Changed published_at format in frontmatter, specs

* Added specs for updating published_at from frontmatter

* Fixed accepting past published_at for articles published_from_feed

* Enabled published_at validation: don't allow updating published_at for already published articles

* Validate published_at on create

* Added a spec for updating published_at for exported articles

* Fixed specs related to creating articles with past published_at

* Fixed specs related to past published_at for articles

* Added a hack so that admins would be able to update published_at

* Switch button text schedule/publish when changin publishedAt

* Fixed saving published_at with timezone

* Added a feature flag for scheduling articles

* Default text in markdown editor depends on feature flag

* Enable article editor cache again

* Fixed the default value in the markdown editor

* Fix sitemaps spec

* Removed tooltip

* Fixed articles update specs

* Added missing locales

* Fixed article create specs

* Fixed spec

* Removed commented code

* Returned enabling extensions in the schema

* Returned accidentally deleted constraint

* Make articles query spec more stable

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Removed commented code

* Removed unused code

* A clearer policy

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>

* Use StringInquirer for article current state

* Added a note and todo to articles factory past trait

* Remove duplicated PropType

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>

* Refactor query in the Articles::PublishWorker

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Refactor articleForm.jsx

Co-authored-by: Mac Siri <krairit.siri@gmail.com>

* Removed specs that are no longer relevant

* Removed useless onKeyUp on a hidden input

* Refactored articleForm

* Hide scheduling from post options when published_at is readonly

* Run sends notifications worker every 5 minutes instead of every minute

Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2022-07-07 17:32:49 +03:00
Mac Siri
390cf0a6a0
Enable Rails 7 framework's default_headers (#18042) 2022-07-07 09:01:59 -04:00
Mac Siri
294fcba1e0
Add service_name scope to Datadog (#17996)
* Add service_name scope to datadog

* Fix typo

* Update config/initializers/datadog.rb
2022-07-01 11:32:45 -04:00
Arit Amana
750d379807
Allow ModRole & Admin to Suspend & Unsuspend User (#17946)
* gotta commit at some point

* out of gas

* IT'S WORKING NOW! 💥

* Cypress tests

* fix Travis failures

* incorporate PR review suggestions

* fix one failing Cypress test

* update API call

* add Unsuspend flow; fix Travis failures

* add tests for unsuspend flow

* remove unnecessary atrribute

* add article_policy spec

* fix failing Travis

* nudge Travis

* fix apparent typo  o o 🤷

* refactor a bunch of duplication

* nudge Travis

* fix Cypress failure related to authorizing moderator for user_status action

* rename modal partial

* remove unnecessary button-exists check

* address PR review suggestions

* hide suspend user btn after action

* toggle btn based on author suspension status

* add data-testids

* use data-testids

* controller refactor
2022-06-27 12:45:35 -04:00
Mac Siri
9dd52c24e1
Enable Rails 7's framework wrap_parameters_by_default & cookies_serializer (#17984) 2022-06-27 09:33:37 -04:00
Jeremy Friesen
b8533172e3
Introducing a quick and dirty fix for abtests/admin (#17982)
This is a "quick and dirty" hack.  Do I like it?  No.  Do I want to delve
into further debugging/refactoring of [a 72 line method][1]?  Not at the
moment.  There are a few pathways forward, but for now, this is the
pathway to hopefully give us insight into the

**Why will this likely address the issue?**

Prior to this commit, for an experiment we would render each of the
goals (anywhere from 8 to 11); each of which would require 2 expensive
queries; which means about 16 expensive queries.

After this commit, the experiment page has none of those expensive
queries; instead each goal now runs the 2 expensive queries.

The hope is that this will help us show the results (albeit on multiple
pages) while coming in under the response time out handlers we have in
place.

**Why no tests?**

Ugh; I know right?!?  I'm beginning to ask that myself.  But for now,
because this is only visible to tech_admins, the consequences of
breaking are limited.  In otherwords, this is not a customer facing
feature, so it can be a bit less robust in it's testing.  At least
that's the rationalization I'm establishing.

Further, local tests would not reveal the production environment
complications of large data sets.  The aforementioned expensive queries
are blisteringly fast on my local machine...in part because I don't much
field_test experiment data.

Closes forem/forem#17981

Related to:

- forem/forem#17895
- forem/forem#17869

[1]:ab2d7d29d0/lib/field_test/experiment.rb (L98-L160)
2022-06-24 09:26:46 -04:00
Fernando Valverde
8c836430ca
API V1 transition (#17835)
* API Articles v0-v1 restructure

* Remove unused helper

* Bulk move API controllers into concerns + add V1 controllers

* Extract API routes + some fixes

* Fix v1 api_controller authenticate! + add more article_controller specs

* Completed spec/requests/api/v1/articles_spec.rb

* specs up to listings

* All v1 specs except for 9 skips

* mime_types cleanup + authenticate! relocation

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
2022-06-23 14:26:00 -06:00
Mac Siri
2f029fe896
Enable Rails framework 7.0's isolation_level, partial_inserts, & raise_on_open_redirects (#17970) 2022-06-23 10:30:58 -04:00
Mac Siri
130b47e8b8
Enable Rails framework 7.0's TimeWithZone & scope-inversing (#17958) 2022-06-22 09:33:38 -04:00
Mac Siri
eed1946e8c
Enable Rails framework 7.0's ActionView & tests (#17948)
* Enable Rails framework 7.0's tests configs

* Enable action_view configs
2022-06-16 17:18:21 -04:00
Jeremy Friesen
8b7d724012
Adding 2022-06-17 feed variant (#17950)
Dependent on forem/forem#17942
Closes forem/forem#17949
2022-06-16 15:32:38 -04:00
Jeremy Friesen
7a4dd3286d
Adding VariantQuery reseed randomization option (#17942)
Prior to this change, we setup our feed variant query to have a cached
randomization seed.  For a given user this seed is cached for 15
minutes.  The goal of this is to provide mostly consistent sort orders
on the feed articles during that 15 minute window.

With this change, we allow for a feed variant to say ignore the cached
seed and generate a new one for this call.

I have also added explicit settings to each of the feed variants to
reflect our desired intentions for those features.

Relates to

- forem/forem#17833
- forem/forem#17826

Closes forem/forem#17940
2022-06-16 15:04:08 -04:00
Mac Siri
80d9b969bd
Enable Rails framework 7.0's ActiveStorage & ActionMailer (#17931) 2022-06-16 10:49:56 -04:00
Joshua Wehner
07e1364f54
Trusted users can view & use moderator response templates (#17867)
* Trusted users can use moderator response templates

* Iron out container reveal logic

* Explanatory comment on controller endpoint confusion
2022-06-16 14:05:49 +02:00
Jeremy Friesen
234fd8b08d
Adjusting field_test index and show page (#17895)
This change introduces several things things:

1. Fixes the performance of the `/admin/abtests` page; instead of
   rendering all of the experiment results, just render the overview.
2. Adjust the show page for an experiment to show the summary of
   results.
3. Favor the existing "started_at" and "ended_at" attributes of
   FieldTest (see https://github.com/ankane/field_test#config)
4. Update the field test experiments to include the `started_at` and
   `ended_at` attributes.
5. Skip processing all non-active experiments in our conversion handler.

Why are there no tests?  This is a page that is Admin only and is only
visible for reporting purposes.  So, it's not quite worth writing tests
as you'd need lots of data.  So we'll assume the logic from the upstream
[field_test gem][1] is adequate.

Closes forem/forem#17869

[1]:https://github.com/ankane/field_test
2022-06-13 12:22:36 -04:00
Mac Siri
dc55db5708
Change Rails load_defaults to 6.1 (#17877) 2022-06-13 10:40:53 -04:00
Mac Siri
686be06009
Enable cookies_same_site_protection :lax (#17875) 2022-06-09 16:04:39 -04:00
Josh Puetz
77a00d242a
Move API keys from Account tab to Extensions tab in settings (#17862) 2022-06-09 09:44:50 -05:00
Mac Siri
a87f70048c
Enable some Rails 6.1 framework default part2 (#17855)
* Enable form_with_generates_remote_forms and deliver_later_queue_name

* Change form_with_generates_remote_forms to true

* Move config to application.rb

* Enable urlsafe_csrf_tokens

* Update comment
2022-06-08 10:56:10 -04:00
Mac Siri
678dda8cf4
Routine Rubopcop lint fixes (#17844)
* Routine Rubopcop lint fixes

* Undo app_secrets_spec changes

* Fix broken spec
2022-06-07 10:17:16 -04:00
Mac Siri
fc9bfda0ce
Enable/remove some Rails 6.1 framework default (#17831)
* Default Rails 6.1's active_record & active_storage config

* Remove active_storage and action_mailbox from 6.1 default
2022-06-07 08:42:10 -04:00
Joshua Wehner
8be41307cf
Unpin article should behave more like Pin article (#17798)
* Unpin article should behave more like Pin article
* Don't repeat pinned article on index
2022-06-07 14:18:43 +02:00
Jeremy Friesen
3118f27197
Adding feed experiment for 2022-06-03 (#17824)
This commit contains two separate but related changes:

1. A check-list for creating a new experiment.
2. A new experiment along with declaring a winner for the previous experiment.

Below are the diffs of the two new variants versus the incumbent for the
experiment:

```
❯ diff config/feed-variants/20220603-variant-b.json config/feed-variants/20220518-variant.json
3,4c3
<   "description": "As 202205518-variant but with modificiation to `order_by` lever.",
<   "order_by": "final_order_by_random_weighted_to_score",
---
>   "order_by": "relevancy_score_and_publication_date",
```

```
❯ diff config/feed-variants/20220603-variant-a.json config/feed-variants/20220518-variant.json
3d2
<   "description": "As 202205518-variant but with modificiation to `matching_positive_tags_intersection_count`.",
69c68
<         [0, 0.5],
---
>         [0, 0.7],
```

Closes forem/forem#17822
2022-06-03 13:45:10 -04:00
Jeremy Friesen
8fb98b9f30
Exposing past feed experiments in /admin/abtests (#17818)
Prior to this commit, as a matter of undocumented practice, we would
overwrite past experiments with upcoming experiments.

With this commit, we're leveraging a feature of the field_test gem:
declaring a winner.  Instead of overwriting an experiment with the next
experiment, we're going to declare the expiring experiment's winner then
prepend to the ./config/field_test.yml the new experiment.

The [field_test/app/views/field_test/experiments/index.html.erb][1] then
uses logic to first render "active" experiments and "completed"
experiments.  A "completed" experiment is one in which we've declared a
winner.

Closes forem/forem#17816

[1]:https://github.com/ankane/field_test/blob/master/app/views/field_test/experiments/index.html.erb
2022-06-02 20:41:31 -04:00
Josh Puetz
d2e1bde2ee
Change API key limit from 20 to 10 (#17811) 2022-06-02 15:35:21 -05:00
Mac Siri
b10343b53f
Implement feed variant 20220525 (#17778) 2022-05-27 08:12:58 -04:00