# HG changeset patch # User bsw # Date 1612650893 -3600 # Node ID 22398d33750756074ee05d25ed161b0318991811 # Parent 72442abafb3ca9949e91e0c463b0b67ad210a07e Show delegation info only when voting or initiative privilege is given diff -r 72442abafb3c -r 22398d337507 app/main/index/_head.lua --- a/app/main/index/_head.lua Sat Feb 06 23:30:20 2021 +0100 +++ b/app/main/index/_head.lua Sat Feb 06 23:34:53 2021 +0100 @@ -37,7 +37,10 @@ end } - if not (config.voting_only and config.disable_delegations) and app.session.member_id then + if not (config.voting_only and config.disable_delegations) and app.session.member_id and ( + app.session.member:has_voting_right_for_unit_id(unit.id) + or app.session.member:has_initiative_right_for_unit_id(unit.id) + ) then ui.container{ attr = { class = "mdl-card__actions" }, content = function() unit:load_delegation_info_once_for_member_id(app.session.member_id) @@ -82,7 +85,10 @@ end end } end - if not (config.voting_only and config.disable_delegations) and app.session.member_id then + if not (config.voting_only and config.disable_delegations) and app.session.member_id and ( + app.session.member:has_voting_right_for_unit_id(area.unit_id) + or app.session.member:has_initiative_right_for_unit_id(area.unit_id) + ) then ui.container{ attr = { class = "mdl-card__actions" }, content = function() area:load_delegation_info_once_for_member_id(app.session.member_id) @@ -90,14 +96,18 @@ local text if area.delegation_info.own_delegation_scope == "area" then local member = Member:by_id(area.delegation_info.first_trustee_id) - ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" } - execute.view{ - module = "member", - view = "_show_thumb", - params = { - member = member + if member then + ui.tag{ tag = "i", attr = { class = "material-icons" }, content = "forward" } + execute.view{ + module = "member", + view = "_show_thumb", + params = { + member = member + } } - } + else + ui.tag{ content = _"Delegation abandoned" } + end text = _"change delegation..." else text = _"delegate..."