DEV: Fix new Rubocop offenses
This commit is contained in:
parent
58015fc753
commit
665d35f914
40
Gemfile.lock
40
Gemfile.lock
|
@ -1,35 +1,60 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
activesupport (7.1.3.2)
|
||||
base64
|
||||
bigdecimal
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
connection_pool (>= 2.2.5)
|
||||
drb
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
mutex_m
|
||||
tzinfo (~> 2.0)
|
||||
ast (2.4.2)
|
||||
base64 (0.2.0)
|
||||
bigdecimal (3.1.6)
|
||||
concurrent-ruby (1.2.3)
|
||||
connection_pool (2.4.1)
|
||||
drb (2.2.0)
|
||||
ruby2_keywords
|
||||
i18n (1.14.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.7.1)
|
||||
language_server-protocol (3.17.0.3)
|
||||
minitest (5.22.2)
|
||||
mutex_m (0.2.0)
|
||||
parallel (1.24.0)
|
||||
parser (3.3.0.2)
|
||||
parser (3.3.0.5)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
prettier_print (1.2.1)
|
||||
prism (0.24.0)
|
||||
racc (1.7.3)
|
||||
rainbow (3.1.1)
|
||||
regexp_parser (2.9.0)
|
||||
rexml (3.2.6)
|
||||
rubocop (1.59.0)
|
||||
rubocop (1.61.0)
|
||||
json (~> 2.3)
|
||||
language_server-protocol (>= 3.17.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.2.2.4)
|
||||
parser (>= 3.3.0.2)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.30.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 3.0)
|
||||
rubocop-ast (1.30.0)
|
||||
parser (>= 3.2.1.0)
|
||||
rubocop-ast (1.31.0)
|
||||
parser (>= 3.3.0.4)
|
||||
prism (>= 0.24.0)
|
||||
rubocop-capybara (2.20.0)
|
||||
rubocop (~> 1.41)
|
||||
rubocop-discourse (3.6.0)
|
||||
rubocop-discourse (3.7.1)
|
||||
activesupport (>= 6.1)
|
||||
rubocop (>= 1.59.0)
|
||||
rubocop-capybara (>= 2.0.0)
|
||||
rubocop-factory_bot (>= 2.0.0)
|
||||
rubocop-rspec (>= 2.25.0)
|
||||
rubocop-factory_bot (2.25.1)
|
||||
rubocop (~> 1.41)
|
||||
|
@ -38,8 +63,11 @@ GEM
|
|||
rubocop-capybara (~> 2.17)
|
||||
rubocop-factory_bot (~> 2.22)
|
||||
ruby-progressbar (1.13.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
syntax_tree (6.2.0)
|
||||
prettier_print (>= 1.2.0)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
unicode-display_width (2.5.0)
|
||||
|
||||
PLATFORMS
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
VALID_OPTIONS = [
|
||||
:start,
|
||||
:end,
|
||||
:status,
|
||||
:"allowed-groups",
|
||||
:url,
|
||||
:name,
|
||||
:reminders,
|
||||
:recurrence,
|
||||
:timezone,
|
||||
:minimal,
|
||||
]
|
||||
|
||||
module DiscoursePostEvent
|
||||
class EventParser
|
||||
VALID_OPTIONS = [
|
||||
:start,
|
||||
:end,
|
||||
:status,
|
||||
:"allowed-groups",
|
||||
:url,
|
||||
:name,
|
||||
:reminders,
|
||||
:recurrence,
|
||||
:timezone,
|
||||
:minimal,
|
||||
]
|
||||
|
||||
def self.extract_events(post)
|
||||
cooked = PrettyText.cook(post.raw, topic_id: post.topic_id, user_id: post.user_id)
|
||||
valid_options = VALID_OPTIONS.map { |o| "data-#{o}" }
|
||||
|
|
|
@ -2,15 +2,12 @@
|
|||
|
||||
module DiscoursePostEvent
|
||||
module PostExtension
|
||||
def self.prepended(base)
|
||||
base.class_eval do
|
||||
has_one :event,
|
||||
dependent: :destroy,
|
||||
class_name: "DiscoursePostEvent::Event",
|
||||
foreign_key: :id
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
validate :valid_event
|
||||
end
|
||||
prepended do
|
||||
has_one :event, dependent: :destroy, class_name: "DiscoursePostEvent::Event", foreign_key: :id
|
||||
|
||||
validate :valid_event
|
||||
end
|
||||
|
||||
def valid_event
|
||||
|
|
|
@ -149,9 +149,9 @@ after_initialize do
|
|||
::ActionController::Base.prepend_view_path File.expand_path("../app/views", __FILE__)
|
||||
|
||||
reloadable_patch do
|
||||
ExportCsvController.class_eval { prepend DiscoursePostEvent::ExportCsvControllerExtension }
|
||||
Jobs::ExportCsvFile.class_eval { prepend DiscoursePostEvent::ExportPostEventCsvReportExtension }
|
||||
Post.class_eval { prepend DiscoursePostEvent::PostExtension }
|
||||
ExportCsvController.prepend(DiscoursePostEvent::ExportCsvControllerExtension)
|
||||
Jobs::ExportCsvFile.prepend(DiscoursePostEvent::ExportPostEventCsvReportExtension)
|
||||
Post.prepend(DiscoursePostEvent::PostExtension)
|
||||
end
|
||||
|
||||
add_to_class(:user, :can_create_discourse_post_event?) do
|
||||
|
|
|
@ -3,7 +3,7 @@ require "rails_helper"
|
|||
|
||||
describe DiscoursePostEvent::EventFinder do
|
||||
fab!(:current_user) { Fabricate(:user) }
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:user)
|
||||
|
||||
subject(:finder) { DiscoursePostEvent::EventFinder }
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ module DiscoursePostEvent
|
|||
end
|
||||
|
||||
context "when filtering by category" do
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
fab!(:category)
|
||||
fab!(:subcategory) do
|
||||
Fabricate(:category, parent_category: category, name: "category subcategory")
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe ListController do
|
||||
fab!(:admin) { Fabricate(:admin) }
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
fab!(:admin)
|
||||
fab!(:user)
|
||||
fab!(:category)
|
||||
fab!(:topic_1) do
|
||||
Fabricate(:topic, title: "This is the first topic", user: user, category: category)
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ describe DiscoursePostEvent::EventSerializer do
|
|||
SiteSetting.discourse_post_event_enabled = true
|
||||
end
|
||||
|
||||
fab!(:category) { Fabricate(:category) }
|
||||
fab!(:category)
|
||||
fab!(:topic) { Fabricate(:topic, category: category) }
|
||||
fab!(:post) { Fabricate(:post, topic: topic) }
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
describe UserSerializer do
|
||||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:user)
|
||||
|
||||
subject(:json) { described_class.new(user, scope: guardian).as_json }
|
||||
|
||||
|
|
Loading…
Reference in New Issue