# HG changeset patch # User bsw # Date 1361471568 -3600 # Node ID 1997cf1da04bdd171fa1026c07d441911ffe7b75 # Parent 03b0ac783fe0b799f44de969ddda0cf5599ac690 Added support for finished phases diff -r 03b0ac783fe0 -r 1997cf1da04b app/main/draft/_action/add.lua --- a/app/main/draft/_action/add.lua Thu Feb 21 18:56:59 2013 +0100 +++ b/app/main/draft/_action/add.lua Thu Feb 21 19:32:48 2013 +0100 @@ -9,6 +9,9 @@ elseif issue.half_frozen then slot.put_into("error", _"This issue is already frozen.") return false +elseif issue.phase_finished then + slot.put_into("error", _"Current phase is already closed.") + return false end local initiator = Initiator:by_pk(initiative.id, app.session.member.id) diff -r 03b0ac783fe0 -r 1997cf1da04b app/main/initiative/_action/add_support.lua --- a/app/main/initiative/_action/add_support.lua Thu Feb 21 18:56:59 2013 +0100 +++ b/app/main/initiative/_action/add_support.lua Thu Feb 21 19:32:48 2013 +0100 @@ -11,9 +11,15 @@ if issue.closed then slot.put_into("error", _"This issue is already closed.") return false -elseif issue.fully_frozen then +elseif issue.fully_frozen then slot.put_into("error", _"Voting for this issue has already begun.") return false +elseif + (issue.half_frozen and issue.phase_finished) or + (not issue.accepted and issue.phase_finished) +then + slot.put_into("error", _"Current phase is already closed.") + return false end if initiative.revoked then diff -r 03b0ac783fe0 -r 1997cf1da04b app/main/initiative/_action/remove_support.lua --- a/app/main/initiative/_action/remove_support.lua Thu Feb 21 18:56:59 2013 +0100 +++ b/app/main/initiative/_action/remove_support.lua Thu Feb 21 19:32:48 2013 +0100 @@ -9,6 +9,12 @@ elseif issue.fully_frozen then slot.put_into("error", _"Voting for this issue has already begun.") return false +elseif + (issue.half_frozen and issue.phase_finished) or + (not issue.accepted and issue.phase_finished) +then + slot.put_into("error", _"Current phase is already closed.") + return false end local member = app.session.member diff -r 03b0ac783fe0 -r 1997cf1da04b app/main/initiative/_action/revoke.lua --- a/app/main/initiative/_action/revoke.lua Thu Feb 21 18:56:59 2013 +0100 +++ b/app/main/initiative/_action/revoke.lua Thu Feb 21 19:32:48 2013 +0100 @@ -14,6 +14,9 @@ elseif issue.half_frozen then slot.put_into("error", _"This issue is already frozen.") return false +elseif not issue.accepted and issue.phase_finished then + slot.put_into("error", _"Current phase is already closed.") + return false end if initiative.revoked then diff -r 03b0ac783fe0 -r 1997cf1da04b app/main/interest/_action/update.lua --- a/app/main/interest/_action/update.lua Thu Feb 21 18:56:59 2013 +0100 +++ b/app/main/interest/_action/update.lua Thu Feb 21 19:32:48 2013 +0100 @@ -10,6 +10,14 @@ elseif issue.fully_frozen then slot.put_into("error", _"Voting for this issue has already begun.") return false +elseif + (issue.half_frozen and issue.phase_finished) or + (not issue.accepted and issue.phase_finished) +then + slot.put_into("error", _"Current phase is already closed.") + return false +end + end if param.get("delete", atom.boolean) then diff -r 03b0ac783fe0 -r 1997cf1da04b app/main/opinion/_action/update.lua --- a/app/main/opinion/_action/update.lua Thu Feb 21 18:56:59 2013 +0100 +++ b/app/main/opinion/_action/update.lua Thu Feb 21 19:32:48 2013 +0100 @@ -20,6 +20,12 @@ elseif issue.fully_frozen then slot.put_into("error", _"Voting for this issue has already begun.") return false +elseif + (issue.half_frozen and issue.phase_finished) or + (not issue.accepted and issue.phase_finished) +then + slot.put_into("error", _"Current phase is already closed.") + return false end if param.get("delete") then diff -r 03b0ac783fe0 -r 1997cf1da04b app/main/suggestion/_action/add.lua --- a/app/main/suggestion/_action/add.lua Thu Feb 21 18:56:59 2013 +0100 +++ b/app/main/suggestion/_action/add.lua Thu Feb 21 19:32:48 2013 +0100 @@ -51,6 +51,12 @@ elseif issue.half_frozen then slot.put_into("error", _"This issue is already frozen.") return false +elseif + (issue.half_frozen and issue.phase_finished) or + (not issue.accepted and issue.phase_finished) +then + slot.put_into("error", _"Current phase is already closed.") + return false end local opinion = Opinion:new() diff -r 03b0ac783fe0 -r 1997cf1da04b app/main/vote/_action/non_voter.lua --- a/app/main/vote/_action/non_voter.lua Thu Feb 21 18:56:59 2013 +0100 +++ b/app/main/vote/_action/non_voter.lua Thu Feb 21 19:32:48 2013 +0100 @@ -1,12 +1,12 @@ local issue = Issue:new_selector():add_where{ "id = ?", param.get("issue_id", atom.integer) }:for_share():single_object_mode():exec() -if issue.closed then - slot.put_into("error", _"This issue is already closed.") +if issue.state ~= "voting" and not issue.closed then + slot.put_into("error", _"Voting has not started yet.") return false end -if issue.state ~= "voting" then - slot.put_into("error", _"Voting has not started yet.") +if issue.phase_finished or issue.closed then + slot.put_into("error", _"This issue is already closed.") return false end diff -r 03b0ac783fe0 -r 1997cf1da04b app/main/vote/_action/update.lua --- a/app/main/vote/_action/update.lua Thu Feb 21 18:56:59 2013 +0100 +++ b/app/main/vote/_action/update.lua Thu Feb 21 19:32:48 2013 +0100 @@ -11,13 +11,13 @@ local update_comment = param.get("update_comment") == "1" and true or false -if issue.closed and not update_comment then - slot.put_into("error", _"This issue is already closed.") +if issue.state ~= "voting" and not issue.closed then + slot.put_into("error", _"Voting has not started yet.") return false end -if issue.state ~= "voting" and not issue.closed then - slot.put_into("error", _"Voting has not started yet.") +if issue.phase_finished or issue.closed and not update_comment then + slot.put_into("error", _"This issue is already closed.") return false end