Commit graph

5249 commits

Author SHA1 Message Date
Jacob Herrington
514b06afd4
Remove unused code (#13305) 2021-04-08 08:50:59 -05:00
Nick Taylor
86deddbb75
Fixed Reading List on Mobile + Small Improvements (#12755)
* Some div soup to semantic markup.

* Small refactor to inline mapping of available tags.

* Renamed <ItemListTags /> component to <TagList />.

* Now a select is used for picking a tag to filter on.

* Added custom Cypress command to create an article.

* Added documentation for the create article custom command.

* Removed unnecesary properties from payload to create an article.

* reading list mobile view wip.

* Reworked styles in <TagList />.

* Reworked reading list to use <MediaQuery /> component.

* Removed bottom padding from reading list header.

* styling tweaks if there are no available tags.

* Added some E2E tests.

* Removed reading list component test in favour of e2e test.

* Made breakpoint values numbers.

* Added some padding and more grid gap to filter on small screens.

* Adjusted jest coverage thresholds as we're moving some tests to e2e tests.

* Reverting a VS Code setting change caused by one of my extensions.

* First pass for E2E tests for the reading list.

* Added some more grid gap.

* Fixed load next page to send tags properly.

* Added some more tests.

* Improved label and placeholder for text filter in reading list.

* Added more tests

* Fixed media queries so it works in Chrome as well.

* Removed aside as tag filters are not complimentary information.

* Update app/javascript/readingList/components/TagList.jsx

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

* Update docs/tests/e2e-tests.md

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

* Turned off deprecated rule in jsx-a11y eslint plugin.

* Reverted to links instead of radio buttons.

* Added an all tags link and select option.

* Fixed relayout issue.

* Fixed View Archive button size.

* Fixed styling of the load more button.

* Fixed empty list issue toggling between archive and reading list.

* Fixed request changes from PR review.

* Removed CSS change that is no longer required.

* Trigger Build

* Fixed centering of items in top fieldset.

* Fixed issue with search text field resetting reading list.

* Fixed component tests for the reading list.

* Fixed empty state popping up between search queries.

* Fixed casing of fixture filenames.

* Update app/javascript/readingList/readingList.jsx

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

* Reverted change in reading list component test.

* Added missing JSDoc comment.

* Now links are in an unordered list.

* Promoted some CSS classes from the <nav /> to the <ul /> for spacing.

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-04-08 12:53:43 +01:00
dependabot[bot]
1522b6d41e
Bump chart.js from 2.9.4 to 3.0.2 (#13244)
* Bump chart.js from 2.9.4 to 3.0.2

Bumps [chart.js](https://github.com/chartjs/Chart.js) from 2.9.4 to 3.0.2.
- [Release notes](https://github.com/chartjs/Chart.js/releases)
- [Commits](https://github.com/chartjs/Chart.js/compare/v2.9.4...v3.0.2)

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

* fix issues in migration to 3x of chart.js

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-04-08 10:46:32 +02:00
Jacob Herrington
637b901e1d
Fix misleading title on svg tag (#13272) 2021-04-07 17:22:17 -05:00
Daniel Uber
68867e7c68
Ensure we have current user information before deciding how to handle the "flag user" button (#13279)
* Make test fail again

Minimal reproduction via `rspec
spec/system/user/trusted_user_flags_user_spec.rb --order=random
--seed=9374` which runs in this order:

- when signed in as a trusted user
- when not logged in
- when signed in as the non-trusted user
- when signed in as the user

Because "not logged in" immediately precedes "non-trusted user" in this
order, the browser store cache is cleared and there is no user. Since
there's no user, the flag is not removed.

* Wait for current user promise before processing current user

* Extract button callback registration to function

This addresses a code climate concern (function exceeded 50 lines) by
extracting the button behavior to a function of (button, id, name),
and calls that within the exported initFlag function.

* Prefer request to fetch

Addresses feedback to use @utilities/http's request method in  place
of fetch (which automatically adds the needed csrf headers)

* Reorder imports

Satisfies code climate report that imports are out of order

* Add honeybadger notify to error handling

Do more than just notify that something went wrong. Notify honeybadger
on failure to flag/unflag a user.

* Remove temp variable

This makes the notify code look more like the suggestion

* Reduce function arglist

Since the user id and name are properties of the flagButton's dataset,
we can efficiently extract them from the flagButton.

Only pull user id from dataset to check if current user = profile
user, and extract id and name from dataset after passing the
flagButton.

* reorder imports

Not sure how I managed to reverse this in 18aeb675b but here we go again

* Test button behavior

The original tests only asserted that the link to reactions was
present and labeled correctly. Add additional check that we can use
the button and that the label toggling occurs (this adds a request to
the test case, but adds a test for user facing behavior).

* Tame eslint check

I was getting conflicting feedback on import ordering from code
climate and eslint. Since telling eslint to ignore its rules was
immediately clear to me (there's an example on the line before this)
that's the direction I headed, but I can revisit if it matters

https://github.com/forem/forem/pull/13279#issuecomment-814411401
captures the conflict (code climate wants @utilities/http first,
eslint wants ../chat/util first, one or the other fails regardless of
the ordering.

* Use multiple rules in one ignore comment

https://eslint.org/docs/user-guide/configuring/rules#disabling-rules
supports multiple warnings separated by commas

* Remove stray comment

* Move documentation comment to the code it describes

* Replace invalid name

I had copied from the suggested code snippet the
userData.profileUserID name, but userData in this context is a global
function, and `profileUserId` (capitalization) is the bound variable
in this context.

Fix it before we throw an error trying to report an error (ironically,
before the window alert telling the user an error occurred, I think
this would have been visible only in console).

* Actually call the remove button function
2021-04-07 16:28:21 -05:00
Jamie Gaskins
afa3178b79
Fix rescue in EdgeCache::Bust (#13303)
We were trying to report an exception to Honeybadger but we never
actually captured the exception.
2021-04-07 15:31:30 -04:00
Jamie Gaskins
c2b7f0b096
Use 2-digit month and day for JS Date class (#13257)
Single-digit months and days are not compliant with the ECMAScript
standard for date strings.

See: https://262.ecma-international.org/11.0/#sec-date-time-string-format
2021-04-07 14:25:39 -04:00
Julianna Tetreault
d5637105c0
Remove superfluous app_url from nav links index (#13302) 2021-04-07 11:50:10 -06:00
Andy Zhao
7d9ce63e05
Add email type as utm_campaign column (#13297) 2021-04-07 12:54:51 -04:00
Jacob Herrington
f76a8e1e99
[15-minute fix] Don't allow markdown to use CSS classes (#13282)
* Don't allow markdown to use CSS classes

* Fix code highlighting

* Add spec for ignoring CSS classes

* Add comment
2021-04-07 11:40:39 -04:00
Andy Zhao
8204888bf0
[15-min-fix] Use safe navigation in case of nil email messages (#13294)
* Use safe navigation in case of nils

* Only safe navigate for utm_campaign
2021-04-07 10:13:02 -04:00
Vaidehi Joshi
97678456d6
[15 Min Fix]: Extract a post's followers out of service and onto Article model (#13229)
* Move authors followers out of Notifications::NotifiableAction::Send and into Article model

* Rename authors_followers to followers

* Update followers method in service, oops

* Update app/services/notifications/notifiable_action/send.rb

Co-authored-by: Michael Kohl <citizen428@dev.to>

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-04-07 06:46:32 -07:00
Andrew Bone
6aae404c54
Update Analytics Dashboard time navigation to tabs (#13270)
* Move to crayons-tabs

* Update js logic to use crayon-tabs

* Remove toggle and add tab

The added code moved the tabs to the right hand side of the container (until mobile styles kick in then it will fill the container).
2021-04-07 14:11:15 +01:00
Julien Maury
36adcd740d
Remove some HTML errors (#13288)
* make clean_fork executable

* fix attribute className not in a JSX context

* delete useless role main on main tag

* delete useless role banner on header
2021-04-07 11:46:12 +01:00
Vaidehi Joshi
f8d5bbacf6
Prevent NoMethodError when Html variant is not present, take 2 (#13283)
Fixes https://app.honeybadger.io/projects/72638/faults/78746996.
2021-04-07 11:58:35 +02:00
Nick Taylor
b34db2360e
Fixed bug with iOS devices that crashed the post editor (#13281) 2021-04-07 05:52:17 -04:00
Jeferson S. Brito
14416f79cc
Fix Wikipedia liquid tag styles (#13154) 2021-04-07 10:33:20 +02:00
Mac Siri
aed41c3238
Fix Ruby 2.7 kwargs' warnings & misc spec warnings (#13256) 2021-04-06 16:57:59 -04:00
Vaidehi Joshi
b2ded5b889
Prevent NoMethodError when Html variant is not present (#13276)
Fixes https://app.honeybadger.io/projects/72638/faults/78731893.
2021-04-06 11:06:46 -07:00
Alex
3891c7d468
✂️ Remove search from Connect (#13235)
* Remove search from connect

* Remove alternate approach

* Alphabetize CHAT_CHANNEL_PARAMS

* Remove default value for user_ids

* Add spec for result ordering
2021-04-06 13:03:31 -04:00
Josh Puetz
f6dc638190
Upgrade to Ahoy 2.0.x (#13085)
* First set of changes for Ahoy 2.0

* Fix line length

* Change test

* Remove unused test

* Remove ahoy_messages.opened_at

* Simply digest email sending calculation to not rely on last_opened

* Remove outdated comment

* Fix typo in test

* Rework site config email digest to a single value

* Fix merge duplication

* Remove UTM references from ahoy emails

* Fix credits tests

* Remove UTM from expected email params
2021-04-06 10:12:32 -05:00
Jacob Herrington
a5b2d109d5
Rename banned and comment_banned roles (#12270)
* Rename banned and comment_banned roles

* Add data update script to rename roles containing 'ban'

* Add named error for Suspended users

* Update unidiomatic method names

* Rename misc banned to suspended

* Apply suggestions from code review

Co-authored-by: Michael Kohl <me@citizen428.net>

* Add unit tests for suspended methods

This commit also adds TODO comments for removing banned and
comment_banned from the codebase after data update scripts have
successfully run on all of our Forems.

Co-authored-by: Michael Kohl <me@citizen428.net>
2021-04-06 10:12:14 -05:00
rhymes
fa20539238
Adjust default Forem's RSS feed algorithm to allow non featured articles (#13247)
Since we've removed Buffer related algorithm, posts aren't automatically featured
anymore, leaving the RSS feed pretty empty. The default view should also include
those posts, above a minimum score, that are not featured.
2021-04-06 17:05:35 +02:00
Jacob Herrington
61ab4d36d4
Use ActiveModel::Errors#add to fix deprecation warning (#13262) 2021-04-06 08:16:57 -05:00
Jacob Herrington
2186210792
Fix deprecation warning (#13253)
Rendering actions with '.' in the name is deprecated
2021-04-06 08:16:42 -05:00
Suzanne Aitchison
aa22266e9d
[15 min fix] Allow resize hook to contrain max-height as well as min (#13269)
* allow resize hook to contrain max-height as well as min

* trigger checks
2021-04-06 12:11:03 +01:00
Michael Kohl
57545cc607
Change frame limit to match imgproxy (#13265) 2021-04-06 12:28:50 +02:00
Vaidehi Joshi
484c97fc8d
Limit mentions in posts (#13259)
* Limit mentions in articles

* Bump MAX_USER_MENTION_LIVE_AT to April 7th, 2021 UTC time

* Use stubbed constants in article and comment specs

* Add TODOs around extracting MAX_USER_MENTIONS into constant
2021-04-05 18:19:46 -07:00
Jacob Herrington
0ecfec1a80
[15 minute fix] Fix word wrapping on mobile dashboard (#13218)
* Fix word wrapping on mobile dashboard

* Update app/assets/stylesheets/components/buttons.scss

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

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-04-05 14:46:06 -05:00
rhymes
b6360fb80c
Upgrade Rails to 6.1.3.1 (#11333)
* Upgrade Rails to 6.1

* Switch to unreleased bullet

* Run rails app:update

* Add deprecation notices after reading changelogs

* Fix app:update error

* Move middleware in the correct place

* Temporarily disable ransack which does not support Rails 6.1

* Remove wrongly merged file

* Re-run spring binstub

* Fix double quotes

* Track ransack branch with Rails 6.1 support

* Fix deprecation

* Switch to Ransack 2.4 which supports Rails 6.1 rc1

* Fix missing default params for the duration substitution

* Fix new behavior of relation.pluck with contradictory queries

* Fix uploaders specs by tracking rspec-rails main repo

* Disable bullet temporarily

* Fix remaining fixture_file_upload usages

* Add default seconds for video article duration

* Trigger Travis CI

* Upgrade Rails to 6.1.0.rc2

* Remove file deleted on master

* Add Rails 6.1 gem to Gemfile

* Trigger Travis CI

* Revert "Disable bullet temporarily"

This reverts commit cee0c2ce61fb72cbc16d52c94b12ee681e873031.

* Fix bullet version

* Upgrade to acts-as-taggable 7 and fix conflict

* Update Gemfile and rspec-* gems

* Fix nokogiri in Gemfile.lock

* Switch to rspec-rails main branch

* Remove leftover vendored cached items

* Fix path for Rails 6.1

* Use latest release of erb_lint

* Re-run rails app:update to incorporate new changes

* Disable erb_lint's ErbSafety checks

* Fix Gemfile.lock and re-add platform specific gems of Nokogiri

* Add mini_portile2 as well

* Fix latest merge conflict by removing now unused faraday_middleware

* Upgrade to Rails 6.1.3.1

* Regenerate Gemfile.lock and vendor/cache

* Add x86_64 linux gem

* Mark spec as flaky

* Revert "Mark spec as flaky"

This reverts commit 3caba94b33645f9b59c84ba78ee8df042fc7aee0.

Co-authored-by: Mac Siri <krairit.siri@gmail.com>
2021-04-05 10:39:48 -04:00
Suzanne Aitchison
e8098c8e5c
ensure home and sign up links in sidebar are announced once to screen reader users (#13231) 2021-04-05 09:24:56 +01:00
Suzanne Aitchison
54c6aa484d
improve accessible names of dashboard post actions (#13232) 2021-04-05 09:24:39 +01:00
Suzanne Aitchison
0691b8a897
link profile fields with their labels (#13233) 2021-04-05 09:24:16 +01:00
Suzanne Aitchison
100910a072
[15 min fix] ✂️✂️✂️ Remove preact-textarea-autosize library ✂️✂️✂️ (#13234)
* remove lib from title component, use hook instead

* remove lib from chat compose, and remove package
2021-04-05 09:23:29 +01:00
Mac Siri
009c14653a
Fix app/services' ruby 2.7 kwargs warnings (#13177) 2021-04-01 18:40:50 -04:00
Jamie Gaskins
9533c77d7f
User#followed_articles->Article.cached_tagged_with (#13174)
* User#followed_articles->Article.cached_tagged_with

This should improve performance on StoriesController#index

* Make cached_* work like their tagged_with cousins

* Swap to `cached_tagged_with_any`

This was using `tagged_with(tags, any: true)` before so this commit
swaps to using a scope that aligns with that method.

* Allow for searching by Tag models

* do the thing

* abracadabra run the build

* Add comment explaining Postgres regex anchors
2021-04-01 16:20:29 -04:00
Jacob Herrington
18ce0c635c
Add endpoint for articles sorted by published date (#13137) 2021-04-01 13:36:36 -05:00
Michael Kohl
28e38cbb7d
Add flag link to profile dropdown view (#12862)
* Add flag link to profile dropdown view

* Add JS for flag button on profile

* Only show flag button to trusted users

* Quick fix for accidental unflagging

This will be more properly addressed in a future refactoring.

* Update reaction specs

* Update spec

* Make flagging togglable

* Make CodeClimate happy

* Revert accidentally changed file

* CodeClimate

* Update app/javascript/profileDropdown/flagButton.js

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>

* Add JSDoc

* Remove second popup

* Refactor and add system spec

* CodeClimate

* Change send to public_send

* Address PR feedback by @aitchiss

Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
2021-04-01 09:26:43 +00:00
Jamie Gaskins
e953b67ce5
Fix user_id tag in EDAC traces (#13213) 2021-03-31 15:58:08 -04:00
Molly Struve
8fac1b756c
Optimization:Remove Twitter Counts From User Table in db (#13208) 2021-03-31 14:44:15 -05:00
Molly Struve
20c6b39a30
Optimization:Remove Unused Twitter Counts from User (#13196) 2021-03-31 10:57:03 -05:00
Suzanne Aitchison
6f057fc8ce
Add mention autocomplete to posts (#13101)
* WIP - initial exploration into post mentioon autocomplete

* replace the autosize textarea with mention autocomplete, adjusting height

* add cypress tests for mentioning in a post

* fix resizing of text areas

* refactor text area resize hook

* refactoring

* update cypress tests

* remove mergeRefs from utils, extract UserListItemContent

* allow useTextAreaAutoResize elements to have height greater than minimum, apply styles to container

* Trigger Travis CI

* Travis plz

* small refactors

* add comments and constants as per PR feedback

Co-authored-by: Nick Taylor <nick@dev.to>
2021-03-31 14:42:59 +01:00
Ridhwana
4848a8b2e1
User Settings Step 1: Add user_settings and user_notification_settings tables (rfc#32) (#12768)
* feat: add the two new models users_setting and users_notification_setting

* feat: add the settings and notification_settings table to the schema

* feat: add the user and notification models

* feat: add the user_id foreign key to the model

* chore: sneaky indent

* feat: add some fields from the profile attributes

* Revert "feat: add some fields from the profile attributes"

This reverts commit 376828746ded063a243505d317140fa5339227cf.

* chore: add some profile field attributes

* chore: remove language_settings

* chore: update indent

* chore: remove language_settings

* feat: changes to the tables

* chore:  remove validation in favor of the foreign keys

* chore: add default for editor version

* Address PR review suggestions

* setting_spec.rb needs to be fixed; need help

* Working on PR review comments

* Continue with addressing PR review comments

* Remove normalize_config_values method; pass correct values from forms

* Address Travis failures

* revert some unnecessary changes in spec file

Co-authored-by: Arit Amana <msarit@gmail.com>
2021-03-31 14:37:46 +02:00
Vaidehi Joshi
95055b2a89
Remove pro role + expose analytics to all users via dashboard (#13156)
* Remove pro role on user, expose pro dashboard to all users as analytics

* Remove pro from Elasticsearch mappings

* Update user role docs to use :trusted over :pro

* Remove pro from Role model spec

* Remove more references to pro, as noted by @rhymes
2021-03-30 15:02:18 -07:00
Molly Struve
c410c2a645
Bug Fix:Remove Suggest a Tweet since we no longer have that feature (#13188) 2021-03-30 15:17:25 -05:00
Vaidehi Joshi
7fbbfa0a2d
[15 Min Fix]: Fix template error in badge achievement notification view (#13186)
* Fix template error in badge achievement notification view

Fixes https://app.honeybadger.io/projects/72638/faults/78624140.

* hello travis are you there its me vaidehi

* why arent you building my PR come onnnnn
2021-03-30 10:45:37 -07:00
Suzanne Aitchison
7af30e8bfc
reinstate reply to comment e2e test (#13181)
* reinstate reply to comment e2e test

* refactor selector for reply comment box

* refactor and remove data testid no longer needed
2021-03-30 16:31:07 +01:00
Nick Taylor
71d7be16b8
[15 minute fix] Now mention auto-complete dynamic imports are cached. (#13146)
* Now mention auto-complete dynamic imports are cached.

* Removed explicit setting of undefined.

* Put back setting window.Forem.mentionAutoCompleteImports to undefined to be explicit.
2021-03-30 13:20:15 +02:00
Nick Taylor
871650053c
[15 minute fix] Fixed bug with templates not being inserted for comments. (#13149)
* Fixed bug with templates not being inserted for comments.

* Removed some trailing white space from a heading.

* Added custom Cypress command to create an article.

* Added E2E tests for creating comments on an article.

* Fixed adding a comment issue caused by mention auto-complete.

* Fixed a selector for the E2E tests.

* Removed some unnecessary white space and also making code climate happy.

* Updated E2E test.

* Added a bit more to the E2E tests.

* Now validation for comment doesn't need to loop through textareas.

* Merge remote-tracking branch 'origin/master' into nickytonline/fix-comment-template-insertion-bug

* Removed a similar spec file and added tests to the other file.

* wip

* Fixed bug where a response template could not be submitted.

* Added/updated E2E tests.

* Reverted a small change to condition for showing the combobox popover.

* Undoing some white space changes as not related to PR.

* Trigger Build

* Put back article seed data as it's used in tests outside of comment tests.
2021-03-30 13:02:54 +02:00
Anna Buianova
40b989ca62
Configure badge credits by admins (#13145)
* Added credits_awarded to /admin/badges forms

* Award credits only if badge has them

* Removed information about credits and listings in the new badge email when not needed

* Specs for number of credits awarded for badges

* Added missing newline

* Fix typo

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

* Improve new_badge_email.text.erb

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

* Fixed number of credits in notification

* Added specs for number of credits in notifications

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2021-03-30 10:58:48 +03:00