liquid_feedback_frontend
annotate app/main/admin/_action/cancel_issue.lua @ 1546:ae194d0235c2
Set session cookie only if session is needed
| author | bsw | 
|---|---|
| date | Thu Oct 22 11:57:23 2020 +0200 (2020-10-22) | 
| parents | 42edba78d946 | 
| children | 
| rev | line source | 
|---|---|
| bsw@1025 | 1 local issue = Issue | 
| bsw@1025 | 2 :new_selector() | 
| bsw@1025 | 3 :add_where{ "id = ?", param.get_id()} | 
| bsw@1025 | 4 :single_object_mode() | 
| bsw@1025 | 5 :for_update() | 
| bsw@1025 | 6 :exec() | 
| bsw@1025 | 7 | 
| bsw@1025 | 8 if issue.closed then | 
| bsw@1030 | 9 slot.put_into("error", _"This issue is already closed.") | 
| bsw@1025 | 10 return false | 
| bsw@1025 | 11 end | 
| bsw@1025 | 12 | 
| bsw@1025 | 13 issue.state = "canceled_by_admin" | 
| bsw@1025 | 14 issue.closed = "now" | 
| bsw@1025 | 15 | 
| bsw@1025 | 16 local admin_notice | 
| bsw@1025 | 17 if issue.admin_notice then | 
| bsw@1025 | 18 admin_notice = issue.admin_notice .. "\n\n" | 
| bsw@1025 | 19 else | 
| bsw@1025 | 20 admin_notice = "" | 
| bsw@1025 | 21 end | 
| bsw@1025 | 22 | 
| bsw@1025 | 23 admin_notice = admin_notice .. param.get("admin_notice") | 
| bsw@1025 | 24 | 
| bsw@1025 | 25 issue.admin_notice = admin_notice | 
| bsw@1025 | 26 | 
| bsw@1025 | 27 issue:save() | 
| bsw@1030 | 28 | 
| bsw@1030 | 29 slot.put_into("notice", _"Issue has been canceled") |