Commit graph

10635 commits

Author SHA1 Message Date
dependabot[bot]
8469161995
Bump octokit from 4.21.0 to 4.22.0 (#16096)
Bumps [octokit](https://github.com/octokit/octokit.rb) from 4.21.0 to 4.22.0.
- [Release notes](https://github.com/octokit/octokit.rb/releases)
- [Changelog](https://github.com/octokit/octokit.rb/blob/4-stable/RELEASE.md)
- [Commits](https://github.com/octokit/octokit.rb/compare/v4.21.0...v4.22.0)

---
updated-dependencies:
- dependency-name: octokit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-13 14:00:07 -05:00
dependabot[bot]
e88444430b
Bump nokogiri from 1.13.0 to 1.13.1 (#16097)
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.13.0 to 1.13.1.
- [Release notes](https://github.com/sparklemotion/nokogiri/releases)
- [Changelog](https://github.com/sparklemotion/nokogiri/blob/v1.13.1/CHANGELOG.md)
- [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.13.0...v1.13.1)

---
updated-dependencies:
- dependency-name: nokogiri
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-13 13:29:06 -05:00
yheuhtozr
f1c3138839
app/helpers i18n (#16003)
* app/helpers i18n

* tidy key names

* fix keys

* delete ja.yml

* fix spec

* fix spec 2

* fix for PR

* remove one key for PR

* delete ja.yml
2022-01-13 11:46:32 -05:00
Josh Puetz
629c7114da
Login with Google (#15986) 2022-01-13 10:25:52 -06:00
Michael Kohl
681ab3aac2
Enable use_cookies_with_metadata option (#16087) 2022-01-13 10:27:19 -05:00
Michael Kohl
813222a414
Remove explicit Zeitwerk config, require hack (#16086) 2022-01-13 20:56:47 +07:00
dependabot[bot]
9088c39bfe
Bump follow-redirects from 1.14.4 to 1.14.7 (#16089)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.4 to 1.14.7.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.4...v1.14.7)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-13 07:49:39 -05:00
Jeremy Friesen
05bad3ae10
Replacing custom call with existing cached method (#16083)
There's a few things going on:

1. I introduced [a change][1].
2. There was a [data script][2] that should've completed successfully, but
   some data was not converted (see [Blazer query on DEV.to][3])

Thus the current state of the data means that we have have serialized
data in an `OpenStruct` format and `Articles::CachedEntity` format.

This patch should work because the OpenStruct should previously have an
`image_profile_90` attribute.

In addition, I have added some recommendations and tests to better
describe what's happening.

[1]:9780dba380/app/models/articles/cached_entity.rb (L4)
[2]:9780dba380/lib/data_update_scripts/20200723070918_update_articles_cached_entities.rb (L1)
[3]:https://dev.to/admin/blazer/queries/609-serialized-data-in-mixed-forms
2022-01-13 07:48:32 -05:00
Jeremy Friesen
b115b2d17e
Appeasing Rubocop as it sneaks some changes in (#16085)
I was working on another branch and as part of my commit, Rubocop
removed a validation (but not the spec that asserted the validation).

Below is the "non-updating" rubocop offense on the other branch.

```shell
❯ rubocop ./app/models/notification_subscription.rb
Inspecting 1 file
C

Offenses:

app/models/notification_subscription.rb:13:29: C: [Correctable]
Rails/RedundantPresenceValidationOnBelongsTo: Remove explicit presence
validation for notifiable_id.
  validates :notifiable_id, presence: true
                            ^^^^^^^^^^^^^^

1 file inspected, 1 offense detected, 1 offense auto-correctable
```

To remediate, I ran:

```shell
> rubocop --only "Rails/RedundantPresenceValidationOnBelongsTo" \
  --auto-correct
```

This resolved the `app/models`.  Then did some regex magic and removed
the assertions from `spec/models`.

For Forem folks, I wrote a [forem.team post][1] discuss if this is how
we want to proceed.

[1]:https://forem.team/jeremy/rubocop-auto-updating-mayhem-33a6
2022-01-13 07:48:01 -05:00
Nick Taylor
ca646f65a9
Now HTML validation works for the adjust tags section of the moderation tools panel (#16062) 2022-01-13 07:11:44 -05:00
Jeremy Friesen
6929cd908c
Moving from 'should' syntax to 'expect' (#16084)
In Travis I found the following message:

> Using `should` from rspec-expectations' old `:should` syntax without
> explicitly enabling the syntax is deprecated. Use the new `:expect`
> syntax or explicitly enable `:should` with
> `config.expect_with(:rspec) > { |c| c.syntax = :should }`
> instead. Called from
> /home/travis/build/forem/forem/spec/models/html_variant_spec.rb:76:in
> `block (2 levels) in <main>'.
2022-01-13 00:33:42 -05:00
Ben Halpern
760a81383b
Change feed query limit to 25 (#16082) 2022-01-12 17:54:55 -05:00
Jeremy Friesen
9780dba380
Adding a convenience/optimiization method. (#16079)
* Adding a convenience/optimiization method.

Without this method, the `@object` will handle the `decorate` message;
which will go through the logic of determining the decorator class, and
isntantiating a new decorator.

Related to but orthogonal to #16078.

* Update app/decorators/application_decorator.rb

Co-authored-by: Jamie Gaskins <jamie@forem.com>

Co-authored-by: Jamie Gaskins <jamie@forem.com>
2022-01-12 16:28:13 -05:00
Arit Amana
a4f12d39d9
Complete implementation; add specs (#16081) 2022-01-12 15:45:59 -05:00
dependabot[bot]
2ca662cc5b
Bump honeycomb-beeline from 2.8.0 to 2.8.1 (#16080)
Bumps [honeycomb-beeline](https://github.com/honeycombio/beeline-ruby) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/honeycombio/beeline-ruby/releases)
- [Changelog](https://github.com/honeycombio/beeline-ruby/blob/main/CHANGELOG.md)
- [Commits](https://github.com/honeycombio/beeline-ruby/compare/v2.8.0...v2.8.1)

---
updated-dependencies:
- dependency-name: honeycomb-beeline
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-12 13:30:38 -05:00
Jeremy Friesen
a65954107f
Refactoring to add helper method (#16064)
* Refactoring to add helper method

Prior to this commit, we made view level calls to service modules.  This
refactor provides convenience methods on the model.

Furthermore, it addresses a few Rubocop violations that "come along for
the ride."

* Ensuring cached entity squaks like User

* Fixing broken spec

* Fixing typo
2022-01-12 11:21:44 -05:00
Daniel Uber
c489971ecf
Allow admin control of auth broadcast messages (was: Don't suggest apple authentication) (#16069)
* Don't send auth broadcasts for providers that are in beta

Currently we have :apple as a restricted provider (you can enable it,
but it's treated as beta here, rather than generally available).

While we were correctly checking if you had all GA providers enabled
in authenticated_with_all_providers?, we were incorrectly pulling
all enabled provider names in find_auth_broadcast (the message to send
the user), and picking apple_connect.

Since it doesn't make sense to omit apple id login from consideration
when checking if all available auth methods are used, then recommend
that it be used consistently, capture this "GA" state as a method, and
use it both in the test "does this user have all available identity
providers enabled?" and the selection "which identity provider can I
suggest they setup?" consistently.

Since we're about to enable google as an auth source (in #15986) I'll
check with Josh if he expects this to be GA on release or in limited
beta.

* Clean up authenticated_with_all_providers?

We have a method identities that returns the enabled identities for
the user (a relation), and a method ga_providers that returns a list
of enabled and not beta provider symbols.

Change the set difference to use Array#all? (which will exit early on
the first failure). Efficiency note: while I think this reads
better,it's possible this issues a number of small (cheap) queries for
identity by user id and provider id, but there's a unique index on
(provider, user_id) that should be effective.

* Only check providers that have active broadcast messages

An admin can stop sending "connect using apple" follow ups by
disabling that broadcast.

I randomized the enabled/active broadcasts for connection options so
they're not always pulling the same (facebook? apple?) option every
time.

* Clean up lost thought in comment
2022-01-12 09:59:14 -06:00
Michael Kohl
f471ba9bd6
Don't load ActiveJob railtie (#16074) 2022-01-12 22:29:54 +07:00
Michael Kohl
92b1958181
Remove IE-specific setting (#16073) 2022-01-12 22:16:57 +07:00
Jeremy Friesen
0a1b222bb7
Moving the "Null" user object closer to User (#16070)
* Moving the "Null" user object closer to User

Prior to this commit, we had the presentation concept of a DELETED_USER
in the ApplicationHelper.  Further, we did type checks against that
object instead of relying attributes of the object.

With this commit, I moved the "Null" user closer to the User definition
to help highlight the concept that there might be deleted users.

I didn't remove all of the type checks, but did attempt to create a more
"duck-type" object.

Further, I moved away from an OpenStruct which in the past (and perhaps
present) had performance issues.

* Moving DeletedUser into Users module space
2022-01-12 08:45:01 -05:00
Ben Halpern
bd8b3b5ddc
Adjust in-feed-comment p margin for readability (#16068) 2022-01-12 07:46:04 -05:00
Michael Kohl
3a4fce3b88
Enable AR cache versioning (#16043) 2022-01-12 13:21:16 +07:00
Michael Kohl
3143febb4b
Enable safe Rails 6.1 defaults (#16045) 2022-01-12 10:12:51 +07:00
Daniel Uber
f20b8bd412
Prefer named comparison #after? to numeric comparison on times (#16057)
ActiveSupport adds DateAndTime::Calculations#after? (and before?) -
which clarifies intent (users newer than the relative time are
skipped) of the early returns.
2022-01-11 15:34:20 -06:00
Daniel Uber
6f2cf0e9fd
Add one day to the new users range (#16065)
The download app broadcast (in the Generator) returns early if the
user was created less than 7 days ago. It seems counterproductive to
filter out _only_ users created in the last 7 days.

Add one day to the query range, so users created less than 8 days ago,
but more than 7 days ago, receive the final message.
2022-01-11 15:33:33 -06:00
Daniel Uber
fadc84f47e
Add apple_connect welcome notification broadcast (#16063)
* Generator output

Add your logic here!

* replicate the logic from the forem connect migration

* Add data update script

This will generate the expected broadcast message to fix #16059

* Add apple connect to seeds file
2022-01-11 14:34:19 -06:00
Daniel Uber
6a9757c8ef
Modify welcome notification generator to handle errors per-message (#16060)
* Modify welcome notification generator to handle errors per-message

The original flow aborted all processing when any
ActiveRecord::RecordNotFound exception was raised. This causes a
situation where a missing broadcast message (by title) causes that
notification message to fail, and each day the same failure to
occur (since it wasn't successfully sent the day before), blocking all
further messages.

We want these to proceed on the schedule implicit in the checks, and
failing early prevents that.

Modify the error handling to catch RecordNotFound on each message, and
continue throught the checks until a notification is enqueued or all
checks have been attempted.

* Run welcome broadcast check 4 hours after the user was created

This started to fail when I modified the generator (why? because the
user was 7 days old and _other_ notifications would be sent).

Ensure the user is 4 hours old before checking that the disabled
welcome broadcast message is checked, and not sent.
2022-01-11 14:27:21 -06:00
Daniel Uber
1db02f355c
Simplify and label date calculation (#16052)
* Name the created after timestamp and remove temporary variables

The logic used to calculate the live at time, the week ago time, then
compare them to find the more recent value.

Move all of this logic to a method (there's a guard to exit if
the setting is nil, so this should be safe).

* Mark method private

This is not part of the public api (for workers, this should be
`#perform` alone). Mark it private
2022-01-11 14:09:11 -06:00
Arit Amana
7dc59eb4bf
Raise Error with Invalid UnifiedEmbed URL (#16051)
* raise error with invalid embed url

* fix spec; update docs
2022-01-11 14:55:06 -05:00
dependabot[bot]
1a10bfd70d
Bump bootsnap from 1.9.3 to 1.9.4 (#16058)
Bumps [bootsnap](https://github.com/Shopify/bootsnap) from 1.9.3 to 1.9.4.
- [Release notes](https://github.com/Shopify/bootsnap/releases)
- [Changelog](https://github.com/Shopify/bootsnap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Shopify/bootsnap/compare/v1.9.3...v1.9.4)

---
updated-dependencies:
- dependency-name: bootsnap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-11 11:53:06 -07:00
Ben Halpern
294b3471af
Proposing feed experiment 3: More comment count weight (#15993)
* Initial work

* Implement strategy injection into WeightedQueryStrategy

* Modify field_test config and adding variants

* Change orginal to constant and make some other adjustments

* Fix hardcoded test values
2022-01-11 11:05:06 -05:00
Nick Taylor
ed003d3ab4
Refactored client-side onboarding redirect logic. (#16026) 2022-01-11 07:04:06 -05:00
dependabot[bot]
70a5a6b4b9
Bump @storybook/preact from 6.4.9 to 6.4.10 (#16040)
Bumps [@storybook/preact](https://github.com/storybookjs/storybook/tree/HEAD/app/preact) from 6.4.9 to 6.4.10.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.4.10/app/preact)

---
updated-dependencies:
- dependency-name: "@storybook/preact"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-11 10:06:01 +00:00
dependabot[bot]
c4b47e8b3d
Bump babel-jest from 27.4.5 to 27.4.6 (#16021)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-11 10:29:21 +07:00
dependabot[bot]
b3d89b608f
Bump lint-staged from 12.1.5 to 12.1.7 (#16038)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-11 10:16:54 +07:00
Michael Kohl
76a6466645
Use crayons_icon_tag for user and org views (#16014) 2022-01-11 10:10:21 +07:00
yheuhtozr
b120f3a241
app/controllers/api i18n (#16002) 2022-01-11 10:05:54 +07:00
yheuhtozr
d794e70cbc
small non-views ruby i18n (#16004) 2022-01-11 10:05:18 +07:00
dependabot[bot]
9412d864bb
Bump @storybook/manager-webpack5 from 6.4.9 to 6.4.10 (#16036)
Bumps [@storybook/manager-webpack5](https://github.com/storybookjs/storybook/tree/HEAD/lib/core) from 6.4.9 to 6.4.10.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.4.10/lib/core)

---
updated-dependencies:
- dependency-name: "@storybook/manager-webpack5"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-10 15:15:15 -07:00
dependabot[bot]
4039227d59
Bump @storybook/addon-a11y from 6.4.9 to 6.4.10 (#16031)
Bumps [@storybook/addon-a11y](https://github.com/storybookjs/storybook/tree/HEAD/addons/a11y) from 6.4.9 to 6.4.10.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.4.10/addons/a11y)

---
updated-dependencies:
- dependency-name: "@storybook/addon-a11y"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-10 14:43:19 -07:00
Daniel Uber
4180287e70
Migrate faker dependency to supported upstream (#16037)
* Move faker package to supported(?) upstream

* Import from new package
2022-01-10 15:00:48 -06:00
Jeremy Friesen
c5bf4bf880
Extracting duplicate logic (#16035)
Prior to this commit, we had two places that need to know the nuances
ofquerying for tag flares and what we should include in our queries for
serialization.

With this commit, we're factoring towards a common source of knowledge
and providing a much needed test for the expected output of this
serialization.

Loosely related to #15916, #15983, #15994, and #16032.
2022-01-10 15:19:04 -05:00
Julianna Tetreault
03d4c50dfc
Small grammatical updates to the config constants (#16034) 2022-01-10 13:06:56 -07:00
dependabot[bot]
baa87a9829
Bump @storybook/addon-storysource from 6.4.9 to 6.4.10 (#16029)
Bumps [@storybook/addon-storysource](https://github.com/storybookjs/storybook/tree/HEAD/addons/storysource) from 6.4.9 to 6.4.10.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.4.10/addons/storysource)

---
updated-dependencies:
- dependency-name: "@storybook/addon-storysource"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-10 13:01:04 -07:00
dependabot[bot]
bbf584690c
Bump @storybook/addon-actions from 6.4.9 to 6.4.10 (#16030)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-10 14:56:17 -05:00
Jeremy Friesen
b8105661d0
Removing unused Search::ArticleSerializer (#16032)
Below are the grep results of searching for ArticleSerializer (note
there are no remaining `Search::ArticleSerializer' references).

Using `ripgrep` (e.g., `rg`), I have the following from the `main`
branch.

```log
> rg ArticleSerializer
app/services/search/reading_list.rb:
  Search::ReadingListArticleSerializer
app/services/search/article.rb:
  Homepage::ArticleSerializer
app/services/homepage/fetch_articles.rb:
  Homepage::ArticleSerializer
spec/serializers/search/reading_list_article_serializer_spec.rb:
  RSpec.describe Search::ReadingListArticleSerializer do
app/serializers/search/reading_list_article_serializer.rb:
  class ReadingListArticleSerializer < ApplicationSerializer
app/serializers/homepage/article_serializer.rb:
  class ArticleSerializer < ApplicationSerializer
```

Definitely want to keep pruning unused code.

This relates to exploration around #15916 and the attempted solutions in
2022-01-10 13:57:50 -05:00
Michael Kohl
6c26a8b40e
Update framework defaults (#15988)
* Update framework defaults to 6.0

* Update application.rb
2022-01-10 13:35:28 -05:00
dependabot[bot]
62864eae09
Bump sass from 1.45.2 to 1.47.0 (#16027)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-10 12:44:59 -05:00
Jeremy Friesen
f45e784e7f
Favor using existing variable over re-parsing (#15995)
While working on #15916 (via #15983 and later #15994) I was exploring if
we needed to stringify JSON values.  I also injected a few `try, catch,
debug` areas.

Consolidating the parsing does not appear to adversely affect things.
2022-01-10 12:33:31 -05:00
dependabot[bot]
623da55b5a
Bump @storybook/addon-links from 6.4.9 to 6.4.10 (#16016)
Bumps [@storybook/addon-links](https://github.com/storybookjs/storybook/tree/HEAD/addons/links) from 6.4.9 to 6.4.10.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v6.4.10/addons/links)

---
updated-dependencies:
- dependency-name: "@storybook/addon-links"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-10 10:30:22 -07:00