瀏覽代碼

Safe navigation

Maarten van den Berg 6 年之前
父節點
當前提交
a64bbed723
共有 2 個文件被更改,包括 1 次插入8 次删除
  1. 0 7
      .rubocop.yml
  2. 1 1
      app/controllers/api_controller.rb

+ 0 - 7
.rubocop.yml

@@ -10,13 +10,6 @@ AllCops:
10 10
   Exclude:
11 11
     - 'db/schema.rb'
12 12
 
13
-# Offense count: 1
14
-# Configuration parameters: Whitelist.
15
-# Whitelist: present?, blank?, presence, try, try!
16
-Lint/SafeNavigationChain:
17
-  Exclude:
18
-    - 'app/controllers/api_controller.rb'
19
-
20 13
 # Offense count: 30
21 14
 Metrics/AbcSize:
22 15
   Max: 71

+ 1 - 1
app/controllers/api_controller.rb

@@ -36,7 +36,7 @@ class ApiController < ActionController::Base
36 36
 
37 37
   # Require user to be a member of group OR admin, requires @group set
38 38
   def require_membership!
39
-    return if current_person&.groups.include?(@group) || current_person&.is_admin?
39
+    return if current_person&.groups&.include?(@group) || current_person&.is_admin?
40 40
 
41 41
     @message = I18n.t('authentication.membership_required')
42 42
     render 'api/error', status: :forbidden