liquid_feedback_frontend
annotate app/main/initiative/_action/remove_support.lua @ 1566:7b7406a84346
Fixed layout of initiative admitted or revoked info
author | bsw |
---|---|
date | Tue Nov 10 21:14:35 2020 +0100 (2020-11-10) |
parents | 701a5cf6b067 |
children |
rev | line source |
---|---|
bsw/jbe@0 | 1 local initiative = Initiative:new_selector():add_where{ "id = ?", param.get_id()}:single_object_mode():exec() |
bsw/jbe@0 | 2 |
bsw/jbe@5 | 3 -- TODO important m1 selectors returning result _SET_! |
bsw/jbe@5 | 4 local issue = initiative:get_reference_selector("issue"):for_share():single_object_mode():exec() |
bsw/jbe@5 | 5 |
bsw/jbe@5 | 6 if issue.closed then |
bsw/jbe@5 | 7 slot.put_into("error", _"This issue is already closed.") |
bsw/jbe@5 | 8 return false |
bsw/jbe@5 | 9 elseif issue.fully_frozen then |
bsw/jbe@5 | 10 slot.put_into("error", _"Voting for this issue has already begun.") |
bsw/jbe@5 | 11 return false |
bsw@964 | 12 elseif |
bsw@964 | 13 (issue.half_frozen and issue.phase_finished) or |
bsw@964 | 14 (not issue.accepted and issue.phase_finished) |
bsw@964 | 15 then |
bsw@964 | 16 slot.put_into("error", _"Current phase is already closed.") |
bsw@964 | 17 return false |
bsw/jbe@5 | 18 end |
bsw/jbe@5 | 19 |
bsw/jbe@0 | 20 local member = app.session.member |
bsw/jbe@0 | 21 |
bsw/jbe@0 | 22 local supporter = Supporter:by_pk(initiative.id, member.id) |
bsw/jbe@0 | 23 |
bsw/jbe@0 | 24 if supporter then |
bsw/jbe@0 | 25 supporter:destroy() |
bsw/jbe@0 | 26 else |
bsw/jbe@0 | 27 end |