liquid_feedback_frontend
diff app/main/delegation/_action/update.lua @ 248:e3613831cd1e
Migrate global delegation to unit level
| author | bsw |
|---|---|
| date | Fri Dec 30 03:13:10 2011 +0100 (2011-12-30) |
| parents | 02aacb3dffe0 |
| children | fecd4c13054a |
line diff
1.1 --- a/app/main/delegation/_action/update.lua Fri Dec 30 03:11:57 2011 +0100 1.2 +++ b/app/main/delegation/_action/update.lua Fri Dec 30 03:13:10 2011 +0100 1.3 @@ -2,6 +2,8 @@ 1.4 1.5 local trustee_id = param.get("trustee_id", atom.integer) 1.6 1.7 +local unit_id = param.get("unit_id", atom.integer) 1.8 + 1.9 local area_id = param.get("area_id", atom.integer) 1.10 1.11 local issue_id = param.get("issue_id", atom.integer) 1.12 @@ -10,7 +12,7 @@ 1.13 area_id = nil 1.14 end 1.15 1.16 -local delegation = Delegation:by_pk(truster_id, area_id, issue_id) 1.17 +local delegation = Delegation:by_pk(truster_id, unit_id, area_id, issue_id) 1.18 1.19 if param.get("delete") or trustee_id == -1 then 1.20 1.21 @@ -23,7 +25,7 @@ 1.22 elseif area_id then 1.23 slot.put_into("notice", _"Your delegation for this area has been deleted.") 1.24 else 1.25 - slot.put_into("notice", _"Your global delegation has been deleted.") 1.26 + slot.put_into("notice", _"Your delegation for this unit has been deleted.") 1.27 end 1.28 1.29 end 1.30 @@ -33,14 +35,15 @@ 1.31 if not delegation then 1.32 delegation = Delegation:new() 1.33 delegation.truster_id = truster_id 1.34 + delegation.unit_id = unit_id 1.35 delegation.area_id = area_id 1.36 delegation.issue_id = issue_id 1.37 if issue_id then 1.38 delegation.scope = "issue" 1.39 elseif area_id then 1.40 delegation.scope = "area" 1.41 - else 1.42 - delegation.scope = "global" 1.43 + elseif unit_id then 1.44 + delegation.scope = "unit" 1.45 end 1.46 end 1.47 if trustee_id == 0 then 1.48 @@ -56,7 +59,7 @@ 1.49 elseif area_id then 1.50 slot.put_into("notice", _"Your delegation for this area has been updated.") 1.51 else 1.52 - slot.put_into("notice", _"Your global delegation has been updated.") 1.53 + slot.put_into("notice", _"Your delegation for this unit has been updated.") 1.54 end 1.55 1.56 end