Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly show trustees and votings menu #9192

Merged
merged 4 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ def permissions
return permission_action unless user
return user_allowed_to_read_admin_dashboard? if read_admin_dashboard_action?
return permission_action unless permission_action.scope == :admin

user_can_enter_space_area?

return permission_action if voting && !voting.is_a?(Decidim::Votings::Voting)

unless user_can_read_votings_admin_dashboard?
disallow!
return permission_action
end

user_can_enter_space_area?
allowed_read_participatory_space?
allowed_voting_action?

Expand Down
5 changes: 4 additions & 1 deletion decidim-elections/lib/decidim/elections/admin_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ def self.participatory_space_endpoints
next unless component

link = Decidim::EngineRouter.admin_proxy(component).trustees_path(locale: I18n.locale)

has_election_components = current_participatory_space.components.select { |c| c.manifest_name == "elections" }.any?

menu.add_item :trustees,
I18n.t("trustees", scope: "decidim.elections.admin.menu"),
link,
if: has_election_components && (allowed_to?(:manage, :trustees) || current_user.admin?),
position: 100,
if: allowed_to?(:manage, :trustees),
active: is_active_link?(link)
end
end
Expand Down