Merge pull request #8406 from Flaburgan/6184-service-disabled

Do not show the service to the user if it is disabled, fixes #6184

Fixes #6184
This commit is contained in:
Benjamin Neff
2024-06-05 01:03:12 +02:00
6 changed files with 35 additions and 8 deletions

View File

@@ -5,6 +5,10 @@
# the COPYRIGHT file.
module PublisherHelper
def available_services
current_user.services.select {|service| AppConfig.configured_services.map(&:to_s).include? service.provider }
end
def service_button(service)
provider_title = I18n.t("services.index.share_to", provider: service.provider.titleize)
content_tag :div,

View File

@@ -55,9 +55,9 @@
%button.btn.btn-group.btn-primary#submit= t("shared.publisher.share")
.btn-toolbar.pull-right#publisher-service-icons
- if current_user.services
- current_user.services.each do |service|
= service_button(service)
- available_services.each do |service|
= service_button(service)
.btn.btn-link.question_mark{title: t("shared.public_explain.manage"),
data: {toggle: "modal", target: "#publicExplainModal"}}
%i.entypo-cog

View File

@@ -11,11 +11,10 @@
= hidden_field_tag "aspect_ids[]", "all_aspects"
.form-group
%span#publisher-service-icons
- if current_user.services
- for service in current_user.services
= image_tag "social-media-logos/#{service.provider}-32x32.png",
title: service.provider.titleize, class: "service_icon dim",
id: "#{service.provider}", maxchar: "#{service.class::MAX_CHARACTERS}"
- available_services.each do |service|
= image_tag "social-media-logos/#{service.provider}-32x32.png",
title: service.provider.titleize, class: "service_icon dim",
id: service.provider, maxchar: service.class::MAX_CHARACTERS.to_s
.clear
#publisher-textarea-wrapper