diff options
Diffstat (limited to 'app/models/concerns')
-rw-r--r-- | app/models/concerns/issuable.rb | 6 | ||||
-rw-r--r-- | app/models/concerns/mentionable.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/milestoneish.rb | 4 | ||||
-rw-r--r-- | app/models/concerns/presentable.rb | 6 | ||||
-rw-r--r-- | app/models/concerns/routable.rb | 8 | ||||
-rw-r--r-- | app/models/concerns/sortable.rb | 12 | ||||
-rw-r--r-- | app/models/concerns/subscribable.rb | 26 |
7 files changed, 33 insertions, 33 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb index 768baa80c01..303d4910ee1 100644 --- a/app/models/concerns/issuable.rb +++ b/app/models/concerns/issuable.rb @@ -162,9 +162,9 @@ module Issuable highest_priority = highest_label_priority(params).to_sql - select("#{table_name}.*, (#{highest_priority}) AS highest_priority"). - group(arel_table[:id]). - reorder(Gitlab::Database.nulls_last_order('highest_priority', 'ASC')) + select("#{table_name}.*, (#{highest_priority}) AS highest_priority") + .group(arel_table[:id]) + .reorder(Gitlab::Database.nulls_last_order('highest_priority', 'ASC')) end def with_label(title, sort = nil) diff --git a/app/models/concerns/mentionable.rb b/app/models/concerns/mentionable.rb index 7e56e371b27..a8ce36e51fc 100644 --- a/app/models/concerns/mentionable.rb +++ b/app/models/concerns/mentionable.rb @@ -48,8 +48,8 @@ module Mentionable if extractor @extractor = extractor else - @extractor ||= Gitlab::ReferenceExtractor. - new(project, current_user) + @extractor ||= Gitlab::ReferenceExtractor + .new(project, current_user) @extractor.reset_memoized_values end diff --git a/app/models/concerns/milestoneish.rb b/app/models/concerns/milestoneish.rb index 870a6fbaa90..f449229864d 100644 --- a/app/models/concerns/milestoneish.rb +++ b/app/models/concerns/milestoneish.rb @@ -39,8 +39,8 @@ module Milestoneish def issues_visible_to_user(user) memoize_per_user(user, :issues_visible_to_user) do - IssuesFinder.new(user, issues_finder_params). - execute.where(milestone_id: milestoneish_ids) + IssuesFinder.new(user, issues_finder_params) + .execute.where(milestone_id: milestoneish_ids) end end diff --git a/app/models/concerns/presentable.rb b/app/models/concerns/presentable.rb index d0f84831d71..7b33b837004 100644 --- a/app/models/concerns/presentable.rb +++ b/app/models/concerns/presentable.rb @@ -1,7 +1,7 @@ module Presentable def present(**attributes) - Gitlab::View::Presenter::Factory. - new(self, attributes). - fabricate! + Gitlab::View::Presenter::Factory + .new(self, attributes) + .fabricate! end end diff --git a/app/models/concerns/routable.rb b/app/models/concerns/routable.rb index 9f6d215ceb3..c2373de32c5 100644 --- a/app/models/concerns/routable.rb +++ b/app/models/concerns/routable.rb @@ -75,11 +75,11 @@ module Routable # # Returns an ActiveRecord::Relation. def member_descendants(user_id) - joins(:route). - joins("INNER JOIN routes r2 ON routes.path LIKE CONCAT(r2.path, '/%') + joins(:route) + .joins("INNER JOIN routes r2 ON routes.path LIKE CONCAT(r2.path, '/%') INNER JOIN members ON members.source_id = r2.source_id - AND members.source_type = r2.source_type"). - where('members.user_id = ?', user_id) + AND members.source_type = r2.source_type") + .where('members.user_id = ?', user_id) end end diff --git a/app/models/concerns/sortable.rb b/app/models/concerns/sortable.rb index b9a2d812edd..a155a064032 100644 --- a/app/models/concerns/sortable.rb +++ b/app/models/concerns/sortable.rb @@ -39,12 +39,12 @@ module Sortable private def highest_label_priority(target_type_column: nil, target_type: nil, target_column:, project_column:, excluded_labels: []) - query = Label.select(LabelPriority.arel_table[:priority].minimum). - left_join_priorities. - joins(:label_links). - where("label_priorities.project_id = #{project_column}"). - where("label_links.target_id = #{target_column}"). - reorder(nil) + query = Label.select(LabelPriority.arel_table[:priority].minimum) + .left_join_priorities + .joins(:label_links) + .where("label_priorities.project_id = #{project_column}") + .where("label_links.target_id = #{target_column}") + .reorder(nil) query = if target_type_column diff --git a/app/models/concerns/subscribable.rb b/app/models/concerns/subscribable.rb index e4f5818d0e3..f60a0f8f438 100644 --- a/app/models/concerns/subscribable.rb +++ b/app/models/concerns/subscribable.rb @@ -27,30 +27,30 @@ module Subscribable end def subscribers(project) - subscriptions_available(project). - where(subscribed: true). - map(&:user) + subscriptions_available(project) + .where(subscribed: true) + .map(&:user) end def toggle_subscription(user, project = nil) unsubscribe_from_other_levels(user, project) - find_or_initialize_subscription(user, project). - update(subscribed: !subscribed?(user, project)) + find_or_initialize_subscription(user, project) + .update(subscribed: !subscribed?(user, project)) end def subscribe(user, project = nil) unsubscribe_from_other_levels(user, project) - find_or_initialize_subscription(user, project). - update(subscribed: true) + find_or_initialize_subscription(user, project) + .update(subscribed: true) end def unsubscribe(user, project = nil) unsubscribe_from_other_levels(user, project) - find_or_initialize_subscription(user, project). - update(subscribed: false) + find_or_initialize_subscription(user, project) + .update(subscribed: false) end private @@ -69,14 +69,14 @@ module Subscribable end def find_or_initialize_subscription(user, project) - subscriptions. - find_or_initialize_by(user_id: user.id, project_id: project.try(:id)) + subscriptions + .find_or_initialize_by(user_id: user.id, project_id: project.try(:id)) end def subscriptions_available(project) t = Subscription.arel_table - subscriptions. - where(t[:project_id].eq(nil).or(t[:project_id].eq(project.try(:id)))) + subscriptions + .where(t[:project_id].eq(nil).or(t[:project_id].eq(project.try(:id)))) end end |