liquid_feedback_frontend
diff app/main/interest/_action/update.lua @ 1045:701a5cf6b067
Imported LiquidFeedback Frontend 3.0 branch
| author | bsw |
|---|---|
| date | Thu Jul 10 01:19:48 2014 +0200 (2014-07-10) |
| parents | 072fa7a9e0fc |
| children | 32cc544d5a5b |
line diff
1.1 --- a/app/main/interest/_action/update.lua Thu Jul 10 01:02:43 2014 +0200 1.2 +++ b/app/main/interest/_action/update.lua Thu Jul 10 01:19:48 2014 +0200 1.3 @@ -4,6 +4,10 @@ 1.4 1.5 local issue = Issue:new_selector():add_where{ "id = ?", issue_id }:for_share():single_object_mode():exec() 1.6 1.7 +if not app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then 1.8 + error("access denied") 1.9 +end 1.10 + 1.11 if issue.closed then 1.12 slot.put_into("error", _"This issue is already closed.") 1.13 return false 1.14 @@ -21,23 +25,17 @@ 1.15 if param.get("delete", atom.boolean) then 1.16 if interest then 1.17 interest:destroy() 1.18 - --slot.put_into("notice", _"Interest removed") 1.19 + slot.put_into("notice", _"Interest removed") 1.20 else 1.21 - --slot.put_into("notice", _"Interest not existent") 1.22 + slot.put_into("notice", _"Interest already removed") 1.23 end 1.24 return 1.25 end 1.26 1.27 -if not app.session.member:has_voting_right_for_unit_id(issue.area.unit_id) then 1.28 - error("access denied") 1.29 -end 1.30 - 1.31 if not interest then 1.32 interest = Interest:new() 1.33 interest.issue_id = issue_id 1.34 interest.member_id = app.session.member_id 1.35 + interest:save() 1.36 + slot.put_into("notice", _"Interest updated") 1.37 end 1.38 - 1.39 -interest:save() 1.40 - 1.41 ---slot.put_into("notice", _"Interest updated")