liquid_feedback_frontend
diff app/main/interest/_action/update.lua @ 0:3bfb2fcf7ab9
Version alpha1
author | bsw/jbe |
---|---|
date | Wed Nov 18 12:00:00 2009 +0100 (2009-11-18) |
parents | |
children | afd9f769c7ae |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/interest/_action/update.lua Wed Nov 18 12:00:00 2009 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 +local issue_id = assert(param.get("issue_id", atom.integer), "no issue id given") 1.5 +local interest = Interest:by_pk(issue_id, app.session.member.id) 1.6 + 1.7 +if param.get("delete", atom.boolean) then 1.8 + if interest then 1.9 + interest:destroy() 1.10 + slot.put_into("notice", _"Interest removed") 1.11 + else 1.12 + slot.put_into("notice", _"Interest not existant") 1.13 + end 1.14 + return 1.15 +end 1.16 + 1.17 +if not interest then 1.18 + interest = Interest:new() 1.19 + interest.issue_id = issue_id 1.20 + interest.member_id = app.session.member_id 1.21 + interest.autoreject = false 1.22 +end 1.23 + 1.24 +local autoreject = param.get("autoreject", atom.boolean) 1.25 +if autoreject ~= nil then 1.26 + interest.autoreject = autoreject 1.27 +end 1.28 + 1.29 +interest:save() 1.30 + 1.31 +slot.put_into("notice", _"Interest updated")