Commit graph

2705 commits

Author SHA1 Message Date
Monica Mateiu
dbdd24c729
add org analytics menu if user has organizations (#13995)
* add organizations menu to analytics page

* Update app/views/dashboards/analytics.erb

Co-authored-by: rhymes <github@rhymes.dev>

* replace querySelector with getElementsByClassName for better performance

* Update app/javascript/packs/analyticsDashboard.js

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

* Update app/views/dashboards/analytics.erb

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

* refactor analytics view and add specs

* skip flakey analyticsNavigation spec

Co-authored-by: rhymes <github@rhymes.dev>
Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-06-23 14:35:23 +02:00
Julianna Tetreault
281fdc499c
[15-Minute Fix] Fix Broken Admin Tags #create and #update Forms (#14049)
* Adds name to ALLOWED_PARAMS in Admin::TagsController

* Adds local: true to /admin/tags/_form.html.erb
  - Sets local: true in tags partial for proper
redirects and to properly render flash messages
for both the #create and #update actions

* Adds local: true to the Add Moderator button for tags

* Adds and updates systems specs for tags
  - Updates the admin_updates_tag_spec.rb system spec
  - Adds an admin_creates_new_tag_spec.rb system spec
  - Updates the success flash message in Admin::TagsController
2021-06-23 14:30:17 +02:00
Julianna Tetreault
6b0d2b6173
Uncomments line 26 in admin_manages_organizations_spec.rb (#14051) 2021-06-23 09:22:59 +02:00
Meg Gutshall
ef474fd919
LinkTag: correctly display organization avatar (#13928)
* Set up Docker

* Add conditional to render org logo with user avatar

* Create styling for logo with avatar

* Update app/views/articles/_liquid.html.erb

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

* Update app/views/articles/_liquid.html.erb

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

* update rspec test

* Restore schema.rb

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Michael Kohl <me@citizen428.net>
2021-06-23 10:25:29 +07:00
Andy Zhao
7d3bf4b753
[15-min-fix] Ensure mention worker delivers email (#14038)
* Ensure mention worker delivers email

* Fix spec to appropriately check if mailer was touched
2021-06-22 14:29:56 -04:00
dependabot[bot]
f24d3d157f
Bump rubocop-rails from 2.10.1 to 2.11.0 (#14043)
* Bump rubocop-rails from 2.10.1 to 2.11.0

Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.10.1 to 2.11.0.
- [Release notes](https://github.com/rubocop/rubocop-rails/releases)
- [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.10.1...v2.11.0)

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

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

* Enable new cops and fix violations

* Remove expected string literal

As we're passing a block (that yields a string) there are no arguments
to the debug call.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rhymes <github@rhymes.dev>
Co-authored-by: Dan Uber <dan@forem.com>
2021-06-22 11:25:28 -05:00
Michael Kohl
7fe5c54161
Consistently use ForemInstance.private? (#14021) 2021-06-22 08:16:19 +07:00
Suzanne Aitchison
1a417174c3
Profile Preview Cards (RFC #222): Article page author byline (#13990)
* move current profile card content to shared view, create profile preview card shared view

* article page: show link in small screens, button with preview card in larger

* initialize the hover and click functionality

* tweak class names

* make sure modals sit at highest elevation level

* add cypress tests

* add a test to make sure mobile view unaffected

* make sure follow buttons initialized in test before asserting on them
2021-06-21 08:38:47 +01:00
Michael Kohl
23fe4dd9de
Clean up forem:setup task (#13998) 2021-06-18 09:34:18 +07:00
Michael Kohl
8f42828028
Change signature of Feeds::ImportArticlesWorker (#13971) 2021-06-17 14:28:23 -04:00
Michael Kohl
68a34f4015
Remove navigation links from footer on private Forems (#14006) 2021-06-17 15:01:02 +00:00
rhymes
686965c9ff
[15 min fix] Refactor private landing pages model code (#13982)
* Add LandingPage domain model

* Rely on Rails data integrity and remove previous code

* Remove superfluous equality check

* Restore landing_page class method

* Add and fix specs

* Do not attach landing page modal controller unnecessarily
2021-06-15 18:17:15 +02:00
rhymes
43f84c12ef
Send Devise emails asynchronously (#13985)
* Change send_devise_notification to deliver later

* Add tests to invitation emails

* Fix spec
2021-06-15 07:50:34 -06:00
Suzanne Aitchison
e0798b88e0
Message context menu in connect is not accessible #12250 (#13806)
* make connect message dropdown accessible

* add a cypress test

* use crayons buttons throughout

* fix some unhandled error affecting cypress

* make message options a list

* minor tweak to test

* guard against filter error being triggered in test

* utilise newer dropdown helpers

* wait for message to fully send

* use optional chaining
2021-06-15 11:13:31 +01:00
Mac Siri
aba6033d9b
Revert dynamic email config changes (#13983)
* Add missing clear_cache in spec

* Fix broken spec

* Temporarily bring back old config

* Disable specs
2021-06-14 13:08:24 -04:00
Daniel Uber
8158ea3cd2
Use a counter and append the index to make sure slugs are unique (#13981)
There's a unique index page on slugs that failed today during a PR
merge, where 'et' was the `Faker::Lorem.word` selected both times.

Add a suffix to the generated word to ensure these are unique and an
index collision doesn't happen.
2021-06-14 09:55:12 -05:00
Mac Siri
e38196df6f
Create Settings::SMTP (#13943)
* Fix typo

* Add SMTP configs to Settings::General

* Expand Settings's show page

* Expand Settings::General's constants

* Move smtp_enabled? logic to ApplicationMailer

* Apply suggestions from code review

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

* Add missing descriptions and placeholders

* Remove production guard clause

* Change delivery_method to a callback

* Create Settings::SMTP

* Run migration

* Move constants

* Remove SMTP from Settings::General

* Create SMTPSettingsController

* Add back guard clause

* Change which perform_deliveries configuration to use from

* Update config/environments/production.rb

* Rename migration to singular

* Run migration again

* Fix name

* Alphabetize and add validation for authentication

* Move settings and enabled? logic to Settings::SMTP

* Change after_action to before_action

* Fix broken spec

* Fix broken spec

* Create SMTP specs

* Provide default for port

* Create spec for ApplicationMailer

* Fix broken spec

* Move smtp_enabled?

* Search and replace

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2021-06-14 10:29:43 -04:00
Takuma
7e969fa682
Call subscribe_to_mailchimp_newsletter after the transaction is commited (#13969)
* Call subscribe_to_mailchimp_newsletter by after_commit instead of after_save

* s/save/commit
2021-06-14 16:05:46 +02:00
dependabot[bot]
1ea169a351
Bump rubocop-rspec from 2.3.0 to 2.4.0 (#13951)
* Bump rubocop-rspec from 2.3.0 to 2.4.0

Bumps [rubocop-rspec](https://github.com/rubocop/rubocop-rspec) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/rubocop/rubocop-rspec/releases)
- [Changelog](https://github.com/rubocop/rubocop-rspec/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rubocop/rubocop-rspec/compare/v2.3.0...v2.4.0)

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

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

* Enable new cops, fix violations and refactor specs

* Remove expected "Moderate" text from the /mod page test

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rhymes <github@rhymes.dev>
Co-authored-by: Dan Uber <dan@forem.com>
2021-06-14 09:27:13 +02:00
Daniel Uber
b4ce4ec975
15 minute fix: Shorten long titles from feed items if needed (#13961)
* Shorten long titles from feed items if needed

Fixes #13959

When the title is too long to create a valid article, put a shortened
title in the generated article markdown.

Added unit tests to cover the default case and the shortening case

* Fix Struct initialization

Rubocop suggested struct over openstruct because of performance, but
Struct.new creates a "class" with a positional initializer, while
Openstruct's new takes a hash like keyword set and builds an object
from those directly.

I mistakenly reused the openstruct syntax after the conversion. This
changes the feed and item to use Struct's initializer.

* Use String#truncate in place of custom trimming

`separator` enables a natural break (preventing space between last
character and ellipsis), and omission text "..." is the default behavior.

* Use verifying doubles in test, use method access to members in code

The instance_double for Feedjira::Parser::RSSEntry
necessitated changing hash key access to reader method access for the
data members (title, categories, summary, description).
2021-06-11 12:51:51 -05:00
Anna Buianova
26592a3a9c
Removing Settings::General.email_addresses (#13958)
* Replaced Settings::General.email_addresses with Forem.email

* Removed Settings::General.email_addresses remainders

* Fixed schema.rb

* Remove Settings::General.email_addresses record

* Fixed label for default email
2021-06-11 12:34:34 +03:00
Julianna Tetreault
b12ebfa0e5
RFC #74, Pt. 2: Private Forem Landing Page (#13819)
* Adds landing_page checkbox for Landing Page

* Adds landing_page to page_params in Admin::Pages::Controller

* Adds landing_page to admin_manages_pages and admin_creates_pages specs

* Adjusts copy for Landing Page in pages/_form.html.erb

* Places #post_a_job before #privacy in Pages::Controller
  - Ensures that all page-related methods are properly
 alphabetized

* Alphabetizes remaining out-of-order page-related methods
  - Ensures that all page-related methods within the
 Pages::Controller are in alphabetical order, following
 the order of the other methods

* Adds landing_page check to ApplicationController#verify_private_forem

* Adds a single_landing_page validation to the Page model

* Adds a lock.svg to /images and uses it in the pages index

* Adjusts buttons and checkboxes to use crayons class in pages partial

* Ensures that pages/_form.html.erb destroy button uses crayons

* Adds a landing_page validation-related test to page_spec.rb

* Updates #single_landing_page validation and error message

* WIP: Adds JS modal upon landing_page error in pages/_form.html.erb

* Adds a working modal upon error in pages/_form.html.erb
- Removes redundant #single_landing_page validation from Page
- Adds #has_a_landing_page? in place of #single_landing_page
- Conditionally renders the landing_page checkbox in _form.html.erb
- Adds styles to locked screen/landing page modal
- Adds copy to locked screen/landing page modal
- Beings adding buttons to overwrite current landing_page

* Updates the data-modal-selectors and ids in pages/_form.html.erb

* Uses #landing_page_path within pages/_form.html.erb modal
- Adds a link_to to link to the current landing page in the modal
- Adds styles to buttons and link_to in modal

* Adds back single_landing_page validation to Page.rb

* Reverts changes and updates methods within Page.rb
 - Reverts changes to #single_landing_page
 - Refactors #has_a_landing_page? and #landing_page_path
 - Updates div id in pages/_form.html.erb

* Adjusts #single_landing_page error message slightly

* Adds a test for landing_pages in stories_index_spec.rb

* Adds an overwrite attribute to Pages for the modal in _form
  - Fixes anonymous spelling

* Refactors pages/_form.html.erb and cleans up spelling

* Adds a safe operator to landing_page.path in Page
  - Adjusts the placement of the hidden value in pages/_form.html.erb

* Updates styling for Current Locked Screen link

* Adds the ability to overwrite an active landing page on click
  - Adds Admin::PagesController#update_and_overwrite and refactors
AdminPages::Controller#udpate to work with new method
  - Adds a remote attribute, overwrite, to Admin::PagesController
via a hidden_field in pages/_form.html.erb and an attr_accessor in
the Page model
  - Adds a toggleOverwrite() function to pages/_form.html.erb to
toggle the (soon to be hidden) overwrite checkbox in the form --
the checkbox is toggled on button click

* Adds a guard clause to #landing_page_path in Page.rb

* Adds a safe naviagtor to Admin::PagesController#update_and_overwrite_landing_page

* Adds a type and return to Overwrite button to prevent submit

* Adds a hidden class to the overwrite checkbox field in _form.html.erb
  - Hides the overwrite checkbox since it is only used to overwrite
the landing_page boolean on click of the "Overwrite current locked
screen" button

* Adds Admin::PagesController#create_and_overwrite and removes hidden class

* Adds landing page-related tests to admin_manages_pages_spec.rb

* Remove messy commented out code and place it in GH comment instead

* PR Review Feedback: Renames remote attr, defines class methods, updates views
  - Renames remote attribute to overwrite_landing_page
  - Updates all necessary views, methods, etc. w/ new attr
  - Defines two class methods to make code more extensible
  - Updates all necessary views, methods, etc. w/ new methods

* Remove unnecessary comments and revert changes to ternary in _form.html.erb

* Adjustments for accessibility within _form and index
  - Adds a descriptive id to <p> in _form.html.erb
  - Adds an ariadescribedby field to _form.html.erb
  - Adjusts title within index.html.erb

* Refactors landing_page-related code per PR review requests
  - Adds a landing_page_modal_controller.js that handles
and further customizes the dismiss and overwrite button, and
handles opening the modal
  - Adds a _landing_page_modal partial to extract modal-specific
html outside of the _form.html.erb partial
  - Refactors _form.html.erb to account for the _landing_page_modal
partial and the landing_page_modal_controller.js
  - Refactors the overwrite checkbox to be a hidden_field rather than
a hidden checkbox and removes existing hidden_field to accomodate it
  - Loads the @landing_page within Admin::PagesController#edit for
use by the _landing_page_modal.html.erb partial
  - Refactors Page#single_landing_page to be more readable
  - Removes useless JS from _form.html.erb

* Removes #landing_page_exists? class method since it isnt used now

* Uses the #landing_page class method within ApplicationController

* Removes pending status from test in admin_manages_pages_spec.rb

* Adds an e2e test for landing pages and adds to seeds_e2e
  - Adds a landingPage.spec.js to test landing pages
  - Adds a Page to seeds_e2e.rb for landingPage.spec.js

* Removes references to articles from e2e test and adds clickable link

* Adds another Page to seeds_e2e.rb and updates link names in test

* Adds the Current Locked Screen title to modal and opens in new link

* Renames Dismiss to Cancel and updates all necessary code

* Adjusts landingPage.spec.js

* check for existing landing page before showing modal

* Update Cypress tests and fix bug in LandingPageModalController

* Apply suggestions from code review

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

* Orders Pages by created_at desc in /admin/pages/index.html.erb for consistency

* Targets specific edit button in landingPage.spec.js

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: rhymes <github@rhymes.dev>
2021-06-10 11:46:24 -06:00
Alex
b02d43ca2d
Create DiscussionLocks (#13905)
* Create DiscussionLocks

* Fix specs

* Update nullify_blank_notes_and_reason

* Update before_validation call

* Updated DiscussionLockPolicy for clarity

* Move permitted_attributes to a constant

* Update route

* Apply suggestions from code review for frontend

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

* Add title tags

* Wrap unlock confirm in main element

* Wrap flash messages up in div

* Actually fix title tags

* Hide comment reply button when discussion is locked

* Add E2E tests

* Try to fix E2E tests

* Cypress...you work locally but not in CI...why!?

* PR feedback

* Update E2E tests

* More E2E updates 😭

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-06-10 11:04:33 -04:00
Daniel Uber
727aba3054
Prefer double quoted string literals (#13949)
Fixes a rubocop warning
2021-06-10 08:02:28 +02:00
rhymes
4bc56b8ac0
Search results: prioritize articles titles (#13918)
* Add HairTrigger spec

* Add weights to columns tsvectors

* Add correct sorting for search results

* Remove Timecop.travel

* Changed order of columns in trigger based on weights
2021-06-09 14:28:19 +02:00
Anna Buianova
78c566e1e2
[15-min-fix] Deleted unused data update scripts (#13942)
* Deleted unused data update scripts

* Removed unused data_update_scripts specs
2021-06-09 12:17:25 +03:00
rhymes
d018b69106
API: Remove Admin Config endpoint (#13934) 2021-06-08 09:43:51 +02:00
Michael Kohl
dcf942e3a2
Add Admin:Settings controllers (#13851)
* Add Admin:Settings::BaseController and refactor

* Further simplify controllers

* Add comments, more cleanup

* Update mandatory settings controller

* Update spec

* Update service object and spec

* Update controller

* Update app/services/settings/general/upsert.rb

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

Co-authored-by: Jamie Gaskins <jamie@forem.com>
2021-06-08 10:13:55 +07:00
rhymes
99ddd31058
Pin posts to feed (#13807)
* Add SiteConfig.feed_pinned_article and validation

* Display pinned article at the top of feed

* Add (basic) functionality to pin/unpin post

* Admins can pin other users posts as well

* Hide the button if looking at the non pinned post

* Add pinned/unpinned snackbar message

* Rename SiteConfig usage to Settings::General

* Add pinned article to the Admin articles index

* Show the pin post button when there's no pinned article

* Move pinning to a separate controller

* Fix SiteConfig reference

* Hide PinController actions to unauthorized users

* PinnedArticlesController#show action and refactor some of the code

* Add Modal interaction

* Fix modal-pinned checkbox interaction

* Fixed pin/unpin post

* Add ArticleDecorator#pinned? specs

* Add PinnedArticlePolicy and PinnedArticlesController specs

* Add ability to actually pin an article from the admin after submit

* Add partial Cypress pin/unpin spec

* Fix pinned article and add basic Cypress interaction tests

* Add Crayons styling to modal

* Only render the pinned article on the default Feed page

* Use persisted?

* Add some comments

* Update app/javascript/articles/Article.jsx

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

* Update app/javascript/packs/homePageFeed.jsx

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

* Fix Cypress tests

* Update app/javascript/admin/controllers/article_controller.js

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

* Fix pinning in article show page

* Used PinnedArticle domain model

* Fix spec

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/adminFlows/articles/pinArticle.spec.js

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

* Update cypress/integration/articleFlows/pinArticle.spec.js

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

* Update cypress/integration/articleFlows/pinArticle.spec.js

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

* Update app/views/admin/articles/index.html.erb

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

* Fix merge woes

* Add missing article pin post flows

* Add missing admin article flows

* Add Unpin to Admin as well

* Add Audit::Log entries for pin/unpin actions

* Update app/controllers/stories/feeds_controller.rb

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

* Do not rate limit in E2E tests

* Use .find instead of .filter

* Rename ArticleIdValidator to ExistingArticleIdValidator

* Treat draft and deleted articles the same

* Make sure posts can be pinned after the pinned article is unpublished or deleted

* Use .get directly

* Fix spec and fix PinnedArticlesController#show

* Strengthen pinArticle Cypress tests

* Add Cypress test heading guard

* Add another Cypress test heading guard

* Remove duplicate validator

* Try using the Tools: header instead of the article title

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-06-04 10:54:53 +02:00
rhymes
3ca2f5413f
Add :detect_animated_images feature flag to guard animated images detection (#13906) 2021-06-03 17:21:43 -04:00
Saroj Sasamal
e6e99e902b
add user friendly error message when a comment is made on a deleted post (#13721)
* add user friendly error message when a comment is made on a deleted post

* add validation message when commentable is empty

* Update app/models/comment.rb

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

* Update spec/models/comment_spec.rb

Co-authored-by: rhymes <github@rhymes.dev>

* Update spec/models/comment_spec.rb

Co-authored-by: rhymes <github@rhymes.dev>

Co-authored-by: Michael Kohl <me@citizen428.net>
Co-authored-by: rhymes <github@rhymes.dev>
2021-06-03 10:17:26 +07:00
dependabot[bot]
609afc71c7
Bump rubocop from 1.15.0 to 1.16.0 (#13894)
* Bump rubocop from 1.15.0 to 1.16.0

Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.15.0 to 1.16.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.15.0...v1.16.0)

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

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

* Enable new cops and fix violations

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: rhymes <github@rhymes.dev>
2021-06-02 09:11:38 -04:00
rhymes
10ad52f12b
Settings: Correctly display profile field static values (#13887)
* Correctly display profile field values

* Use @user.profile.public_send directly

* Call Profile.refresh_attributes! in factory callback

* Update cypress/integration/profileFlows/userUpdateSettingsProfile.spec.js

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

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-06-01 16:16:15 +02:00
rhymes
3be26dae97
Remove duplicate jquery import, remove jquery-rails and use @rails/ujs (#13891)
* Remove unused jQuery include in Listings

* Use @rails/ujs in the admin

* Remove jquery-rails

* Content is mandatory for listings

* form_with defaults to local: true

* Update app/views/listings/delete_confirm.html.erb

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

* Update cypress/integration/listingFlows/deleteListing.spec.js

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

* Update cypress/integration/listingFlows/deleteListing.spec.js

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

* Update cypress/integration/listingFlows/deleteListing.spec.js

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

* Apply feedback on e2e and fix a bullet warning

Co-authored-by: Suzanne Aitchison <suzanne@forem.com>
2021-06-01 15:28:09 +02:00
Suzanne Aitchison
9b326e3638
show the sidebar on all logged in feed views (#13877) 2021-06-01 09:55:13 +01:00
rhymes
e2e923515f
Detect animated images in articles asynchronously (#13766)
* Add inline animated image detection

* Do not detect animation during preview

* Promote FastImage as a dependency

* Add Articles::DetectAnimatedImages service

* Restore previous parsing

* Add and use Articles::DetectAnimatedImagesWorker

* Remove obsolete poc

* Properly detect images in the after commit callback

* Simplify logic

* Use a second guard clause

* Fix parsing of relative paths and add tests

* Have Articles::DetectAnimatedImages correctly detect relative images uploaded locally

* Change Articles::DetectAnimatedImagesWorker priority to medium

* Only one & required
2021-06-01 10:34:04 +02:00
Fernando Valverde
7845423bb9
Remove :runtime_banner feature flag (#13662)
* Removes :runtime_banner feature flag + repositioning

* Switch to https://udl.forem.com + fix spec

* Fix URL specs

* Adds data_update_script to remove feature flag

* Fix banner overlay on reactions for small screens + iPad max width

* Append -only to Runtime Filter CSS

* Add import to fix assets:precompile

* Implement design update

* Apply suggestions from code review

Co-authored-by: Lisa Sy <lisasyis@gmail.com>

* Add ;

* Trigger Travis

Co-authored-by: Lisa Sy <lisasyis@gmail.com>
2021-05-28 15:10:15 -06:00
Anna Buianova
1862eb5cde
Replacing granular admin email settings with one default email (#13853)
* Replaced granular emails with the default one

* Set reply to header in emails

* Extract shared_examples from NotifyMailer

* Removed unused code

* Replaced SiteConfig with Settings::General

* Fixes related to replacing SiteConfig with Settings

* Removed duplicate line from specs
2021-05-28 12:17:08 +03:00
Arit Amana
371c12f499
UsersSettings RFC: Code to Sync User Settings updates to new tables (#13719)
* schema file undelete description

* begin implementation

* still building

* complete sync code (except race condition for user profile)

* complete implementation, remains tests

* Address PR review and fix Travis fails

* remove superfluous Profile.new

* fix travis fails

* fix profile = nil blowing up; add specs for notification_setting model

* remove unneeded spec

* remove feed validation until after sync code removed; fixes feed_import spec failures

* remove spec associated with feed_url validation in user_setting model

* fix failing spec 😅

* add TODO

* Fix Travis failures
2021-05-27 09:52:54 -04:00
Jacob Herrington
45e45491b1
Migrate "static" profile fields into new columns (#13641)
* Move static profile fields to profiles columns

In order to remove some ambiguity around the availability of certain
profile fields, we can designate certain fields as "static." These
fields are intended to exist on every Forem regardless of configuration;
they contain basic personal info that most Forem's will likely use.

Because these fields already exist on some Forems it is necessary to
migrate the data from existing profile's data column to their respective
columns.

This change should behave as expected irrespective of the existence of
the static fields having associated ProfileFields, however, the UI that
is rendered in a user's settings still depends on the presence of the
ProfileFields. We can address that in a future change when we are
prepared to delete those ProfileFields entirely. We should make sure the
migration occurs without issue before moving to that step, in my
opinion.

* Apply suggestions from code review

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

* Add clarifying comments

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

Co-authored-by: Michael Kohl <me@citizen428.net>
2021-05-26 14:40:18 -05:00
Jamie Gaskins
9db13cbc4c
Run user setting DUS per-user via Sidekiq (#13848)
* Run user setting DUS per-user via Sidekiq

Doing it as a single query trips the query timeout beyond a certain
quantity of users.

* Run DataUpdateScripts::MigrateRelevantFieldsFromUsersToUsersNotificationSettings asynchronously
2021-05-25 14:25:45 -04:00
Lisa Sy
e925d95f71
Rename WRITE A POST to CREATE POST (#13855)
* Rename WRITE A POST to CREATE POST

* Revert schema line removal
2021-05-25 10:30:30 -07:00
Thomas Step
d8cc793afe
Show correct number in series truncation. (#13799)
* Change math in collection to represent the correct number of hidden posts.

* Add test for correction truncation text.

* Add aggregate_failures tag to collections spec

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

Co-authored-by: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
2021-05-24 15:47:06 -06:00
Andy Zhao
864a9195a9
[15-min-fix] Add option for triple tildes for fenced codeblocks (#13810)
* Add option for triple tildes for fenced codeblocks

Note that this doesn't account for all triple backticks in fenced codeblocks situations.

* Add commented out but failing test case for the future?

* Add tests from QA instructions
2021-05-24 14:19:04 -04:00
Ridhwana
bf02be9df8
Data Migration Script for users_settings and users_notification_settings (#13390)
* schema file undelete description

* feat: v1 of the script

* Flesh out remaining enums under their categories

* complete UsersSettings data update script

* complete DUS for relevant attributes in users and profiles tables

* complete DUS for users_notification_settings

* alphabetize user_settings sql file

* safeguard against null values for "null: false" settings

* Set up actual UsersSettings DUS and specs files

* fix broken DUS script

* complete specs for UsersSetting DUS

* Address QA of specs

* complete specs for users_notification_settings DUS

* fix the typos (thanks Julianna!)

* add missing attribute "email_membership_newsletter"

Co-authored-by: Arit Amana <msarit@gmail.com>
2021-05-24 13:54:58 -04:00
Chien-Wei Huang (Michael)
a4c06d3207
Extract tag stories to tag articles controller (#13457) 2021-05-24 13:44:43 -04:00
rhymes
cfff766d37
[Hotfix] Fix DataUpdateScripts::RemoveSiteConfigScripts script (#13824) 2021-05-21 16:34:21 +02:00
Michael Kohl
6dfabd578f
Rename SiteConfig to Settings::General (#13573)
* Rename SiteConfig

* More renaming

* Update spec

* Update mandatory settings mapping

* More renaming

* e2e test fixes

* You have a rename, and you have a rename

* Spec fix

* More changes

* Temporarily disable specs

* After-merge update

* Undo rename for migration

* undo rename of DUS

* Fix DUS

* Fix merge problem

* Remove redundant DUS

* Fix specs

* Remove unused code

* Change wrong class name

* More cleanup

* Re-add missing values to constant

* Fix constant

* Fix spec

* Remove obsolete fields

* Add accidentally removed field

* Update spec

* Move methods from Settings::General to ForemInstance

* Remove unneeded model

* Change mentions of 'site config'
2021-05-21 14:45:37 +02:00
rhymes
70e0e9b83a
[15 min fix] Fix some autoloading deprecation warnings (#13793)
* Fix autoloading for RateLimitChecker

* Fix autoloading for ForemStatsClient

* Fix autoloading for middlewares

* Move things to their proper place

* Move middleware usage to the proper place

* Re-add rest-client in datadog driver correctly

* Already required in config/initializers/middlewares.rb

* Bring that back

* Fix Honeybadger spec
2021-05-20 18:10:25 +02:00
rhymes
a798bd2f7d
[15 min fix] Fallback to the image URL if Cloudinary/Imgproxy are not configured (#13767)
* Fallback to the image URL if neither Cloudinary nor Imgproxy are configured

* Fix specs

* Cloudinary api_secret is required

* Update spec/models/message_spec.rb

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

Co-authored-by: Michael Kohl <citizen428@dev.to>
2021-05-19 15:03:20 +02:00