Actions
Defect #35100
closedMailHandler raises NameError exception when generating error message
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
Issue #31899 improved errors clarity but it's actually broken. Instead raising UnauthorizedAction its getting Uninitialized variable because project is not defined at lines:
source:trunk/app/models/mail_handler.rb#L230
source:trunk/app/models/mail_handler.rb#L279
Here the fix:
UTF-8
===================================================================
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
--- a/app/models/mail_handler.rb    (revision 8a2fa565e2bbe8667e6509755769343a7c69fcd3)
+++ b/app/models/mail_handler.rb    (date 1618469355034)
@@ -227,7 +227,7 @@
     unless handler_options[:no_permission_check]
       unless user.allowed_to?(:add_issue_notes, issue.project) ||
                user.allowed_to?(:edit_issues, issue.project)
-        raise UnauthorizedAction, "not allowed to add notes on issues to project [#{project.name}]" 
+        raise UnauthorizedAction, "not allowed to add notes on issues to project [#{issue.project.name}]" 
       end
     end
@@ -282,7 +282,7 @@
     end
     unless handler_options[:no_permission_check]
-      raise UnauthorizedAction, "not allowed to add messages to project [#{project.name}]" unless user.allowed_to?(:add_messages, message.project)
+      raise UnauthorizedAction, "not allowed to add messages to project [#{message.project.name}]" unless user.allowed_to?(:add_messages, message.project)
     end
     if !message.locked?
  Files
Actions