Commit graph

8616 commits

Author SHA1 Message Date
Nick Taylor
d85d327c1d
[15 minute fix] Added custom Cypress command to create an article. (#13151) 2021-03-29 06:00:49 -04:00
dependabot[bot]
d47f4ffab0
Bump @testing-library/user-event from 13.0.10 to 13.0.16 (#13142)
Bumps [@testing-library/user-event](https://github.com/testing-library/user-event) from 13.0.10 to 13.0.16.
- [Release notes](https://github.com/testing-library/user-event/releases)
- [Changelog](https://github.com/testing-library/user-event/blob/master/CHANGELOG.md)
- [Commits](https://github.com/testing-library/user-event/compare/v13.0.10...v13.0.16)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-29 11:41:32 +02:00
dependabot[bot]
65c733ae60
Bump pusher from 2.0.0 to 2.0.1 (#13144)
Bumps [pusher](https://github.com/pusher/pusher-http-ruby) from 2.0.0 to 2.0.1.
- [Release notes](https://github.com/pusher/pusher-http-ruby/releases)
- [Changelog](https://github.com/pusher/pusher-http-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pusher/pusher-http-ruby/compare/2.0.0...2.0.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-26 17:39:55 +01:00
Michael Kohl
1732396abc
Remove ignored Buffer columns (#13139) 2021-03-26 17:37:29 +01:00
Suzanne Aitchison
49c20a0c72
15 min fix - improve reliability of autocomplete cypress test (#13147) 2021-03-26 16:23:19 +00:00
Julianna Tetreault
11f1c9d487
Add a landing_page boolean to the Pages table (#13135) [deploy]
- Adds default: false to landing_page column
 - Adds null: false to landing_page column
 - Adds migration file and updated schema
2021-03-26 08:09:18 -06:00
Suzanne Aitchison
45a291047d
Re-add mention autocomplete to comments, fixing bugs (#13126)
* Revert "Revert "Add (updated) mention autocomplete to post comments (#13061)" (#13116)"

This reverts commit e28bde043c.

* Fix issues with editing comments and arrow key navigation, update tests

* Update app/javascript/crayons/MentionAutocompleteTextArea/MentionAutocompleteTextArea.jsx

Co-authored-by: Nick Taylor <nick@forem.com>

* refactor adding of attributes

* destructure

Co-authored-by: Nick Taylor <nick@forem.com>
2021-03-26 13:43:05 +00:00
Andrew Bone
5a7173725c
Fix search confusion (#13130)
Search can currently be triggered by / or ? because they share the same code, to fix this I'm using the event's key instead
2021-03-26 11:08:56 +01:00
Suzanne Aitchison
1f8f348d5d
add skip link functionality to videos (#13113) 2021-03-26 10:23:45 +01:00
Vaidehi Joshi
a5f014f576
[15 Min Fix]: Fix incorrect scope used by metrics:overview rake task (#13138)
* Fix incorrect scope used by metrics:overview rake task

* Add spec for metrics:overview rake task

* Add guard clause to metrics:overview rake task
2021-03-25 17:31:10 -07:00
Fernando Valverde
f0b8754d4f
Feature: Runtime Content Filter (#13007)
* Working version of Runtime Filter with banner behind Feature Flag

* First attempt to add a cypress test

* Adds simplified test

* Cleanup global references

* Add multi-platform e2e test

* Use --runtime-display var with fallback to block

* Update app/assets/javascripts/initializers/runtime.js

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

* Add FeatureFlag stub to fix unrelated specs

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-03-25 12:04:45 -06:00
Fernando Valverde
99af03f819
Sanitize Rpush iOS PEM certificate (#13129) 2021-03-25 11:09:29 -06:00
Julianna Tetreault
c881fbd2b6
Adds flash messages to indicate successful actions for Pages (#13132) [deploy]
- Add flash messages to Admin::PagesController actions
 - Modify #destroy redirect_to to use path helper
2021-03-25 10:50:49 -06:00
Andy Zhao
ca265a13be
Fix more button not working after navigating back to the home page (#12612)
* Reinitialize variables in instantclick context

* Refactor and follow instantclick loading pattern elsewhere

* Actually fix conflicts oops

* Add navigation links to e2e seeds

* Add e2e tests for More button with instantclick

* Set element's onclick directly as opposed to use addEventListener

* Remove unnecessary null check

* Check for visibility instead of class list

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

* Chain .should since we can 👍

* Update test and seed data to account for merge

* Use .findAllByLabelText instead of .get

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
2021-03-25 12:48:41 -04:00
Nick Taylor
e28bde043c
Revert "Add (updated) mention autocomplete to post comments (#13061)" (#13116)
This reverts commit a23caead07.
2021-03-25 10:33:51 -04:00
Julianna Tetreault
af5a391429
Part 2: Shows Relevant Posts in Homepage Sidebar (#12942) [deploy]
* Adjust active_threads class method to display posts in homepage sidebar

* WIP: add specs around active_threads class method

* Uses newer AR query syntax in Article#active_threads

* WIP: Updates article_spec.rb to get tests passing

* WIP: Adjust test to return articles that dont fall into constraints

* Adjusts spec to update articles properly

* Adjust article.update_columns to match initial article columns

* Extracts .active_threads into a query object and removes class method
 - Removes class method from Article model
 - Removes class method tests from article_spec.rb
 - Adds Articles::ActiveThreadsQuery to app/queries/articles
 - Adds active_threads_query_spec.rb to spec/queries/articles
 - Replaces Article.active_threads with Articles::ActiveThreadsQuery
in _homepage_content.html.erb and _sidebar_activity.html.erb
 - General code clean up

* Rename number to count in Articles::ActiveThreadsQuery

* WIP new specs

* Update spec

* Repleaces let! with before block to appease rubocop

* Refactors Articles::ActiveThreadsQuery#call per PR review suggestion

* Calls Articles::ActiveThreadsQuery within articles_helper instead of view

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2021-03-25 08:03:55 -06:00
dependabot[bot]
751bd1b176
Bump liquid from 5.0.0 to 5.0.1 (#13121)
Bumps [liquid](https://github.com/Shopify/liquid) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/Shopify/liquid/releases)
- [Changelog](https://github.com/Shopify/liquid/blob/master/History.md)
- [Commits](https://github.com/Shopify/liquid/compare/v5.0.0...v5.0.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-25 08:39:09 -05:00
dependabot[bot]
914c26d09b
Bump rubocop from 1.11.0 to 1.12.0 (#13123)
Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.11.0 to 1.12.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.11.0...v1.12.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-25 08:38:49 -05:00
dependabot[bot]
9c4f104071
Bump css-loader from 5.1.3 to 5.2.0 (#13122) 2021-03-25 06:40:58 -04:00
Jamie Gaskins
b7695f6c2a
Add a GIN index on comments.ancestry (#13120)
We have a btree index on this table but it is not invoked with a `LIKE`
operation that uses `%` - only when using `LIKE` with an exact match.

This query is DEV's second-most intense query by total time spent with
a p50 latency of ~130ms. This index brings it down to 5ms at p90.
2021-03-25 10:22:08 +01:00
Suzanne Aitchison
e382a086bc
Add skip link functionality to dashboard pages (#13115)
* add skip link functionality to dashboard pages

* add skip link to listings dashboard

* add missed follow users dashboard
2021-03-25 09:45:01 +01:00
Suzanne Aitchison
000a30d8d7
add main content to notifications page (#13111) 2021-03-25 09:37:53 +01:00
Veggier
5249b99338
Connect room name overflow (#9561)
* change tag to h2 to avoid the overflow

* delect commit

* make the font size bigger when screen size is more than 1000px

* Update chat.scss

Co-authored-by: Michael Kohl <citizen428@dev.to>
Co-authored-by: Michael Kohl <me@citizen428.net>
2021-03-25 13:16:58 +07:00
Jacob Herrington
03465e8882
Add rake task to collect admin overview metrics (#13023)
* Add rake task to collect admin overview metrics

* Print the Forem Instance domain
2021-03-24 14:16:46 -05:00
Mac Siri
0834a7453f
Revert "Bump dogstatsd-ruby from 4.8.3 to 4.9.0 (#13110)" (#13117)
This reverts commit 8392b726a0.
2021-03-24 13:21:37 -04:00
Michael Kohl
8e992053c6
Remove buffer columns and buffer_updates table (#13104) 2021-03-24 16:06:02 +01:00
dependabot[bot]
0f1ec6caa8
Bump pusher from 1.4.3 to 2.0.0 (#13107)
Bumps [pusher](https://github.com/pusher/pusher-http-ruby) from 1.4.3 to 2.0.0.
- [Release notes](https://github.com/pusher/pusher-http-ruby/releases)
- [Changelog](https://github.com/pusher/pusher-http-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/pusher/pusher-http-ruby/compare/v1.4.3...2.0.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-24 15:41:29 +01:00
rhymes
83852038e4
[Search 2.0] Reading list (#13052)
* Step one in populating the reading list with PG

This first attempt tries to recycle the `Search::ArticleSerializer` which is only
used in input in ES, but we're using it in output in PG.
For this reason it's currently 15.55x times slower

* Serialize only what is requested by the frontend

`Search::ArticleSerializer` which is only used in ES in the indexing step aims
to add as much info as possible for broader purposes, in this case
(with serialization in output) we should aim to save only what's requested from
the frontend.

* Optimize selection of articles columns

* Select only needed columns for users

* Compute total of reading list items

* Attach the basic filtering based on PG on the search controller

* Restructure in methods

* Add tags support

* Use LIKE on articles.cached_tag_list

* Fix tags as nil

* Fix default pagination

* Add optional FTS for reading list

* Reworded the tags comment explaining why

* Add index to reactions.status

* Fix total counter in Preact readingList component

* Fix total count in reading list backend search

* Add GIN index to articles.cached_tag_list

* Add service tests

* Add search request specs

* Added missing early return

* Update spec/requests/search_spec.rb

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>

* Extract MAX_PER_PAGE constant and add comments

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2021-03-24 15:40:00 +01:00
dependabot[bot]
35d2984a9f
Bump elasticsearch from 7.11.2 to 7.12.0 (#13106)
Bumps [elasticsearch](https://github.com/elastic/elasticsearch-ruby) from 7.11.2 to 7.12.0.
- [Release notes](https://github.com/elastic/elasticsearch-ruby/releases)
- [Changelog](https://github.com/elastic/elasticsearch-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/elastic/elasticsearch-ruby/compare/v7.11.2...v7.12.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-24 15:29:25 +01:00
dependabot[bot]
8392b726a0
Bump dogstatsd-ruby from 4.8.3 to 4.9.0 (#13110)
Bumps [dogstatsd-ruby](https://github.com/DataDog/dogstatsd-ruby) from 4.8.3 to 4.9.0.
- [Release notes](https://github.com/DataDog/dogstatsd-ruby/releases)
- [Changelog](https://github.com/DataDog/dogstatsd-ruby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/DataDog/dogstatsd-ruby/compare/v4.8.3...v4.9.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-24 15:27:50 +01:00
dependabot[bot]
657468576e
Bump listen from 3.4.1 to 3.5.0 (#13105)
Bumps [listen](https://github.com/guard/listen) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/guard/listen/releases)
- [Commits](https://github.com/guard/listen/compare/v3.4.1...v3.5.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-24 09:10:10 -05:00
Andrew Bone
58499cefb3
Update shortcut code with best practices (#13026)
* Update with best practices

* Remove useCallback

* Update app/javascript/shared/components/useKeyboardShortcuts.js

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

* Fill out JSDoc

* Follow Prettier rules

* Resolve conflict

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-03-24 14:03:45 +00:00
Suzanne Aitchison
52bb1112e9
add skip link functionality to coc, terms and privacy pages (#13112) 2021-03-24 13:33:43 +00:00
dependabot[bot]
4f13d40ba4
Bump eslint-plugin-react from 7.23.0 to 7.23.1 (#13108)
Bumps [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) from 7.23.0 to 7.23.1.
- [Release notes](https://github.com/yannickcr/eslint-plugin-react/releases)
- [Changelog](https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yannickcr/eslint-plugin-react/compare/v7.23.0...v7.23.1)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-24 11:23:27 +00:00
dependabot[bot]
cb1ad7a2d7
Bump @testing-library/user-event from 13.0.7 to 13.0.10 (#13109) 2021-03-24 06:01:15 -04:00
Ramesh Naidu Allu
0911cd4a5c
Save valid attributes with ignoring the invalid ones (#12633)
* add save_valid_attributes method in profile

* undo save_valid_attributes method

* Render the settings page with user entered params incase of failed update
2021-03-24 10:42:58 +01:00
Anna Buianova
aca08cfb11
Added credits_awarded to badges (#13073)
* Added credits_awarded to badges

* Data update script for updating credits_awarded

* Data update script for updating credits_awarded

* Added null: false to badges.credits_awarded
2021-03-24 11:33:58 +03:00
Michael Kohl
7c31a9cc98
Remove buffer gem and related code: step 1 (#12993)
* Remove buffer gem and related code

* Remove more Buffer-related code

* Remove one more Buffer spec

* Remove DUS

* Remove more Buffer code
2021-03-24 09:58:38 +07:00
Nick Taylor
0beacb19c9
[15 Minute Fix] Added the prefer-const eslint rule (#13098) 2021-03-23 16:29:56 -04:00
Daniel Uber
08645c782c
Disable the User Fills Out Comment system spec (#13103)
This one file seems to be associated with segfaults we're observing in
TravisCI.

To narrow down the source of the issue, disable this set of tests. (If
segfaults continue, this was not the cause and should be re-enabled).

Co-authored-by: djuber <djuber@forem.beta-reduction.com>
2021-03-23 15:06:55 -05:00
Jamie Gaskins
ec39e0c000
Add an index to users.old_username (#13102)
We have one for username and for old_old_username, but not the one in
between.
2021-03-23 15:53:45 -04:00
Daniel Uber
7c45df1d81
Destroy user's sponsorships when destroying the user (#13100)
* Add a failing test

This is failing because sponsorships are not removed by Users::Delete,
and raises a foreign key constraint error because user.destroy tries
to remove a referenced user.

* When destroying a user, destroy associated sponsorships

There is a `belongs_to` relationship in sponsorships, and a has_many
relationship in Organization, this adds a mirror relation on User with
the equivalent dependent destroy rules.

If an organization is removed, all sponsorships belonging to that
organization are removed too, and now, if a user is removed, all
sponsorships created by that user are removed.

Co-authored-by: djuber <djuber@forem.beta-reduction.com>
2021-03-23 13:06:52 -05:00
Jamie Gaskins
68025ae472
Optimize Article.published scope to use an index (#13071)
* Optimize Article.published scope

The index on `articles.published` is not being invoked due to lack of
diversity in the values in that column (it only has 2 possible values
because it's a boolean).

The index on `articles.published_at` is extremely diverse and will be
invoked any time it can reduce the scope of a query by an order of
magnitude or more.

On DEV, this does not change the row count for the scope:

    irb(main):001:0> Article.where(published: true).count == Article.where(published: true).where(Arel.sql("published_at < now()")).count
    => true

The query plan for the `Articles::Feeds::LargeForemExperimental` service
invoked in the `Stories::FeedController#show` endpoint goes from this:

    Planning Time: 0.271 ms
    Execution Time: 329.258 ms

to this:

    Planning Time: 0.330 ms
    Execution Time: 0.468 ms

This is a reduction in query time of 99.7%

* Set published_at in articles factory

An article that is published should always have a `published_at`
timestamp

* Use Time.current for Zonebie

* Add clarifying comment to Article.published scope

* Generate timestamp in Ruby instead of SQL

I think using transactions for specs was interfering with comparing
timestamps generated in SQL, so this commit generates the timestamp in
Ruby.

* Move published_at outside of the transient block

This was causing articles to be marked as `published_at` right now even
if `published_at` was specified in the `FactoryBot.create` call.

* published_at: nil is no longer the factory default

* published_at is no longer nil by default

* published_at is no longer nil by default

* We didn't actually want to clear this published_at

This was intentionally left out to show that published_at does not get
cleared when we flip published true->false.
2021-03-23 13:07:27 -04:00
dependabot[bot]
de11f02297
Bump fog-aws from 3.9.0 to 3.10.0 (#13091)
Bumps [fog-aws](https://github.com/fog/fog-aws) from 3.9.0 to 3.10.0.
- [Release notes](https://github.com/fog/fog-aws/releases)
- [Changelog](https://github.com/fog/fog-aws/blob/master/CHANGELOG.md)
- [Commits](https://github.com/fog/fog-aws/compare/v3.9.0...v3.10.0)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-23 08:47:51 -05:00
dependabot[bot]
b0c56c43f7
Bump rubocop-performance from 1.10.1 to 1.10.2 (#13094)
Bumps [rubocop-performance](https://github.com/rubocop/rubocop-performance) from 1.10.1 to 1.10.2.
- [Release notes](https://github.com/rubocop/rubocop-performance/releases)
- [Changelog](https://github.com/rubocop/rubocop-performance/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-performance/compare/v1.10.1...v1.10.2)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-23 08:47:44 -05:00
dependabot[bot]
2f125a2e9d
Bump bootsnap from 1.7.2 to 1.7.3 (#13088)
Bumps [bootsnap](https://github.com/Shopify/bootsnap) from 1.7.2 to 1.7.3.
- [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.7.2...v1.7.3)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-23 08:47:21 -05:00
Jacob Herrington
d667490732
Ensure user data is unset if no user is logged in (#13024)
* Ensure loggd out user data is not in the document

* Use delete operator to remove user property

Another function relies on this value not existing. If this property
exists, but is set to undefined, it will not behave as expected.

* Add tests to verify user data does not persist in the DOM after logout

* Update cypress/integration/loginFlows/userLogout.spec.js

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>

* Fixup: Test localStorage for user data

Co-authored-by: Nick Taylor <nick@iamdeveloper.com>
2021-03-23 07:36:49 -05:00
dependabot[bot]
73e9566260
Bump @babel/plugin-transform-react-jsx from 7.12.17 to 7.13.12 (#13092)
Bumps [@babel/plugin-transform-react-jsx](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-react-jsx) from 7.12.17 to 7.13.12.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.13.12/packages/babel-plugin-transform-react-jsx)

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

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-23 12:41:45 +01:00
dependabot[bot]
d4c4a50d88
Bump @babel/preset-env from 7.13.10 to 7.13.12 (#13093) 2021-03-23 07:12:42 -04:00
dependabot[bot]
d1363effce
Bump eslint-plugin-react from 7.22.0 to 7.23.0 (#13090) 2021-03-23 07:12:16 -04:00