Commit graph

10724 commits

Author SHA1 Message Date
Nick Taylor
df8c12950c
Configured the repository to handle line endings (#16234) 2022-01-21 08:57:05 -05:00
Nick Taylor
13fc65953b
Removed font-awesome from the admin section (#16239) 2022-01-21 08:56:22 -05:00
ludwiczakpawel
faa054fa49
fix (#16244) 2022-01-21 11:58:18 +01:00
Suzanne Aitchison
c92b3367ae
remove assignment of css variable to undefined (#16243) 2022-01-21 10:07:07 +00:00
Suzanne Aitchison
222ce06f0f
Add new tag autocomplete to editor (#16025)
* add default placeholder, remove focus on first load

* fix some bugs re autofocus and mouse click to select

* allow custom selected styles to be passed in

* operate on objects with name property rather than plain strings

* WIP main functionality in place

* set default selections, allow a max to be placed on selections

* switch help context

* bug fixes to edit mode, static suggestions

* make sure suggestion resumes when edit begins

* cleanup and docs

* update existing form test

* add component tests

* add more component test cases

* refactor max selections flow, ensure default tag data only loads once

* stop removing combobox properties now the input stays visible

* add max selections test

* refactor

* make sure input refocus happens after blur event

* update cypress tests

* some small renames and doc changes

* only fetch exact matches from added tags

* fix test, update dark theme background

* set a max height on the popover, and ensure options can be scrolled into view

* woops - max height

* Update app/javascript/article-form/components/TagsField.jsx

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

* refactors

* stop dropdown from flickering

* use ButtonNew

* remove redundant variant

* nudge PR checks

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2022-01-21 08:58:05 +00:00
ludwiczakpawel
87ff8f16a1
Color tokens (#16107) 2022-01-21 07:41:03 +01:00
Michael Kohl
6099d3640d
ListingsToolkit refactoring (#16184) 2022-01-21 09:27:10 +07:00
Jeremy Friesen
af2e1f0545
Expanding the range of followed tags we show (#16213)
The fix might be a bit of a work-around for a more general approach, but
we're fighting against the magic of the points vs. explicit_points
tension as defined in the [Follows::UpdatePointsWorker][1].

That is to say, it's possible (and happens) where I have assigned an
`explicit_points` of 1 for a tag, but the calculated `points` are less
than 1.  The calculated `points` are what we send forward in the
[AsyncInfoController][1] (by way of the
[UserDecorator#cached_followed_tags][3] method).

In DEV, I ran the following queries:

**User assigned points `>= 1` but calculated `< 1`**

985,352 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points < 1
  AND explicit_points >= 1;
```

**User assigned points `>= 1` but calculated `>= 1`**

5,366,478 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points >= 1
  AND explicit_points >= 1;
```

**User assigned points `>= 1` but calculated `>= 0`**

0 records.

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points <= 0
  AND explicit_points >= 1;
```

**User assigned points `<= 0` but calculated `> 0`**

1,146 records

```sql
SELECT count(id)
FROM follows
WHERE followable_type = 'ActsAsTaggableOn::Tag'
  AND points > 0
  AND explicit_points <= 0;
```

Synthesizing that, almost 1 million tag follows of the total 6.3 million
are not showing up in the user's left navigation.  And 5.3 million are
roughly correct.

In adjusting the logic, we're now going to have more tags showing up in
the left.  And just over 1,000 might now show up that would be unexpected.

Closes #14937.

[1]:c63e0b629e/app/workers/follows/update_points_worker.rb
[2]:c63e0b629e/app/controllers/async_info_controller.rb (L40-L65)
[3]:c63e0b629e/app/decorators/user_decorator.rb (L23-L34)
2022-01-20 19:46:42 -05:00
Jeremy Friesen
711f1bb0cd
Let override of ToS and CoC show in onboarding (#16217)
* Let override of ToS and CoC show in onboarding

Prior to this commit any changes to the terms or code of conduct were
not reflected in the onboarding links.

With this commit, I'm leveraging a newly created method that first
checks if there's a page for the given slug.  If there is, use that
page's copy.

To test:

- Overwrite default /terms page on a Forem
- Navigate to /onboarding or sign up as a new user
- Click on Terms of Use link text
- Review Terms of Use

Closes #15296

* Adding spec around not passing a block
2022-01-20 19:45:39 -05:00
dependabot[bot]
6e16ca6eb3
Bump stripe from 5.42.0 to 5.43.0 (#16233)
Bumps [stripe](https://github.com/stripe/stripe-ruby) from 5.42.0 to 5.43.0.
- [Release notes](https://github.com/stripe/stripe-ruby/releases)
- [Changelog](https://github.com/stripe/stripe-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stripe/stripe-ruby/compare/v5.42.0...v5.43.0)

---
updated-dependencies:
- dependency-name: stripe
  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-20 13:33:31 -07:00
dependabot[bot]
7adbd66fd6
Bump flipper-active_record from 0.23.0 to 0.23.1 (#16231)
Bumps [flipper-active_record](https://github.com/jnunemaker/flipper) from 0.23.0 to 0.23.1.
- [Release notes](https://github.com/jnunemaker/flipper/releases)
- [Changelog](https://github.com/jnunemaker/flipper/blob/master/Changelog.md)
- [Commits](https://github.com/jnunemaker/flipper/compare/v0.23.0...v0.23.1)

---
updated-dependencies:
- dependency-name: flipper-active_record
  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-20 12:13:33 -07:00
dependabot[bot]
01edfdb4b8
Bump flipper-ui from 0.23.0 to 0.23.1 (#16232)
Bumps [flipper-ui](https://github.com/jnunemaker/flipper) from 0.23.0 to 0.23.1.
- [Release notes](https://github.com/jnunemaker/flipper/releases)
- [Changelog](https://github.com/jnunemaker/flipper/blob/master/Changelog.md)
- [Commits](https://github.com/jnunemaker/flipper/compare/v0.23.0...v0.23.1)

---
updated-dependencies:
- dependency-name: flipper-ui
  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-20 11:54:14 -07:00
dependabot[bot]
73a9c17bd8
Bump flipper-active_support_cache_store from 0.23.0 to 0.23.1 (#16230)
Bumps [flipper-active_support_cache_store](https://github.com/jnunemaker/flipper) from 0.23.0 to 0.23.1.
- [Release notes](https://github.com/jnunemaker/flipper/releases)
- [Changelog](https://github.com/jnunemaker/flipper/blob/master/Changelog.md)
- [Commits](https://github.com/jnunemaker/flipper/compare/v0.23.0...v0.23.1)

---
updated-dependencies:
- dependency-name: flipper-active_support_cache_store
  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-20 11:31:34 -07:00
dependabot[bot]
4d0cecbc45
Bump js-routes from 2.2.0 to 2.2.1 (#16229)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-20 13:31:26 -05:00
Julianna Tetreault
8c440885a8
Adds suggested_tags to Onboarding section in Config (#16228) 2022-01-20 11:13:40 -07:00
Josh Puetz
4f24c5ff43
Constantize broadcast messages (#16219) 2022-01-20 11:47:01 -06:00
yheuhtozr
53564c2849
app/mailers i18n (#16191)
* app/mailers i18n

* delete ja.yml
2022-01-20 07:33:29 -07:00
Julianna Tetreault
615137a883
Remove the "Getting Started" Section from the Config (#16033)
* Removes the Getting Started section and related code from the config

* Removes the admin_manages_configuration_spec.rb

* Removes "Required" tags from Config

* Reverts removal of activateMissingKeysModal

* Removes mandatory.rb
2022-01-20 07:31:35 -07:00
yheuhtozr
71b2724faa
app/services i18n (#16189) 2022-01-20 09:25:25 -05:00
Arit Amana
ea6bd0f366
Implement Unified Embed for Tweet URLs (#16218)
* building

* complete implementation and add specs
2022-01-20 08:05:56 -05:00
ludwiczakpawel
43c188eafb
Updated indicators (#16190) 2022-01-20 06:25:10 +01:00
Michael Kohl
4f1a5b5a39
Move BlackBox to app/lib (#16183) 2022-01-20 09:37:53 +07:00
dependabot[bot]
2c462700e7
Bump flipper from 0.23.0 to 0.23.1 (#16215)
Bumps [flipper](https://github.com/jnunemaker/flipper) from 0.23.0 to 0.23.1.
- [Release notes](https://github.com/jnunemaker/flipper/releases)
- [Changelog](https://github.com/jnunemaker/flipper/blob/master/Changelog.md)
- [Commits](https://github.com/jnunemaker/flipper/compare/v0.23.0...v0.23.1)

---
updated-dependencies:
- dependency-name: flipper
  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-19 11:38:33 -07:00
dependabot[bot]
7510f7bc1d
Bump honeybadger from 4.9.0 to 4.10.0 (#16214)
Bumps [honeybadger](https://github.com/honeybadger-io/honeybadger-ruby) from 4.9.0 to 4.10.0.
- [Release notes](https://github.com/honeybadger-io/honeybadger-ruby/releases)
- [Changelog](https://github.com/honeybadger-io/honeybadger-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/honeybadger-io/honeybadger-ruby/compare/v4.9.0...v4.10.0)

---
updated-dependencies:
- dependency-name: honeybadger
  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-19 11:31:58 -07:00
Michael Kohl
c8fbc97b60
Re-enable stories specs (#16182)
* Re-enable stories specs

* Travis wake up
2022-01-19 13:14:31 -05:00
Mac Siri
c63e0b629e
Bump Travis's postgresql to 13 (#16108) 2022-01-19 10:31:08 -05:00
Daniel Uber
f2a8cbce7e
Remove "connect" feedback message special treatment (#16167)
* Remove special handling of "connect" feedback by name

The special casing was related to "connect" feedback having both a
reporter and an offender. Check for offender instead.

Additionally, there was special casing in the controller to rate-limit
connect feedback separately from other channels. Since connect doesn't
exist, we should not need this.

There's a small bit of functionality (when I post to feedback_messages, the
number of feedback messages increases) that was removed from the test
case, we can add that back (and "connect" type, and
offender_id attributes) since it looks like it might have been a
useful assertion.

* Add back feedback message controller creates feedback message case

This was removed in the last commit because it was in a "connect" chat
channel context, but the basic "should persist a record" test was
otherwise valid. Submit an abuse-report rather than a connect message
report.

* typo

feeedback, woops.
2022-01-19 08:32:10 -06:00
Michael Kohl
2533a438f7
Rubocop auto-correct (#16181) 2022-01-19 21:04:43 +07:00
Mac Siri
3685530969
Explicitly silence FastImage exceptions (#16176) 2022-01-19 08:56:26 -05:00
yheuhtozr
adc757f5a5
app/validators i18n (#16166) 2022-01-19 05:25:39 -05:00
Jane ♥
d5348995c1
Finishes adding all the codepen embed options available (#16102)
Co-authored-by: JaneOri <7545075+James0x57@users.noreply.github.com>
Co-authored-by: Michael Kohl <me@citizen428.net>
2022-01-19 09:23:15 +07:00
dependabot[bot]
b4b12a993a
Bump rubocop from 1.24.1 to 1.25.0 (#16171)
* Bump rubocop from 1.24.1 to 1.25.0

Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.24.1 to 1.25.0.
- [Release notes](https://github.com/rubocop/rubocop/releases)
- [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop/compare/v1.24.1...v1.25.0)

---
updated-dependencies:
- dependency-name: rubocop
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

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

* Appeasing rubocop

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeremy Friesen <jeremy.n.friesen@gmail.com>
2022-01-18 19:46:42 -05:00
Daniel Uber
394d33e134
Select max from a subquery of two things (#16177)
* Select max from a subquery of two things

max(int, int) not a function, says postgres, once it stopped yelling
about parenthesis balancing.

* prefer greatest to select max from subquery
2022-01-18 18:21:14 -05:00
Jeremy Friesen
06f6573436
Ensuring that we don't divide by zero (#16172)
* Ensuring that we don't divide by zero

Adding one to a "always-ish greater than or equal to 0" value.  This
should resolve a flakey test and a seemingly erratic production error.

Resolves https://app.honeybadger.io/projects/66984/faults/83596547

* Favoring min over adding 1

Due to syncrhonization antics, let's not assume time is consistent
across servers.

Timey Whimey Wibbley Wobbley

* Update app/services/articles/feeds/weighted_query_strategy.rb

Co-authored-by: Daniel Uber <djuber@gmail.com>

Co-authored-by: Daniel Uber <djuber@gmail.com>
2022-01-18 17:25:15 -05:00
Jamie Gaskins
ebdaaaf15b
Revert "Support alternate S3 endpoints" (#16173) 2022-01-18 14:11:18 -05:00
dependabot[bot]
d3bffb507f
Bump request_store from 1.5.0 to 1.5.1 (#16170)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-01-18 13:43:12 -05:00
dependabot[bot]
5240d9d8ee
Bump ddtrace from 0.54.1 to 0.54.2 (#16169)
Bumps [ddtrace](https://github.com/DataDog/dd-trace-rb) from 0.54.1 to 0.54.2.
- [Release notes](https://github.com/DataDog/dd-trace-rb/releases)
- [Changelog](https://github.com/DataDog/dd-trace-rb/blob/v0.54.2/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dd-trace-rb/compare/v0.54.1...v0.54.2)

---
updated-dependencies:
- dependency-name: ddtrace
  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-18 11:26:54 -07:00
Dwight Scott
9375ba4932
allow approved tags to show articles and not render 404 (#16101) 2022-01-18 13:09:19 -05:00
Jamie Gaskins
8bdb2b6d8b
Support alternate S3 endpoints (#15445)
* Support alternate S3 endpoints

* Add missing comma

This is why we should use trailing commas

* Provide sample S3 endpoint config

* Comment out S3 image-storage config in .env_sample

See https://github.com/forem/forem/pull/15445#discussion_r754525723
2022-01-18 11:34:42 -05:00
Daniel Uber
97d62bac69
Move basic feed test for blocked users (#16165) 2022-01-18 10:32:48 -06:00
yheuhtozr
617d66c4e5
app/liquid_tags i18n (#16125) 2022-01-18 11:28:38 -05:00
Jeremy Friesen
5ec47d99dc
Ensuring we don't track views of author or unpublished (#16143)
* Ensuring we don't track views of author or unpublished

Prior to this commit, I was surprised to learn that we:

1) Tracked an author's view of their article.
2) Tracked views of an unpublished article.

This came up from a Forem creator asking if they could reset the view
counter.  Or trigger the reset on publication.

I think a general business logic policy of don't track views for the
author and don't track views for unpublished articles is a reasonable
default.

Were we to pursue the clear views on publication, we'd need to consider
something that went from unpublished -> published -> unpublished ->
published.  Without a more explicit state machine, triggering a
busineiss logic behavior seems a bit unexpected.

In other words, I wrote an article.  There are 20 views when I realize
that I need to unpublished it.  I make the changes in the unpublished
state, and re-publish.  I'd assume that those 20 views would still be
"recorded" and counted towards my article's view counts.

* Adjusting condition structure

Prior to this commit, the `if` clause was rather far to the right.  This
helps make the if clause more pronounced.
2022-01-18 11:23:18 -05:00
Jamie Gaskins
dd8aeee58e
Move work from template to controller (#16092)
* Move work from template to controller

* Render only the final result with the template
2022-01-18 11:21:25 -05:00
Julianna Tetreault
46d40b2f54
Resolves rubocop violations in weighted_query_strategy.rb (#16164) 2022-01-18 09:11:41 -07:00
Daniel Uber
71dcc7d53f
Move system tests (#16077)
* Move browser based test for article feed into spec/system

* Move user subscription tag system tests to spec/system
2022-01-18 08:08:41 -06:00
Michael Kohl
19d6a26f7b
Update remaining Crayons icons (#16100)
Co-authored-by: Nick Taylor <nick@forem.com>
2022-01-18 13:41:04 +07:00
Michael Kohl
9cc01b2c30
Remove unused Users::ProfileImageGenerator::BACKGROUND_HEXES (#16132) 2022-01-18 10:32:52 +07:00
Anshuman Bhardwaj
e2e54b35c6
Series count to only include non empty series (#16130)
Co-authored-by: Michael Kohl <me@citizen428.net>
2022-01-18 10:22:34 +07:00
Daniel Uber
f90459d163
Include badge before serializing (#16160)
We are loading the badge for each included tag in the
Search::TagSerializer and seeing warnings from bullet

```
Bullet::Notification::UnoptimizedQueryError:

GET /search/tags?name=ta
USE eager loading detected
  Tag => [:badge]
  Add to your query: .includes([:badge])

Call stack
  /home/travis/build/forem/forem/app/serializers/search/tag_serializer.rb:5:in `block in <class:TagSerializer>'
  /home/travis/build/forem/forem/app/services/search/tag.rb:11:in `serialize'
  /home/travis/build/forem/forem/app/services/search/tag.rb:7:in `search_documents'
  /home/travis/build/forem/forem/app/controllers/search_controller.rb:54:in `tags'
  /home/travis/build/forem/forem/app/lib/middlewares/set_time_zone.rb:10:in `call'
```

Follow the advice, now when multiple tags are in the result set,
having multiple badges, badges are loaded only once (at query time)
and not one by one (at serialization time).
2022-01-17 17:12:52 -06:00
Jeremy Friesen
e1a88d6f81
Allow for skipping navigation link creation (#16112)
* Allow for skipping navigation link creation

This commit provides a possible solution for preventing the re-creation
of a navigation link deleted by a Forem creator.

What I need is a discussion around the life-cycle of the application
installation and updates.

In particular, does this provide a robust enough mechanism for resolving
the issue at hand?

_Note: it pains me to ask about a user's role, but this is provided as a
point of discussion and possible implementationi to address the
underlying issue.  But I'm referencing a constant in the Rake task so
hopefully that will help future refactors.  Also, it's one reason I
needed to remove the `private_constant` declaration._

If we accept this code change, a future task is to document the ENV and
behavior.

Closes #15960

**Further considerations**:

- How might we refine this to not be as "role" reliant?
- Could we have a Site::Setting that we enable/disable
  regarding the navigation links?

Regarding QA:

- Start from an empty database
- Run setup
- Verify Navigation Link exists
- Delete Navigation Link
- Run setup again
- Verify Navigation Link exists (because we don't have a user)
- Run seeds
- Delete Navigation Link
- Run setup again
- Verify Navigation Link exists (because we don't have a user)

```shell
$ cd ./path/to/forem/repo

$ rails db:drop db:create db:schema:load

$ bin/setup

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => true

$ bin/rails runner "NavigationLink.where(url: '/readinglist').delete_all"

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => false

$ bin/setup

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => true

$ bin/rails db:seed

$ bin/rails runner "NavigationLink.where(url: '/readinglist').delete_all"

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"
  => false

$ bin/setup

$ bin/rails runner "puts NavigationLink.where(url: '/readinglist').exists?"c
  => false
```

* Bump for travis
2022-01-17 17:22:24 -05:00