docbrown/app/services
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
..
articles Detect animated images in articles asynchronously (#13766) 2021-06-01 10:34:04 +02:00
audit Rubocop fixes (#11862) 2020-12-11 17:36:42 +03:00
authentication Add Admin:Settings controllers (#13851) 2021-06-08 10:13:55 +07:00
badges Split Settings::Community from SiteConfig (#13403) 2021-04-26 10:46:35 +02:00
broadcasts/welcome_notification Bump rubocop-performance from 1.10.2 to 1.11.0 (#13471) 2021-04-22 09:31:25 -05:00
chat_channels Fix app/services' ruby 2.7 kwargs warnings (#13177) 2021-04-01 18:40:50 -04:00
color Move HexComparer to Hex::Comparer service (#12202) 2021-01-12 11:34:30 -05:00
credits Fix app/services' ruby 2.7 kwargs warnings (#13177) 2021-04-01 18:40:50 -04:00
edge_cache Replace MAX_USER_MENTIONS with Settings::RateLimit.mention_creation (#13736) 2021-05-12 08:16:38 -07:00
error_messages Removing Settings::General.email_addresses (#13958) 2021-06-11 12:34:34 +03:00
exporter Fix app/services' ruby 2.7 kwargs warnings (#13177) 2021-04-01 18:40:50 -04:00
fastly_config Abstract DatadogStatsClient to ForemStatsClient (#12304) 2021-01-27 11:25:44 -05:00
feeds 15 minute fix: Shorten long titles from feed items if needed (#13961) 2021-06-11 12:51:51 -05:00
follows Fix UI showing "Following" after unfollowing a user (#13757) 2021-05-19 17:40:38 +01:00
giphy Deduplicate giphy_img? function and add tests (#4590) 2019-10-30 11:40:17 -04:00
github Split Settings::Authentication from SiteConfig (#13095) 2021-04-12 09:41:09 +02:00
homepage [Search 2.0] Add query filters for profile, organization and tag index pages (#13510) 2021-04-27 08:49:47 +02:00
html Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
images [15 min fix] Fallback to the image URL if Cloudinary/Imgproxy are not configured (#13767) 2021-05-19 15:03:20 +02:00
loggers Abstract DatadogStatsClient to ForemStatsClient (#12304) 2021-01-27 11:25:44 -05:00
mailchimp Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
markdown_processor [15-min-fix] Add option for triple tildes for fenced codeblocks (#13810) 2021-05-24 14:19:04 -04:00
mentions Expand @-mention functionality to posts (#13367) 2021-05-12 07:33:33 -07:00
moderator Rename banned and comment_banned roles (#12270) 2021-04-06 10:12:14 -05:00
notifications Expand @-mention functionality to posts (#13367) 2021-05-12 07:33:33 -07:00
organizations Organizations delete optimizations and refactoring (#13610) 2021-05-11 12:14:55 +03:00
payments Abstract DatadogStatsClient to ForemStatsClient (#12304) 2021-01-27 11:25:44 -05:00
podcasts Remove Elasticsearch ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ ✂️ (#13606) 2021-05-03 11:09:45 -04:00
profile_fields Remove contact_consent from users (#12196) 2021-01-12 16:18:47 -05:00
profiles Add documentation for Profiles::Update (#13723) 2021-05-12 09:59:39 +07:00
push_notifications Have specs run without Redis and refactor ConsumerApp and Device (#13647) 2021-05-07 08:03:16 +02:00
re_captcha Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
search Search results: prioritize articles titles (#13918) 2021-06-09 14:28:19 +02:00
secrets Use a sortable unique ID for the event_id (#3972) 2019-09-09 10:15:12 -04:00
settings Add Admin:Settings controllers (#13851) 2021-06-08 10:13:55 +07:00
slack Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
tag_moderators Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
twitter_client Split Settings::Authentication from SiteConfig (#13095) 2021-04-12 09:41:09 +02:00
user_blocks Remove algolia from chat channel memberships (#6323) 2020-02-27 09:59:12 -05:00
user_subscriptions Fix app/services' ruby 2.7 kwargs warnings (#13177) 2021-04-01 18:40:50 -04:00
users Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
webhook Fix app/services' ruby 2.7 kwargs warnings (#13177) 2021-04-01 18:40:50 -04:00
analytics_service.rb Upgrade Rails to 6.1.3.1 (#11333) 2021-04-05 10:39:48 -04:00
application_service.rb [deploy] Refactor 🚀 : Replaced Chat Channel Setting page with Preact component. (#8271) 2020-06-10 16:58:37 -04:00
article_api_index_service.rb Add endpoint for articles sorted by published date (#13137) 2021-04-01 13:36:36 -05:00
article_with_video_creation_service.rb Upgrade Rubocop to 0.81 (#7219) 2020-04-11 10:10:04 +02:00
bulk_sql_delete.rb Use SQL DELETE statement to delete notifications without a SELECT (#5303) [deploy] 2019-12-31 07:30:27 -06:00
email_digest.rb Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
email_digest_article_collector.rb Rename SiteConfig to Settings::General (#13573) 2021-05-21 14:45:37 +02:00
feature_flag.rb Adds a feature flag for Data Update Scripts (#12641) 2021-02-10 18:22:27 +02:00
flare_tag.rb [Search 2.0] Homepage query (#13339) 2021-04-21 12:41:24 +02:00
instrumentation.rb Instrument EmailDigestArticleCollector (#13153) 2021-03-29 09:33:32 -04:00
medium_article_retrieval_service.rb Fix app/services' ruby 2.7 kwargs warnings (#13177) 2021-04-01 18:40:50 -04:00
notifications.rb Remove notifiable access from articles and comments notifications (#5415) [deploy] 2020-01-09 10:19:45 -05:00
rate_limit_checker.rb Pin posts to feed (#13807) 2021-06-04 10:54:53 +02:00
tag_adjustment_creation_service.rb [deploy] Rubocop: fix violations of Layout/LineLength (#9197) 2020-07-08 08:36:36 -05:00
tag_adjustment_update_service.rb