Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove alert when the user cannot manage lists

Klaus Zanders88c6f83ae961
diff --git a/app/components/shares/invite_user_form_component.html.erb b/app/components/shares/invite_user_form_component.html.erb
index 6cfe10cc506..94f43792589 100644
--- a/app/components/shares/invite_user_form_component.html.erb
+++ b/app/components/shares/invite_user_form_component.html.erb
@@ -93,8 +93,6 @@
end
end
end
- else
- render(Primer::Alpha::Banner.new(icon: :info)) { I18n.t('sharing.denied', entities: entity.model_name.human(count: 2)) }
end
end
%>
diff --git a/app/components/shares/project_queries/public_flag_component.html.erb b/app/components/shares/project_queries/public_flag_component.html.erb
index aec171db24e..d166d2999bc 100644
--- a/app/components/shares/project_queries/public_flag_component.html.erb
+++ b/app/components/shares/project_queries/public_flag_component.html.erb
@@ -1,14 +1,16 @@
<%=
container.with_row do
- render(Primer::Forms::ToggleSwitchForm.new(
- name: "publish_project_query",
- label: t('sharing.project_queries.public_flag.label', instance_name: Setting.app_title),
- caption: t('sharing.project_queries.public_flag.caption'),
- src: toggle_public_flag_link,
- csrf_token: form_authenticity_token,
- status_label_position: :start,
- checked: published?,
- enabled: can_publish?
- ))
+ content_tag(:div, class: wrapper_classes, data: { tooltip: tooltip }) do
+ render(Primer::Forms::ToggleSwitchForm.new(
+ name: "publish_project_query",
+ label: t("sharing.project_queries.public_flag.label", instance_name: Setting.app_title),
+ caption: t("sharing.project_queries.public_flag.caption"),
+ src: toggle_public_flag_link,
+ csrf_token: form_authenticity_token,
+ status_label_position: :start,
+ checked: published?,
+ enabled: can_publish?
+ ))
+ end
end
%>
diff --git a/app/components/shares/project_queries/public_flag_component.rb b/app/components/shares/project_queries/public_flag_component.rb
index 813c5caa2a1..36154bcf0b0 100644
--- a/app/components/shares/project_queries/public_flag_component.rb
+++ b/app/components/shares/project_queries/public_flag_component.rb
@@ -56,6 +56,18 @@ module Shares
def can_publish?
User.current.allowed_globally?(:manage_public_project_queries)
end
+
+ def tooltip
+ return if can_publish?
+
+ I18n.t("sharing.project_queries.publishing_denied")
+ end
+
+ def wrapper_classes
+ return ["d-flex", "flex-column"] if can_publish?
+
+ ["tooltip--bottom", "d-flex", "flex-column"]
+ end
end
end
end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 234cd9d4b04..8f7ded21eb7 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1221,6 +1221,9 @@ en:
other: "Notifications"
placeholder_user: "Placeholder user"
project: "Project"
+ project_query:
+ one: "Project list"
+ other: "Project lists"
query: "Custom query"
role:
one: "Role"
@@ -3695,6 +3698,7 @@ en:
additional_privileges_group: "Might have additional privileges (as group member)"
additional_privileges_project_or_group: "Might have additional privileges (as project or group member)"
project_queries:
+ publishing_denied: "You do not have permission to make project lists public."
access_warning: "Users will only see the projects they have access to. Sharing project lists does not impact individual project permissions."
public_flag:
label: "Share with everyone at %{instance_name}"