liquid_feedback_frontend
changeset 1235:7f818548b7b8
Added push grace period for verification phase to lf4rcs
author | bsw |
---|---|
date | Fri Dec 04 14:25:43 2015 +0100 (2015-12-04) |
parents | 8288027edb54 |
children | bc77849f922d |
files | config/example.lua env/lf4rcs/update_references.lua |
line diff
1.1 --- a/config/example.lua Fri Dec 04 14:19:28 2015 +0100 1.2 +++ b/config/example.lua Fri Dec 04 14:25:43 2015 +0100 1.3 @@ -360,6 +360,10 @@ 1.4 1.5 } 1.6 1.7 +-- Grace period after creating an initiative for pushing changes during verification phase 1.8 +-- disabled by default (nil), use PostgreSQL interval notation 1.9 +-- config.lf4rcs.push_grace_period = nil 1.10 + 1.11 lf4rcs.init() 1.12 --]] 1.13
2.1 --- a/env/lf4rcs/update_references.lua Fri Dec 04 14:19:28 2015 +0100 2.2 +++ b/env/lf4rcs/update_references.lua Fri Dec 04 14:25:43 2015 +0100 2.3 @@ -69,7 +69,23 @@ 2.4 abort("initiative belongs to another unit (unit ID " .. initiative.issue.area.unit_id .. ")") 2.5 end 2.6 if initiative.issue.state ~= "admission" and initiative.issue.state ~= "discussion" then 2.7 - abort("issue is already frozen or closed (" .. initiative.issue.state .. ")") 2.8 + if initiative.issue.state == "verification" then 2.9 + if config.lf4rcs.push_grace_period 2.10 + local in_push_grace_period = Initiative:new_selector() 2.11 + :reset_fields() 2.12 + :add_field({ "now() - initiative.created_at <= ?", config.lf4rcs.push_grace_period }, "in_push_grace_period") 2.13 + :add_where{ "id = ?", initiative.id } 2.14 + :single_object_mode() 2.15 + :exec()).in_push_grace_period 2.16 + if not in_push_period then 2.17 + abort("issue is already frozen and the push grace period is expired") 2.18 + end 2.19 + else 2.20 + abort("issue is already frozen") 2.21 + end 2.22 + else 2.23 + abort("issue is already closed (" .. initiative.issue.state .. ")") 2.24 + end 2.25 end 2.26 if initiative.revoked then 2.27 abort("initiative has been revoked")