liquid_feedback_frontend
diff app/main/initiative/_action/create.lua @ 898:ae9ab3edff89
Added polling support
author | bsw |
---|---|
date | Mon Aug 20 03:54:20 2012 +0200 (2012-08-20) |
parents | 75ce92899049 |
children | f3d6d08b0125 |
line diff
1.1 --- a/app/main/initiative/_action/create.lua Mon Aug 20 03:53:55 2012 +0200 1.2 +++ b/app/main/initiative/_action/create.lua Mon Aug 20 03:54:20 2012 +0200 1.3 @@ -76,6 +76,10 @@ 1.4 slot.put_into("error", "Invalid policy.") 1.5 return false 1.6 end 1.7 + if policy.polling and not app.session.member:has_polling_right_for_unit_id(area.unit_id) then 1.8 + error("no polling right for this unit") 1.9 + end 1.10 + 1.11 if not area:get_reference_selector("allowed_policies") 1.12 :add_where{ "policy.id = ?", policy_id } 1.13 :optional_object_mode() 1.14 @@ -86,6 +90,13 @@ 1.15 issue = Issue:new() 1.16 issue.area_id = area.id 1.17 issue.policy_id = policy_id 1.18 + 1.19 + if policy.polling then 1.20 + issue.accepted = 'now' 1.21 + issue.state = 'discussion' 1.22 + initiative.polling = true 1.23 + end 1.24 + 1.25 issue:save() 1.26 1.27 if config.etherpad then 1.28 @@ -99,6 +110,9 @@ 1.29 end 1.30 end 1.31 1.32 +if param.get("polling", atom.boolean) and app.session.member:has_polling_right_for_unit_id(area.unit_id) then 1.33 + initiative.polling = true 1.34 +end 1.35 initiative.issue_id = issue.id 1.36 initiative.name = name 1.37 param.update(initiative, "discussion_url")