Skip to content

Commit 95f9fc9

Browse files
committed
fix: using return in ERB templates leads to unpredictable behavior
- in this case, it led to the whole form not being rendered for users with only the 'add_notes' permission (but not edit issue). These users should still be able to add notes, though.
1 parent 5b85ae6 commit 95f9fc9

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

app/views/issues/form/_map.html.erb

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
<% return '' if @issue.nil? || @issue.project.nil? %>
2-
<% return '' unless User.current.allowed_to?(:view_issues, @issue.project) %>
3-
4-
<%
5-
if @issue.new_record?
6-
return '' unless User.current.allowed_to?(:add_issues, @issue.project)
7-
else
8-
return '' unless User.current.allowed_to?(:edit_issues, @issue.project)
9-
end
1+
<% if (@project.nil? or @project.module_enabled?(:gtt)) &&
2+
((@issue.new_record? && User.current.allowed_to?(:add_issues, @issue.project)) ||
3+
User.current.allowed_to?(:edit_issues, @issue.project))
104
%>
11-
12-
<% if @project.nil? or @project.module_enabled?(:gtt) %>
135
<div class="box">
146
<%= f.hidden_field(:geom, :value => @issue.geojson, :id => 'geom') %>
157

0 commit comments

Comments
 (0)