mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 14:38:17 +08:00
DEV: Fix Lint/DuplicateMethods (#24746)
This commit is contained in:
parent
4280c01153
commit
138bf486d3
|
@ -18,8 +18,6 @@ class About
|
||||||
include ActiveModel::Serialization
|
include ActiveModel::Serialization
|
||||||
include StatsCacheable
|
include StatsCacheable
|
||||||
|
|
||||||
attr_accessor :moderators, :admins
|
|
||||||
|
|
||||||
def self.stats_cache_key
|
def self.stats_cache_key
|
||||||
"about-stats"
|
"about-stats"
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
class EmailStyle
|
class EmailStyle
|
||||||
include ActiveModel::Serialization
|
include ActiveModel::Serialization
|
||||||
|
|
||||||
attr_accessor :html, :css, :default_html, :default_css
|
|
||||||
|
|
||||||
def id
|
def id
|
||||||
"email-style"
|
"email-style"
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,8 +76,6 @@ class Report
|
||||||
:icon,
|
:icon,
|
||||||
:modes,
|
:modes,
|
||||||
:prev_data,
|
:prev_data,
|
||||||
:prev_start_date,
|
|
||||||
:prev_end_date,
|
|
||||||
:dates_filtering,
|
:dates_filtering,
|
||||||
:error,
|
:error,
|
||||||
:primary_color,
|
:primary_color,
|
||||||
|
|
|
@ -5,8 +5,6 @@ class SearchLog < ActiveRecord::Base
|
||||||
|
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
|
|
||||||
attr_reader :ctr
|
|
||||||
|
|
||||||
def ctr
|
def ctr
|
||||||
return 0 if click_through == 0 || searches == 0
|
return 0 if click_through == 0 || searches == 0
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class TagGroup < ActiveRecord::Base
|
||||||
|
|
||||||
after_commit { DiscourseTagging.clear_cache! }
|
after_commit { DiscourseTagging.clear_cache! }
|
||||||
|
|
||||||
attr_accessor :permissions
|
attr_reader :permissions
|
||||||
|
|
||||||
def tag_names=(tag_names_arg)
|
def tag_names=(tag_names_arg)
|
||||||
DiscourseTagging.add_or_create_tags_by_name(self, tag_names_arg, unlimited: true)
|
DiscourseTagging.add_or_create_tags_by_name(self, tag_names_arg, unlimited: true)
|
||||||
|
|
|
@ -40,7 +40,6 @@ class TopicList
|
||||||
:filter,
|
:filter,
|
||||||
:for_period,
|
:for_period,
|
||||||
:per_page,
|
:per_page,
|
||||||
:top_tags,
|
|
||||||
:current_user,
|
:current_user,
|
||||||
:tags,
|
:tags,
|
||||||
:shared_drafts,
|
:shared_drafts,
|
||||||
|
|
|
@ -26,33 +26,6 @@ class TrustLevel3Requirements
|
||||||
LOW_WATER_MARK = 0.9
|
LOW_WATER_MARK = 0.9
|
||||||
FORGIVENESS_PERIOD = 6.months
|
FORGIVENESS_PERIOD = 6.months
|
||||||
|
|
||||||
attr_accessor :days_visited,
|
|
||||||
:min_days_visited,
|
|
||||||
:num_topics_replied_to,
|
|
||||||
:min_topics_replied_to,
|
|
||||||
:topics_viewed,
|
|
||||||
:min_topics_viewed,
|
|
||||||
:posts_read,
|
|
||||||
:min_posts_read,
|
|
||||||
:topics_viewed_all_time,
|
|
||||||
:min_topics_viewed_all_time,
|
|
||||||
:posts_read_all_time,
|
|
||||||
:min_posts_read_all_time,
|
|
||||||
:num_flagged_posts,
|
|
||||||
:max_flagged_posts,
|
|
||||||
:num_likes_given,
|
|
||||||
:min_likes_given,
|
|
||||||
:num_likes_received,
|
|
||||||
:min_likes_received,
|
|
||||||
:num_likes_received,
|
|
||||||
:min_likes_received,
|
|
||||||
:num_likes_received_days,
|
|
||||||
:min_likes_received_days,
|
|
||||||
:num_likes_received_users,
|
|
||||||
:min_likes_received_users,
|
|
||||||
:trust_level_locked,
|
|
||||||
:on_grace_period
|
|
||||||
|
|
||||||
def initialize(user)
|
def initialize(user)
|
||||||
@user = user
|
@user = user
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class UserPostBookmarkSerializer < UserPostTopicBookmarkBaseSerializer
|
class UserPostBookmarkSerializer < UserPostTopicBookmarkBaseSerializer
|
||||||
attr_reader :post_id
|
|
||||||
|
|
||||||
def post_id
|
def post_id
|
||||||
post.id
|
post.id
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
# Helper functions for dealing with errors and objects that have
|
# Helper functions for dealing with errors and objects that have
|
||||||
# child objects with errors
|
# child objects with errors
|
||||||
module HasErrors
|
module HasErrors
|
||||||
attr_reader :errors
|
|
||||||
attr_accessor :forbidden, :not_found, :conflict
|
attr_accessor :forbidden, :not_found, :conflict
|
||||||
|
|
||||||
def errors
|
def errors
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
module ImportExport
|
module ImportExport
|
||||||
class BaseExporter
|
class BaseExporter
|
||||||
attr_reader :export_data, :categories
|
attr_reader :export_data
|
||||||
|
|
||||||
CATEGORY_ATTRS = %i[
|
CATEGORY_ATTRS = %i[
|
||||||
id
|
id
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
module Chat
|
module Chat
|
||||||
class UserMessageBookmarkSerializer < UserBookmarkBaseSerializer
|
class UserMessageBookmarkSerializer < UserBookmarkBaseSerializer
|
||||||
attr_reader :chat_message
|
|
||||||
|
|
||||||
def title
|
def title
|
||||||
fancy_title
|
fancy_title
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,10 +16,6 @@ module PageObjects
|
||||||
page.find(context)
|
page.find(context)
|
||||||
end
|
end
|
||||||
|
|
||||||
def flag(message)
|
|
||||||
find(message).secondary_action("flag")
|
|
||||||
end
|
|
||||||
|
|
||||||
def copy_link(message)
|
def copy_link(message)
|
||||||
find(message).secondary_action("copyLink")
|
find(message).secondary_action("copyLink")
|
||||||
end
|
end
|
||||||
|
|
|
@ -43,10 +43,6 @@ module PageObjects
|
||||||
".chat-thread-list-item__last-reply-timestamp .relative-date[data-time='#{(last_reply.created_at.iso8601.to_time.to_f * 1000).to_i}']"
|
".chat-thread-list-item__last-reply-timestamp .relative-date[data-time='#{(last_reply.created_at.iso8601.to_time.to_f * 1000).to_i}']"
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_no_unread_item?(id)
|
|
||||||
component.has_no_css?(item_by_id_selector(id) + ".-is-unread")
|
|
||||||
end
|
|
||||||
|
|
||||||
def has_unread_item?(id, count: nil)
|
def has_unread_item?(id, count: nil)
|
||||||
if count.nil?
|
if count.nil?
|
||||||
component.has_css?(item_by_id_selector(id) + ".-is-unread")
|
component.has_css?(item_by_id_selector(id) + ".-is-unread")
|
||||||
|
|
|
@ -14,10 +14,6 @@ module PageObjects
|
||||||
find(PUBLIC_CHANNELS_SECTION_SELECTOR)
|
find(PUBLIC_CHANNELS_SECTION_SELECTOR)
|
||||||
end
|
end
|
||||||
|
|
||||||
def channels_section
|
|
||||||
find(PUBLIC_CHANNELS_SECTION_SELECTOR)
|
|
||||||
end
|
|
||||||
|
|
||||||
def dms_section
|
def dms_section
|
||||||
find(DM_CHANNELS_SECTION_SELECTOR)
|
find(DM_CHANNELS_SECTION_SELECTOR)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class FakeLogger
|
class FakeLogger
|
||||||
attr_reader :debug, :infos, :warnings, :errors, :fatals
|
attr_reader :debugs, :infos, :warnings, :errors, :fatals
|
||||||
attr_accessor :level
|
attr_accessor :level
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@debug = []
|
@debugs = []
|
||||||
@infos = []
|
@infos = []
|
||||||
@warnings = []
|
@warnings = []
|
||||||
@errors = []
|
@errors = []
|
||||||
|
@ -14,7 +14,7 @@ class FakeLogger
|
||||||
end
|
end
|
||||||
|
|
||||||
def debug(message)
|
def debug(message)
|
||||||
@debug << message
|
@debugs << message
|
||||||
end
|
end
|
||||||
|
|
||||||
def debug?
|
def debug?
|
||||||
|
|
|
@ -39,12 +39,6 @@ module PageObjects
|
||||||
expect(categories.map(&:text)).to eq(category_names)
|
expect(categories.map(&:text)).to eq(category_names)
|
||||||
end
|
end
|
||||||
|
|
||||||
def has_checkbox?(category, disabled: false)
|
|
||||||
has_selector?(
|
|
||||||
".sidebar-categories-form .sidebar-categories-form__category-row[data-category-id='#{category.id}'] .sidebar-categories-form__input#{disabled ? "[disabled]" : ""}",
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def toggle_category_checkbox(category)
|
def toggle_category_checkbox(category)
|
||||||
find(
|
find(
|
||||||
".sidebar-categories-form .sidebar-categories-form__category-row[data-category-id='#{category.id}'] .sidebar-categories-form__input",
|
".sidebar-categories-form .sidebar-categories-form__category-row[data-category-id='#{category.id}'] .sidebar-categories-form__input",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user