fixed more places where NULL category could cause problems when editing issues as admin

This commit is contained in:
Absurdon 2017-07-03 08:50:00 +02:00
parent 784c5832cf
commit f31668fb44
2 changed files with 4 additions and 3 deletions

View file

@ -13,7 +13,8 @@ class IssuesController < ApplicationController
end
allowed = Issue::allowed_categories cuser
qstring = "category_id IN (?) OR category_id IS NULL"
qstring = 'category_id IN (?)'
qstring += ' OR category_id IS NULL' if cuser.admin?
@open = Issue.where(qstring, allowed).with_status(Issue::STATUS_OPEN).all order: sort
@solved = Issue.where(qstring, allowed).with_status(Issue::STATUS_SOLVED).all order: sort

View file

@ -4,7 +4,7 @@
<%= f.label :title %>
<%= f.text_field :title %>
</div>
<% if cuser and Issue::allowed_categories(cuser).include?(@issue.category_id) %>
<% if cuser and (cuser.admin? or Issue::allowed_categories(cuser).include?(@issue.category_id)) %>
<div class="fields horizontal">
<%= f.label :status %>
<%= f.select :status, @issue.statuses.invert %>
@ -22,7 +22,7 @@
<%= f.label :text %>
<%= f.text_area :text, rows: 7 %>
</div>
<% if cuser and Issue::allowed_categories(cuser).include?(@issue.category_id) %>
<% if cuser and (cuser.admin? or Issue::allowed_categories(cuser).include?(@issue.category_id)) %>
<div class="fields horizontal">
<%= f.label :solution %>
<%= f.text_area :solution, rows: 7 %>