]> source.dussan.org Git - redmine.git/commitdiff
code cleanup: rubocop: fix Layout/ElseAlignment in app/models/issue_query.rb
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 17 Oct 2019 15:28:23 +0000 (15:28 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 17 Oct 2019 15:28:23 +0000 (15:28 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@18711 e93f8b46-1217-0410-a6f0-8f06a7374b81

.rubocop_todo.yml
app/models/issue_query.rb

index cd832171cf6faffddd6baee964b10020d2b20382..08335ab49c4fec0d45a7640249d9b0bd86775d34 100644 (file)
@@ -107,7 +107,6 @@ Layout/ElseAlignment:
   Exclude:
     - 'app/helpers/attachments_helper.rb'
     - 'app/helpers/queries_helper.rb'
-    - 'app/models/issue_query.rb'
 
 # Cop supports --auto-correct.
 Layout/EmptyLineAfterGuardClause:
index 155462c64cb967247bf1188b4a8f2c2513e6766f..db3f38a13e94c3c69d74a4f11eb70a63a1face73 100644 (file)
@@ -434,25 +434,24 @@ class IssueQuery < Query
 
   def sql_for_watcher_id_field(field, operator, value)
     db_table = Watcher.table_name
-
     me, others = value.partition { |id| ['0', User.current.id.to_s].include?(id) }
-    sql = if others.any?
-      "SELECT #{Issue.table_name}.id FROM #{Issue.table_name} " +
-      "INNER JOIN #{db_table} ON #{Issue.table_name}.id = #{db_table}.watchable_id AND #{db_table}.watchable_type = 'Issue' " +
-      "LEFT OUTER JOIN #{Project.table_name} ON #{Project.table_name}.id = #{Issue.table_name}.project_id " +
-      "WHERE (" +
-        sql_for_field(field, '=', me, db_table, 'user_id') +
-      ') OR (' +
-        Project.allowed_to_condition(User.current, :view_issue_watchers) +
-        ' AND ' +
-        sql_for_field(field, '=', others, db_table, 'user_id') +
-      ')'
-    else
-      "SELECT #{db_table}.watchable_id FROM #{db_table} " +
-      "WHERE #{db_table}.watchable_type='Issue' AND " +
-      sql_for_field(field, '=', me, db_table, 'user_id')
-    end
-
+    sql =
+      if others.any?
+        "SELECT #{Issue.table_name}.id FROM #{Issue.table_name} " +
+        "INNER JOIN #{db_table} ON #{Issue.table_name}.id = #{db_table}.watchable_id AND #{db_table}.watchable_type = 'Issue' " +
+        "LEFT OUTER JOIN #{Project.table_name} ON #{Project.table_name}.id = #{Issue.table_name}.project_id " +
+        "WHERE (" +
+          sql_for_field(field, '=', me, db_table, 'user_id') +
+        ') OR (' +
+          Project.allowed_to_condition(User.current, :view_issue_watchers) +
+          ' AND ' +
+          sql_for_field(field, '=', others, db_table, 'user_id') +
+        ')'
+      else
+        "SELECT #{db_table}.watchable_id FROM #{db_table} " +
+        "WHERE #{db_table}.watchable_type='Issue' AND " +
+        sql_for_field(field, '=', me, db_table, 'user_id')
+      end
     "#{Issue.table_name}.id #{ operator == '=' ? 'IN' : 'NOT IN' } (#{sql})"
   end