liquid_feedback_frontend

view app/main/interest/_action/update.lua @ 281:b77e6a17ca77

Check unit voting right where neccessary, hide action buttons for units without voting right
author bsw
date Thu Feb 16 15:01:49 2012 +0100 (2012-02-16)
parents bde068b37608
children 1997cf1da04b
line source
1 local issue_id = assert(param.get("issue_id", atom.integer), "no issue id given")
3 local interest = Interest:by_pk(issue_id, app.session.member.id)
5 local issue = Issue:new_selector():add_where{ "id = ?", issue_id }:for_share():single_object_mode():exec()
7 if issue.closed then
8 slot.put_into("error", _"This issue is already closed.")
9 return false
10 elseif issue.fully_frozen then
11 slot.put_into("error", _"Voting for this issue has already begun.")
12 return false
13 end
15 if param.get("delete", atom.boolean) then
16 if interest then
17 interest:destroy()
18 --slot.put_into("notice", _"Interest removed")
19 else
20 --slot.put_into("notice", _"Interest not existent")
21 end
22 return
23 end
25 if not app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then
26 error("access denied")
27 end
29 if not interest then
30 interest = Interest:new()
31 interest.issue_id = issue_id
32 interest.member_id = app.session.member_id
33 end
35 interest:save()
37 --slot.put_into("notice", _"Interest updated")

Impressum / About Us