bsw/jbe@0: local issue_id = assert(param.get("issue_id", atom.integer), "no issue id given") bsw/jbe@5: bsw/jbe@0: local interest = Interest:by_pk(issue_id, app.session.member.id) bsw/jbe@0: bsw@8: local issue = Issue:by_id(issue_id) bsw/jbe@5: bsw/jbe@5: if issue.closed then bsw/jbe@5: slot.put_into("error", _"This issue is already closed.") bsw/jbe@5: return false bsw/jbe@5: elseif issue.fully_frozen then bsw/jbe@5: slot.put_into("error", _"Voting for this issue has already begun.") bsw/jbe@5: return false bsw/jbe@5: end bsw/jbe@5: bsw/jbe@0: if param.get("delete", atom.boolean) then bsw/jbe@0: if interest then bsw/jbe@0: interest:destroy() bsw/jbe@0: slot.put_into("notice", _"Interest removed") bsw/jbe@0: else bsw/jbe@0: slot.put_into("notice", _"Interest not existant") bsw/jbe@0: end bsw/jbe@0: return bsw/jbe@0: end bsw/jbe@0: bsw/jbe@0: if not interest then bsw/jbe@0: interest = Interest:new() bsw/jbe@0: interest.issue_id = issue_id bsw/jbe@0: interest.member_id = app.session.member_id bsw/jbe@0: interest.autoreject = false bsw/jbe@0: end bsw/jbe@0: bsw/jbe@0: local autoreject = param.get("autoreject", atom.boolean) bsw/jbe@0: if autoreject ~= nil then bsw/jbe@0: interest.autoreject = autoreject bsw/jbe@0: end bsw/jbe@0: bsw/jbe@0: interest:save() bsw/jbe@0: bsw/jbe@0: slot.put_into("notice", _"Interest updated")