rubocop -a (#11674)

This commit is contained in:
rhymes 2020-11-30 14:50:13 +01:00 committed by GitHub
parent 651f822c20
commit a4b73373e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 12 deletions

View file

@ -28,10 +28,10 @@ class Follow < ApplicationRecord
counter_culture :follower, column_name: proc { |follow| COUNTER_CULTURE_COLUMN_NAME_BY_TYPE[follow.followable_type] },
column_names: COUNTER_CULTURE_COLUMNS_NAMES
before_save :calculate_points
after_create :send_email_notification
before_destroy :modify_chat_channel_status
after_save :touch_follower
before_save :calculate_points
after_create_commit :create_chat_channel
validates :blocked, inclusion: { in: [true, false] }

View file

@ -11,11 +11,13 @@ module DataUpdateScripts
# It only busts the "?i=i" variant of the path which is the "internal nav" version, aka the page when swapped
# with internal navigation, not the one landed on directly (which wouldn't have cache mismatches)
Article.published.order("hotness_score DESC").limit(1500).select(:path).each_with_index do |article, index|
relation = Article.published.order(hotness_score: :desc).select(:path)
relation.limit(1500).each_with_index do |article, index|
n = index + 300 # + 300 gives the server time to boot up
BustCachePathWorker.set(queue: :high_priority).perform_in(n.seconds, "#{article.path}?i=i")
end
Article.published.order("hotness_score DESC").offset(1500).limit(3000).select(:path).each_with_index do |article, index|
relation.offset(1500).limit(3000).each_with_index do |article, index|
n = (index * 3) + 450
BustCachePathWorker.set(queue: :medium_priority).perform_in(n.seconds, "#{article.path}?i=i")
end

View file

@ -22,8 +22,9 @@ RSpec.describe "StoriesShow", type: :request do
it "preserves internal nav param (i=i) upon redirect" do
old_path = article.path
article.update(organization: org)
get old_path + "?i=i"
expect(response.body).to redirect_to "#{article.path}?i=i"
get "#{old_path}?i=i"
expect(response.body).to redirect_to "#{article.path}?i=i"
expect(response).to have_http_status(:moved_permanently)
end
@ -31,15 +32,16 @@ RSpec.describe "StoriesShow", type: :request do
old_path = article.path
article.update(organization: org)
get old_path
expect(response.body).not_to redirect_to "#{article.path}?i=i"
expect(response.body).not_to redirect_to "#{article.path}?i=i"
expect(response).to have_http_status(:moved_permanently)
end
it "does not have ?i=i on redirects without that precise param" do
old_path = article.path
article.update(organization: org)
get old_path + "?i=j"
expect(response.body).to redirect_to article.path
get "#{old_path}?i=j"
expect(response.body).to redirect_to article.path
expect(response.body).not_to redirect_to "#{article.path}?i=j"
expect(response.body).not_to redirect_to "#{article.path}?i=j"
end

View file

@ -28,7 +28,7 @@ RSpec.describe "Editing A Comment", type: :system, js: true do
visit article.path.to_s
wait_for_javascript
click_on(class: 'comment__dropdown-trigger')
click_on(class: "comment__dropdown-trigger")
click_link("Edit")
assert_updated
end
@ -42,7 +42,7 @@ RSpec.describe "Editing A Comment", type: :system, js: true do
wait_for_javascript
click_on(class: 'comment__dropdown-trigger')
click_on(class: "comment__dropdown-trigger")
click_link("Edit")
assert_updated
end

View file

@ -26,7 +26,8 @@ RSpec.describe "Visiting article comments", type: :system, js: true do
end
it "displays grandchild comments" do
expect(page).to have_selector(".comment--deep-2#comment-node-#{grandchild_comment.id}", visible: :visible, count: 1)
expect(page).to have_selector(".comment--deep-2#comment-node-#{grandchild_comment.id}", visible: :visible,
count: 1)
end
end
@ -42,7 +43,8 @@ RSpec.describe "Visiting article comments", type: :system, js: true do
end
it "displays grandchild comments" do
expect(page).to have_selector(".comment--deep-2#comment-node-#{grandchild_comment.id}", visible: :visible, count: 1)
expect(page).to have_selector(".comment--deep-2#comment-node-#{grandchild_comment.id}", visible: :visible,
count: 1)
end
end
end