Bump rubocop from 1.17.0 to 1.18.0 (#14107)
* Bump rubocop from 1.17.0 to 1.18.0 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.17.0 to 1.18.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.17.0...v1.18.0) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * yarn install * Fix violations * Restore the default aligned setting * Trigger Travis CI * Escape HTML Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: rhymes <github@rhymes.dev>
This commit is contained in:
parent
6bed507081
commit
816855ce3b
40 changed files with 131 additions and 107 deletions
|
|
@ -342,6 +342,10 @@ Naming/AccessorMethodName:
|
|||
StyleGuide: '#accessor_mutator_method_names'
|
||||
Enabled: false
|
||||
|
||||
Naming/InclusiveLanguage:
|
||||
Description: 'Recommend the use of inclusive language instead of problematic terms.'
|
||||
Enabled: false
|
||||
|
||||
Naming/PredicateName:
|
||||
Description: 'Check the names of predicate methods.'
|
||||
StyleGuide: '#bool-methods-qmark'
|
||||
|
|
|
|||
2
Gemfile
2
Gemfile
|
|
@ -147,7 +147,7 @@ group :development, :test do
|
|||
gem "knapsack_pro", "~> 2.17.0" # Help parallelize Ruby spec builds
|
||||
gem "pry-byebug", "~> 3.8" # Combine 'pry' with 'byebug'. Adds 'step', 'next', 'finish', 'continue' and 'break' commands to control execution
|
||||
gem "rspec-rails", "~> 5.0" # rspec-rails is a testing framework for Rails 3+
|
||||
gem "rubocop", "~> 1.17", require: false # Automatic Ruby code style checking tool
|
||||
gem "rubocop", "~> 1.18", require: false # Automatic Ruby code style checking tool
|
||||
gem "rubocop-performance", "~> 1.11", require: false # A collection of RuboCop cops to check for performance optimizations in Ruby code
|
||||
gem "rubocop-rails", "~> 2.11", require: false # Automatic Rails code style checking tool
|
||||
gem "rubocop-rspec", "~> 2.4", require: false # Code style checking for RSpec files
|
||||
|
|
|
|||
|
|
@ -646,7 +646,7 @@ GEM
|
|||
rspec-retry (0.6.2)
|
||||
rspec-core (> 3.3)
|
||||
rspec-support (3.10.2)
|
||||
rubocop (1.17.0)
|
||||
rubocop (1.18.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.0.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
|
|
@ -951,7 +951,7 @@ DEPENDENCIES
|
|||
rpush-redis (~> 1.1)
|
||||
rspec-rails (~> 5.0)
|
||||
rspec-retry (~> 0.6)
|
||||
rubocop (~> 1.17)
|
||||
rubocop (~> 1.18)
|
||||
rubocop-performance (~> 1.11)
|
||||
rubocop-rails (~> 2.11)
|
||||
rubocop-rspec (~> 2.4)
|
||||
|
|
|
|||
|
|
@ -96,9 +96,9 @@ module Admin
|
|||
Moderator::DeleteUser.call(user: @user)
|
||||
link = helpers.tag.a("the page", href: admin_users_gdpr_delete_requests_path, data: { "no-instant" => true })
|
||||
message = "@#{@user.username} (email: #{@user.email.presence || 'no email'}, user_id: #{@user.id}) " \
|
||||
"has been fully deleted. " \
|
||||
"If this is a GDPR delete, delete them from Mailchimp & Google Analytics " \
|
||||
" and confirm on "
|
||||
"has been fully deleted. " \
|
||||
"If this is a GDPR delete, delete them from Mailchimp & Google Analytics " \
|
||||
" and confirm on "
|
||||
flash[:success] = helpers.safe_join([message, link, "."])
|
||||
rescue StandardError => e
|
||||
flash[:danger] = e.message
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class ConfirmationsController < Devise::ConfirmationsController
|
||||
FLASH_MESSAGE = "Email sent! Please contact support at %<email>s if you are "\
|
||||
"having trouble receiving your confirmation instructions.".freeze
|
||||
"having trouble receiving your confirmation instructions.".freeze
|
||||
|
||||
def create
|
||||
self.resource = resource_class.send_confirmation_instructions(resource_params)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ class FeedbackMessagesController < ApplicationController
|
|||
# No authorization required for entirely public controller
|
||||
skip_before_action :verify_authenticity_token
|
||||
FLASH_MESSAGE = "Make sure the forms are filled. 🤖 Other possible errors: "\
|
||||
"%<errors>s".freeze
|
||||
"%<errors>s".freeze
|
||||
|
||||
def create
|
||||
flash.clear
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ class OrganizationsController < ApplicationController
|
|||
|
||||
redirect_to user_settings_path(:organization)
|
||||
rescue Pundit::NotAuthorizedError
|
||||
flash[:error] = "Your organization was not deleted; you must be an admin, the only member in the organization,
|
||||
and have no articles connected to the organization."
|
||||
flash[:error] = "Your organization was not deleted; you must be an admin, the only member in the organization, " \
|
||||
"and have no articles connected to the organization."
|
||||
redirect_to user_settings_path(:organization, id: organization.id)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
module Authentication
|
||||
module Errors
|
||||
PREVIOUSLY_SUSPENDED_MESSAGE = "It appears that your previous %<community_name>s " \
|
||||
"account was suspended. As such, we've taken measures to prevent you from " \
|
||||
"creating a new account with %<community_name>s and its community. If you " \
|
||||
"think that there has been a mistake, please email us at %<community_email>s, " \
|
||||
"and we will take another look.".freeze
|
||||
"account was suspended. As such, we've taken measures to prevent you from " \
|
||||
"creating a new account with %<community_name>s and its community. If you " \
|
||||
"think that there has been a mistake, please email us at %<community_email>s, " \
|
||||
"and we will take another look.".freeze
|
||||
|
||||
class Error < StandardError
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module RateLimitCheckerHelper
|
||||
NEW_USER_MESSAGE = "How many %<thing>s can a new member (%<timeframe>s or less) " \
|
||||
"create within any 5 minute period?".freeze
|
||||
"create within any 5 minute period?".freeze
|
||||
|
||||
def self.new_user_message(thing)
|
||||
timeframe = "day".pluralize(Settings::RateLimit.user_considered_new_days)
|
||||
|
|
|
|||
|
|
@ -60,8 +60,8 @@ module Constants
|
|||
placeholder: "What is the Google reCAPTCHA secret key?"
|
||||
},
|
||||
require_captcha_for_email_password_registration: {
|
||||
description: "People will be required to fill out a captcha when
|
||||
they're creating a new account in your community",
|
||||
description:
|
||||
"People will be required to fill out a captcha when they're creating a new account in your community",
|
||||
placeholder: ""
|
||||
},
|
||||
twitter_key: {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ module Constants
|
|||
},
|
||||
main_social_image: {
|
||||
description: "Used as the main image in social networks and OpenGraph. Recommended aspect ratio " \
|
||||
"of 16:9 (600x337px,1200x675px)",
|
||||
"of 16:9 (600x337px,1200x675px)",
|
||||
placeholder: IMAGE_PLACEHOLDER
|
||||
},
|
||||
mailchimp_api_key: {
|
||||
|
|
@ -86,7 +86,7 @@ module Constants
|
|||
},
|
||||
payment_pointer: {
|
||||
description: "Used for site-wide web monetization. " \
|
||||
"See: https://github.com/thepracticaldev/dev.to/pull/6345",
|
||||
"See: https://github.com/thepracticaldev/dev.to/pull/6345",
|
||||
placeholder: "$pay.somethinglikethis.co/value"
|
||||
},
|
||||
periodic_email_digest: {
|
||||
|
|
@ -103,29 +103,29 @@ module Constants
|
|||
},
|
||||
stripe_api_key: {
|
||||
description: "Secret Stripe key for receiving payments. " \
|
||||
"See: https://stripe.com/docs/keys",
|
||||
"See: https://stripe.com/docs/keys",
|
||||
placeholder: "sk_live_...."
|
||||
},
|
||||
stripe_publishable_key: {
|
||||
description: "Public Stripe key for receiving payments. " \
|
||||
"See: https://stripe.com/docs/keys",
|
||||
"See: https://stripe.com/docs/keys",
|
||||
placeholder: "pk_live_...."
|
||||
},
|
||||
suggested_tags: {
|
||||
description: "Determines which tags are suggested to new users during onboarding (comma
|
||||
separated, letters only)",
|
||||
description:
|
||||
"Determines which tags are suggested to new users during onboarding (comma separated, letters only)",
|
||||
placeholder: "List of valid tags: comma separated, letters only e.g. beginners,javascript,ruby,swift,kotlin"
|
||||
},
|
||||
suggested_users: {
|
||||
description: "Determines which users are suggested to follow to new users during onboarding (comma " \
|
||||
"separated, letters only). Please note that these users will be shown as a fallback if no " \
|
||||
"recently-active commenters or producers can be suggested",
|
||||
"separated, letters only). Please note that these users will be shown as a fallback if no " \
|
||||
"recently-active commenters or producers can be suggested",
|
||||
placeholder: "List of valid usernames: comma separated, letters only e.g. " \
|
||||
"ben,jess,peter,maestromac,andy,liana"
|
||||
"ben,jess,peter,maestromac,andy,liana"
|
||||
},
|
||||
prefer_manual_suggested_users: {
|
||||
description: "Always show suggested users as suggested people to follow even when " \
|
||||
"auto-suggestion is available"
|
||||
"auto-suggestion is available"
|
||||
},
|
||||
twitter_hashtag: {
|
||||
description: "Used as the twitter hashtag of the community",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module Constants
|
|||
},
|
||||
user_considered_new_days: {
|
||||
description: "The number of days a user is considered new. The default is 3 days, but you "\
|
||||
"can disable this entirely by inputting 0.",
|
||||
"can disable this entirely by inputting 0.",
|
||||
placeholder: ::Settings::RateLimit.user_considered_new_days
|
||||
}
|
||||
}.freeze
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ module Constants
|
|||
},
|
||||
authentication: {
|
||||
description: " If your mail server requires authentication, " \
|
||||
"you need to specify the authentication type here",
|
||||
"you need to specify the authentication type here",
|
||||
placeholder: "ie. plain, login, or cram_md5"
|
||||
},
|
||||
user_name: {
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ module Constants
|
|||
description: "Determines the default reading font (registered users can change this in their UX settings)"
|
||||
},
|
||||
feed_strategy: {
|
||||
description: "Determines the main feed algorithm approach the app takes: basic or large_forem_experimental
|
||||
(which should only be used for 10k+ member communities)",
|
||||
description: "Determines the main feed algorithm approach the app takes: basic or large_forem_experimental " \
|
||||
"(which should only be used for 10k+ member communities)",
|
||||
placeholder: "basic"
|
||||
},
|
||||
feed_style: {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class SpotifyTag < LiquidTagBase
|
|||
|
||||
def raise_error
|
||||
msg = "Invalid Spotify Link - Be sure you're using the uri of a specific track, " \
|
||||
"album, artist, playlist, or podcast episode."
|
||||
"album, artist, playlist, or podcast episode."
|
||||
raise StandardError, msg
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class StackexchangeTag < LiquidTagBase
|
|||
id = input.split.first
|
||||
|
||||
url = "#{API_URL}posts/#{id}?site=#{@site}&filter=#{FILTERS['post']}" \
|
||||
"&key=#{ApplicationConfig['STACK_EXCHANGE_APP_KEY']}"
|
||||
"&key=#{ApplicationConfig['STACK_EXCHANGE_APP_KEY']}"
|
||||
post_response = HTTParty.get(url)
|
||||
|
||||
handle_response_error(post_response, input)
|
||||
|
|
@ -83,7 +83,7 @@ class StackexchangeTag < LiquidTagBase
|
|||
@post_type = post_response["items"][0]["post_type"]
|
||||
|
||||
url = "#{API_URL}#{@post_type.pluralize}/#{id}?site=#{@site}" \
|
||||
"&filter=#{FILTERS[@post_type]}&key=#{ApplicationConfig['STACK_EXCHANGE_APP_KEY']}"
|
||||
"&filter=#{FILTERS[@post_type]}&key=#{ApplicationConfig['STACK_EXCHANGE_APP_KEY']}"
|
||||
final_response = HTTParty.get(url)
|
||||
|
||||
handle_response_error(final_response, input)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
class WikipediaTag < LiquidTagBase
|
||||
PARTIAL = "liquids/wikipedia".freeze
|
||||
WIKI_REGEXP = %r{\Ahttps?://([a-z-]+)\.wikipedia.org/wiki/(\S+)\z}.freeze
|
||||
TEXT_CLEANUP_XPATH = "//div[contains(@class, 'noprint') or contains(@class, 'hatnote')] | " \
|
||||
"//span[@class='mw-ref'] | //figure | //sup".freeze
|
||||
|
||||
def initialize(_tag_name, input, _parse_context)
|
||||
super
|
||||
|
|
@ -89,12 +91,10 @@ class WikipediaTag < LiquidTagBase
|
|||
|
||||
def text_clean_up(text)
|
||||
doc = Nokogiri::HTML(text)
|
||||
path_expression = "//div[contains(@class, 'noprint') or contains(@class, 'hatnote')] |
|
||||
//span[@class='mw-ref'] |
|
||||
//figure |
|
||||
//sup"
|
||||
doc.xpath(path_expression).each(&:remove)
|
||||
|
||||
doc.xpath(TEXT_CLEANUP_XPATH).each(&:remove)
|
||||
doc.xpath("//a").each { |x| x.replace Nokogiri::XML::Text.new(x.inner_html, x.document) }
|
||||
|
||||
doc.to_html
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class Reaction < ApplicationRecord
|
|||
def cached_any_reactions_for?(reactable, user, category)
|
||||
class_name = reactable.instance_of?(ArticleDecorator) ? "Article" : reactable.class.name
|
||||
cache_name = "any_reactions_for-#{class_name}-#{reactable.id}-" \
|
||||
"#{user.reactions_count}-#{user.public_reactions_count}-#{category}"
|
||||
"#{user.reactions_count}-#{user.public_reactions_count}-#{category}"
|
||||
Rails.cache.fetch(cache_name, expires_in: 24.hours) do
|
||||
Reaction.where(reactable_id: reactable.id, reactable_type: class_name, user: user, category: category).any?
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
module Admin
|
||||
class UsersQuery
|
||||
QUERY_CLAUSE = "users.name ILIKE :search OR " \
|
||||
"users.username ILIKE :search OR " \
|
||||
"users.github_username ILIKE :search OR " \
|
||||
"users.email ILIKE :search OR " \
|
||||
"users.twitter_username ILIKE :search".freeze
|
||||
|
||||
def self.call(relation: User.registered, options: {})
|
||||
role, search = options.values_at(:role, :search)
|
||||
|
||||
|
|
@ -10,11 +16,7 @@ module Admin
|
|||
end
|
||||
|
||||
def self.search_relation(relation, search)
|
||||
relation.where("users.name ILIKE :search OR
|
||||
users.username ILIKE :search OR
|
||||
users.github_username ILIKE :search OR
|
||||
users.email ILIKE :search OR
|
||||
users.twitter_username ILIKE :search", search: "%#{search.strip}%")
|
||||
relation.where(QUERY_CLAUSE, search: "%#{search.strip}%")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ module Articles
|
|||
|
||||
def user_editor_v1
|
||||
body = "---\ntitle: \npublished: false\ndescription: " \
|
||||
"\ntags: \n//cover_image: https://direct_url_to_image.jpg\n---\n\n"
|
||||
"\ntags: \n//cover_image: https://direct_url_to_image.jpg\n---\n\n"
|
||||
|
||||
Article.new(
|
||||
body_markdown: body,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ module Badges
|
|||
class AwardStreak
|
||||
LONGEST_STREAK_WEEKS = 16
|
||||
LONGEST_STREAK_MESSAGE = "16 weeks! You've achieved the longest writing " \
|
||||
"streak possible. This makes you eligible for special quests in the future. " \
|
||||
"Keep up the amazing contributions to our community!".freeze
|
||||
"streak possible. This makes you eligible for special quests in the future. " \
|
||||
"Keep up the amazing contributions to our community!".freeze
|
||||
|
||||
MINIMUM_QUALITY = -25
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ module ErrorMessages
|
|||
FRONTMATTER_ERROR = /expected key while parsing a block mapping at line/.freeze
|
||||
|
||||
REPLACEMENT_ERROR = "There was a problem parsing the front-matter YAML. " \
|
||||
"Perhaps you need to escape a quote or a colon or something. " \
|
||||
"Email %s if you are having trouble.".freeze
|
||||
"Perhaps you need to escape a quote or a colon or something. " \
|
||||
"Email %s if you are having trouble.".freeze
|
||||
|
||||
def self.call(error_message)
|
||||
return error_message unless error_message.match?(FRONTMATTER_ERROR)
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ module Moderator
|
|||
|
||||
def handle_identities
|
||||
error_message = "The user being deleted already has two identities. " \
|
||||
"Are you sure this is the right user to be deleted? " \
|
||||
"If so, a super admin will need to do this from the console to be safe."
|
||||
"Are you sure this is the right user to be deleted? " \
|
||||
"If so, a super admin will need to do this from the console to be safe."
|
||||
raise error_message if @delete_user.identities.count.positive?
|
||||
|
||||
return true if
|
||||
|
|
|
|||
|
|
@ -12,10 +12,12 @@ module Search
|
|||
|
||||
# User.search_score used to take employer related fields into account, but they have since been moved to profile
|
||||
# and removed from fields that are searched against.
|
||||
# rubocop:disable Layout/LineEndStringConcatenationIndentation
|
||||
HOTNESS_SCORE_ORDER = Arel.sql(%{
|
||||
(((articles_count + comments_count + reactions_count + badge_achievements_count) * 10) * reputation_modifier)
|
||||
DESC
|
||||
}.squish).freeze
|
||||
# rubocop:enable Layout/LineEndStringConcatenationIndentation
|
||||
|
||||
def self.search_documents(term: nil, sort_by: :nil, sort_direction: :desc, page: 0, per_page: DEFAULT_PER_PAGE)
|
||||
# NOTE: we should eventually update the frontend
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ module UserSubscriptions
|
|||
|
||||
def call
|
||||
cache_key = "user-#{user.id}-#{user.updated_at.rfc3339}-#{user.subscribed_to_user_subscriptions_count}/" \
|
||||
"is_subscribed_#{source_type}_#{source_id}"
|
||||
"is_subscribed_#{source_type}_#{source_id}"
|
||||
Rails.cache.fetch(cache_key, expires_in: 24.hours) do
|
||||
UserSubscription.where(
|
||||
subscriber_id: user.id,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ module Reactions
|
|||
cache_bust.call("/reactions?article_id=#{reaction.reactable_id}")
|
||||
when "Comment"
|
||||
path = "/reactions?commentable_id=#{reaction.reactable.commentable_id}&" \
|
||||
"commentable_type=#{reaction.reactable.commentable_type}"
|
||||
"commentable_type=#{reaction.reactable.commentable_type}"
|
||||
cache_bust.call(path)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ Rails.application.configure do
|
|||
# Check if there are any data update scripts to run during startup
|
||||
if %w[Console Server DBConsole].any? { |const| Rails.const_defined?(const) } && DataUpdateScript.scripts_to_run?
|
||||
message = "Data update scripts need to be run before you can start the application. " \
|
||||
"Please run 'rails data_updates:run'"
|
||||
"Please run 'rails data_updates:run'"
|
||||
raise message
|
||||
end
|
||||
end
|
||||
|
|
|
|||
33
db/seeds.rb
33
db/seeds.rb
|
|
@ -290,33 +290,38 @@ end
|
|||
seeder.create_if_none(Broadcast) do
|
||||
broadcast_messages = {
|
||||
set_up_profile: "Welcome to DEV! 👋 I'm Sloan, the community mascot and I'm here to help get you started. " \
|
||||
"Let's begin by <a href='/settings'>setting up your profile</a>!",
|
||||
"Let's begin by <a href='/settings'>setting up your profile</a>!",
|
||||
welcome_thread: "Sloan here again! 👋 DEV is a friendly community. " \
|
||||
"Why not introduce yourself by leaving a comment in <a href='/welcome'>the welcome thread</a>!",
|
||||
"Why not introduce yourself by leaving a comment in <a href='/welcome'>the welcome thread</a>!",
|
||||
twitter_connect: "You're on a roll! 🎉 Do you have a Twitter account? " \
|
||||
"Consider <a href='/settings'>connecting it</a> so we can @mention you if we share your post " \
|
||||
"via our Twitter account <a href='https://twitter.com/thePracticalDev'>@thePracticalDev</a>.",
|
||||
"Consider <a href='/settings'>connecting it</a> so we can @mention you if we share your post " \
|
||||
"via our Twitter account <a href='https://twitter.com/thePracticalDev'>@thePracticalDev</a>.",
|
||||
facebook_connect: "You're on a roll! 🎉 Do you have a Facebook account? " \
|
||||
"Consider <a href='/settings'>connecting it</a>.",
|
||||
"Consider <a href='/settings'>connecting it</a>.",
|
||||
github_connect: "You're on a roll! 🎉 Do you have a GitHub account? " \
|
||||
"Consider <a href='/settings'>connecting it</a> so you can pin any of your repos to your profile.",
|
||||
customize_feed: "Hi, it's me again! 👋 Now that you're a part of the DEV community, let's focus on personalizing " \
|
||||
"Consider <a href='/settings'>connecting it</a> so you can pin any of your repos to your profile.",
|
||||
customize_feed:
|
||||
"Hi, it's me again! 👋 Now that you're a part of the DEV community, let's focus on personalizing " \
|
||||
"your content. You can start by <a href='/tags'>following some tags</a> to help customize your feed! 🎉",
|
||||
customize_experience: "Sloan here! 👋 Did you know that that you can customize your DEV experience? " \
|
||||
customize_experience:
|
||||
"Sloan here! 👋 Did you know that that you can customize your DEV experience? " \
|
||||
"Try changing <a href='settings/customization'>your font and theme</a> and find the best style for you!",
|
||||
start_discussion: "Sloan here! 👋 I noticed that you haven't " \
|
||||
start_discussion:
|
||||
"Sloan here! 👋 I noticed that you haven't " \
|
||||
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. Starting a discussion is easy to do; " \
|
||||
"just click on 'Create Post' in the sidebar of the tag page to get started!",
|
||||
ask_question: "Sloan here! 👋 I noticed that you haven't " \
|
||||
"just click on 'Create Post' in the sidebar of the tag page to get started!",
|
||||
ask_question:
|
||||
"Sloan here! 👋 I noticed that you haven't " \
|
||||
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> yet. Asking a question is easy to do; " \
|
||||
"just click on 'Create Post' in the sidebar of the tag page to get started!",
|
||||
discuss_and_ask: "Sloan here! 👋 I noticed that you haven't " \
|
||||
discuss_and_ask:
|
||||
"Sloan here! 👋 I noticed that you haven't " \
|
||||
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> or " \
|
||||
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. It's easy to do both of these; " \
|
||||
"just click on 'Create Post' in the sidebar of the tag page to get started!",
|
||||
download_app: "Sloan here, with one last tip! 👋 Have you downloaded the DEV mobile app yet? " \
|
||||
"Consider <a href='https://dev.to/downloads'>downloading</a> it so you can access all " \
|
||||
"of your favorite DEV content on the go!"
|
||||
"Consider <a href='https://dev.to/downloads'>downloading</a> it so you can access all " \
|
||||
"of your favorite DEV content on the go!"
|
||||
}
|
||||
|
||||
broadcast_messages.each do |type, message|
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ module DataUpdateScripts
|
|||
return if Broadcast.find_by title: "Welcome Notification: facebook_connect"
|
||||
|
||||
message = "You're on a roll! 🎉 Do you have a Facebook account? " \
|
||||
"Consider <a href='/settings'>connecting it</a>."
|
||||
"Consider <a href='/settings'>connecting it</a>."
|
||||
|
||||
Broadcast.create!(
|
||||
title: "Welcome Notification: facebook_connect",
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"Welcome to DEV! 👋 I'm <a href='https://dev.to/sloan'>Sloan</a>, " \
|
||||
"the community mascot and I'm here to help get you started. " \
|
||||
"Let's begin by <a href='https://dev.to/settings'>setting up your profile</a>!"
|
||||
"the community mascot and I'm here to help get you started. " \
|
||||
"Let's begin by <a href='https://dev.to/settings'>setting up your profile</a>!"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"Sloan here again! 👋 DEV is a friendly community. " \
|
||||
"Why not introduce yourself by leaving a comment in <a href='/welcome'>the welcome thread</a>!"
|
||||
"Why not introduce yourself by leaving a comment in <a href='/welcome'>the welcome thread</a>!"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"You're on a roll! 🎉 Do you have a GitHub account? Consider " \
|
||||
"<a href='/settings'>connecting it</a> so you can pin any of your repos to your profile."
|
||||
"<a href='/settings'>connecting it</a> so you can pin any of your repos to your profile."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"You're on a roll! 🎉 Do you have a Facebook account? Consider " \
|
||||
"<a href='/settings'>connecting it</a>."
|
||||
"<a href='/settings'>connecting it</a>."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -53,8 +53,8 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"You're on a roll! 🎉 Do you have a Twitter account? Consider " \
|
||||
"<a href='/settings'>connecting it</a> so we can @mention you if we share " \
|
||||
"your post via our Twitter account <a href='https://twitter.com/thePracticalDev'>@thePracticalDev</a>."
|
||||
"<a href='/settings'>connecting it</a> so we can @mention you if we share " \
|
||||
"your post via our Twitter account <a href='https://twitter.com/thePracticalDev'>@thePracticalDev</a>."
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -63,7 +63,7 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"Sloan here! 👋 Did you know that that you can customize your DEV experience? " \
|
||||
"Try changing <a href='settings/customization'>your font and theme</a> and find the best style for you!"
|
||||
"Try changing <a href='settings/customization'>your font and theme</a> and find the best style for you!"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -72,8 +72,8 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"Hi, it's me again! 👋 Now that you're a part of the DEV community, " \
|
||||
"let's focus on personalizing your content. You can start by " \
|
||||
"<a href='/tags'>following some tags</a> to help customize your feed! 🎉"
|
||||
"let's focus on personalizing your content. You can start by " \
|
||||
"<a href='/tags'>following some tags</a> to help customize your feed! 🎉"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -82,9 +82,9 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"Sloan here! 👋 I noticed that you haven't " \
|
||||
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. " \
|
||||
"Starting a discussion is easy to do; just click on 'Create Post' " \
|
||||
"in the sidebar of the tag page to get started!"
|
||||
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. " \
|
||||
"Starting a discussion is easy to do; just click on 'Create Post' " \
|
||||
"in the sidebar of the tag page to get started!"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -93,8 +93,8 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"Sloan here! 👋 I noticed that you haven't " \
|
||||
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> yet. " \
|
||||
"Asking a question is easy to do; just click on 'Create Post' in the sidebar of the tag page to get started!"
|
||||
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> yet. " \
|
||||
"Asking a question is easy to do; just click on 'Create Post' in the sidebar of the tag page to get started!"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -103,9 +103,9 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"Sloan here! 👋 I noticed that you haven't " \
|
||||
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> or " \
|
||||
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. " \
|
||||
"It's easy to do both of these; just click on 'Create Post' in the sidebar of the tag page to get started!"
|
||||
"<a href='https://dev.to/t/explainlikeimfive'>asked a question</a> or " \
|
||||
"<a href='https://dev.to/t/discuss'>started a discussion</a> yet. " \
|
||||
"It's easy to do both of these; just click on 'Create Post' in the sidebar of the tag page to get started!"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -114,8 +114,8 @@ FactoryBot.define do
|
|||
type_of { "Welcome" }
|
||||
processed_html do
|
||||
"Sloan here, with one last tip! 👋 Have you downloaded the DEV mobile " \
|
||||
"app yet? Consider <a href='https://dev.to/downloads'>downloading</a> it " \
|
||||
"so you can access all of your favorite DEV content on the go!"
|
||||
"app yet? Consider <a href='https://dev.to/downloads'>downloading</a> it " \
|
||||
"so you can access all of your favorite DEV content on the go!"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -128,7 +128,8 @@ FactoryBot.define do
|
|||
trait :with_tracking do
|
||||
processed_html do
|
||||
"Sloan here again! 👋 DEV is a friendly community. Why not introduce " \
|
||||
"yourself by leaving a comment in <a href='/welcome' onclick='trackNotification(event)'>the welcome thread</a>!"
|
||||
"yourself by leaving a comment in <a href='/welcome' onclick='trackNotification(event)'>" \
|
||||
"the welcome thread</a>!"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ RSpec.describe ApplicationHelper, type: :helper do
|
|||
}
|
||||
|
||||
link = "<a href=\"mailto:#{default_email}?body=This%20is%20a%20longer%20body%20with%20a%20" \
|
||||
"question%20mark%20%3F%20%0A%20and%20a%20newline&subject=This%20is%20a%20long%20subject\">text</a>"
|
||||
"question%20mark%20%3F%20%0A%20and%20a%20newline&subject=This%20is%20a%20long%20subject\">text</a>"
|
||||
expect(email_link(text: "text", additional_info: additional_info)).to eq(link)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ describe DataUpdateScripts::UpdateArticleMainImagePath do
|
|||
allow(ENV).to receive(:[]).with("FOREM_CONTEXT").and_return("forem_cloud")
|
||||
|
||||
bad_path = "https://res.cloudinary.com/practicaldev/image/fetch/s--d-pOh1Z_--/c_imagga_scale,f_auto," \
|
||||
"fl_progressive,h_420,q_auto,w_1000/#{URL.url}/images/i/some-image.jpeg"
|
||||
"fl_progressive,h_420,q_auto,w_1000/#{URL.url}/images/i/some-image.jpeg"
|
||||
article = create(:article, main_image: bad_path)
|
||||
|
||||
described_class.new.run
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ RSpec.describe LinkTag, type: :liquid_tag do
|
|||
<div class='ltag__link'>
|
||||
<a href='#{article.organization.path}' class='ltag__link__link'>
|
||||
<div class='ltag__link__org__pic'>
|
||||
<img src='#{Images::Profile.call(article.organization.profile_image_url, length: 150)}' alt='#{article.organization.name}'>
|
||||
<img src='#{Images::Profile.call(article.organization.profile_image_url, length: 150)}' alt='#{CGI.escapeHTML(article.organization.name)}'>
|
||||
<div class='ltag__link__user__pic'>
|
||||
<img src='#{Images::Profile.call(article.user.profile_image_url, length: 150)}' alt=''>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ RSpec.describe SpotifyTag, type: :liquid_tag do
|
|||
|
||||
it "raises an error if the uri is invalid" do
|
||||
message = "Invalid Spotify Link - Be sure you're using the uri of a specific track, " \
|
||||
"album, artist, playlist, or podcast episode."
|
||||
"album, artist, playlist, or podcast episode."
|
||||
expect do
|
||||
generate_tag(invalid_uri)
|
||||
end.to raise_error(StandardError, message)
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ RSpec.describe Articles::Builder, type: :service do
|
|||
let(:user) { create(:user, editor_version: "v1") }
|
||||
let(:correct_attributes) do
|
||||
body = "---\ntitle: \npublished: false\ndescription: \ntags: " \
|
||||
"\n//cover_image: https://direct_url_to_image.jpg\n---\n\n"
|
||||
"\n//cover_image: https://direct_url_to_image.jpg\n---\n\n"
|
||||
|
||||
{
|
||||
body_markdown: body,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ RSpec.describe Authentication::Providers::Twitter, type: :service do
|
|||
describe ".sign_in_path" do
|
||||
let(:expected_path) do
|
||||
"/users/auth/twitter?callback_url=" \
|
||||
"http%3A%2F%2Flocalhost%3A3000%2Fusers%2Fauth%2Ftwitter%2Fcallback&secure_image_url=true"
|
||||
"http%3A%2F%2Flocalhost%3A3000%2Fusers%2Fauth%2Ftwitter%2Fcallback&secure_image_url=true"
|
||||
end
|
||||
|
||||
it "returns the correct sign in path" do
|
||||
|
|
|
|||
|
|
@ -56,11 +56,19 @@ RSpec.describe MarkdownProcessor::Parser, type: :service do
|
|||
end
|
||||
|
||||
it "escapes codeblocks in numbered lists" do
|
||||
code_block = "1. Define your hooks in config file `lefthook.yml`\n
|
||||
```yaml
|
||||
pre-push:\n parallel: true\n commands:\n rubocop:
|
||||
run: bundle exec rspec --fail-fast\n
|
||||
```"
|
||||
code_block = <<~CODE_BLOCK
|
||||
1. Define your hooks in config file `lefthook.yml`
|
||||
|
||||
```yaml
|
||||
pre-push:
|
||||
parallel: true
|
||||
commands:
|
||||
rubocop:
|
||||
run: bundle exec rspec --fail-fast
|
||||
|
||||
```
|
||||
CODE_BLOCK
|
||||
|
||||
escaped_codeblock = generate_and_parse_markdown(code_block)
|
||||
expect(escaped_codeblock).not_to include("```")
|
||||
expect(escaped_codeblock).not_to include("`")
|
||||
|
|
@ -208,9 +216,11 @@ RSpec.describe MarkdownProcessor::Parser, type: :service do
|
|||
DOC
|
||||
result = generate_and_parse_markdown(mention)
|
||||
|
||||
# rubocop:disable Layout/LineLength
|
||||
expected_result = "<p><code>@#{user.username}</code> one two, <a class=\"mentioned-user\" " \
|
||||
"href=\"#{ApplicationConfig['APP_PROTOCOL']}#{ApplicationConfig['APP_DOMAIN']}/#{user.username}\">" \
|
||||
"@#{user.username}</a>\n three four:</p>\n\n<ul>\n<li><code>@#{user.username}</code></li>\n</ul>\n\n"
|
||||
"href=\"#{ApplicationConfig['APP_PROTOCOL']}#{ApplicationConfig['APP_DOMAIN']}/#{user.username}\">" \
|
||||
"@#{user.username}</a>\n three four:</p>\n\n<ul>\n<li><code>@#{user.username}</code></li>\n</ul>\n\n"
|
||||
# rubocop:enable Layout/LineLength
|
||||
expect(result).to eq(expected_result)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -217,9 +217,9 @@ end
|
|||
|
||||
seeder.create_if_doesnt_exist(NavigationLink, "url", "/contact") do
|
||||
icon = '<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">'\
|
||||
'<path d="M12 1l9.5 5.5v11L12 23l-9.5-5.5v-11L12 1zm0 2.311L4.5 7.653v8.694l7.5 4.342'\
|
||||
'7.5-4.342V7.653L12 3.311zM12 16a4 4 0 110-8 4 4 0 010 8zm0-2a2 2 0 100-4 2 2 0 000 4z"/>'\
|
||||
'</svg>'
|
||||
'<path d="M12 1l9.5 5.5v11L12 23l-9.5-5.5v-11L12 1zm0 2.311L4.5 7.653v8.694l7.5 4.342'\
|
||||
'7.5-4.342V7.653L12 3.311zM12 16a4 4 0 110-8 4 4 0 010 8zm0-2a2 2 0 100-4 2 2 0 000 4z"/>'\
|
||||
'</svg>'
|
||||
6.times do |i|
|
||||
NavigationLink.create!(
|
||||
name: "Nav link #{i}",
|
||||
|
|
|
|||
BIN
vendor/cache/rubocop-1.17.0.gem
vendored
BIN
vendor/cache/rubocop-1.17.0.gem
vendored
Binary file not shown.
BIN
vendor/cache/rubocop-1.18.0.gem
vendored
Normal file
BIN
vendor/cache/rubocop-1.18.0.gem
vendored
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue