From 44391ee8ab7431ca572b6c340d6e770cdadd51b3 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 14 Nov 2018 15:03:02 +0800 Subject: [PATCH] FEATURE: Upload Site Settings. (#6573) --- .../site-settings-image-uploader.js.es6 | 6 + .../admin/mixins/setting-component.js.es6 | 3 +- .../components/site-settings/upload.hbs | 2 + app/assets/javascripts/discourse.js.es6 | 2 +- .../lib/desktop-notifications.js.es6 | 9 +- .../discourse/mixins/upload.js.es6 | 5 +- .../discourse/widgets/home-logo.js.es6 | 6 +- ... => image-preview-apple-touch-icon.js.es6} | 0 ...rl.js.es6 => image-preview-favicon.js.es6} | 0 ...js.es6 => image-preview-logo-small.js.es6} | 0 ...o-url.js.es6 => image-preview-logo.js.es6} | 0 .../stylesheets/common/admin/settings.scss | 4 + .../admin/site_settings_controller.rb | 5 + app/controllers/metadata_controller.rb | 10 +- app/controllers/site_controller.rb | 13 +- app/controllers/static_controller.rb | 6 +- app/controllers/uploads_controller.rb | 14 +- app/helpers/application_helper.rb | 17 +- app/helpers/user_notifications_helper.rb | 7 +- app/jobs/scheduled/clean_up_uploads.rb | 6 + app/models/site_setting.rb | 49 +++++ app/models/upload.rb | 5 + app/services/push_notification_pusher.rb | 8 +- app/views/embed/comments.html.erb | 2 +- app/views/embed/embed_error.html.erb | 2 +- app/views/embed/loading.html.erb | 2 +- app/views/layouts/_head.html.erb | 13 +- app/views/layouts/crawler.html.erb | 4 +- app/views/metadata/opensearch.xml.erb | 8 +- config/locales/server.en.yml | 31 ++- config/site_settings.yml | 60 +++++- ...0181112013117_migrate_url_site_settings.rb | 75 +++++++ lib/site_setting_extension.rb | 46 ++++- lib/site_settings/type_supervisor.rb | 9 +- lib/site_settings/yaml_loader.rb | 1 + lib/upload_creator.rb | 1 + lib/validators/upload_validator.rb | 9 +- lib/wizard/builder.rb | 25 ++- lib/wizard/step_updater.rb | 5 + .../certificate_generator.rb | 4 +- .../spec/lib/certificate_generator_spec.rb | 3 +- .../components/site_setting_extension_spec.rb | 35 ++++ .../site_settings/type_supervisor_spec.rb | 38 +++- .../validators/upload_validator_spec.rb | 37 ++++ spec/components/wizard/step_updater_spec.rb | 35 ++-- .../migrate_url_site_settings_spec.rb | 76 +++++++ spec/fixtures/images/smallest.ico | Bin 0 -> 70 bytes spec/jobs/clean_up_uploads_spec.rb | 49 ++++- spec/lib/upload_creator_spec.rb | 20 ++ spec/models/upload_spec.rb | 6 + .../admin/site_settings_controller_spec.rb | 28 +++ spec/requests/metadata_controller_spec.rb | 25 ++- spec/requests/site_controller_spec.rb | 25 ++- spec/requests/static_controller_spec.rb | 17 +- spec/requests/uploads_controller_spec.rb | 21 +- .../admin-site-settings-test.js.es6 | 11 + .../javascripts/fixtures/site_settings.js.es6 | 10 + test/javascripts/helpers/site-settings.js | 192 +++++++++--------- .../javascripts/widgets/home-logo-test.js.es6 | 34 ++-- 59 files changed, 892 insertions(+), 244 deletions(-) create mode 100644 app/assets/javascripts/admin/components/site-settings-image-uploader.js.es6 create mode 100644 app/assets/javascripts/admin/templates/components/site-settings/upload.hbs rename app/assets/javascripts/wizard/components/{image-preview-apple-touch-icon-url.js.es6 => image-preview-apple-touch-icon.js.es6} (100%) rename app/assets/javascripts/wizard/components/{image-preview-favicon-url.js.es6 => image-preview-favicon.js.es6} (100%) rename app/assets/javascripts/wizard/components/{image-preview-logo-small-url.js.es6 => image-preview-logo-small.js.es6} (100%) rename app/assets/javascripts/wizard/components/{image-preview-logo-url.js.es6 => image-preview-logo.js.es6} (100%) create mode 100644 db/post_migrate/20181112013117_migrate_url_site_settings.rb create mode 100644 spec/db/post_migrate/migrate_url_site_settings_spec.rb create mode 100644 spec/fixtures/images/smallest.ico diff --git a/app/assets/javascripts/admin/components/site-settings-image-uploader.js.es6 b/app/assets/javascripts/admin/components/site-settings-image-uploader.js.es6 new file mode 100644 index 00000000000..4ebb3e8e13e --- /dev/null +++ b/app/assets/javascripts/admin/components/site-settings-image-uploader.js.es6 @@ -0,0 +1,6 @@ +import ImageUploader from "discourse/components/image-uploader"; + +export default ImageUploader.extend({ + layoutName: "components/image-uploader", + uploadUrlParams: "&for_site_setting=true" +}); diff --git a/app/assets/javascripts/admin/mixins/setting-component.js.es6 b/app/assets/javascripts/admin/mixins/setting-component.js.es6 index 9408bfbceba..1d6184c85e5 100644 --- a/app/assets/javascripts/admin/mixins/setting-component.js.es6 +++ b/app/assets/javascripts/admin/mixins/setting-component.js.es6 @@ -12,7 +12,8 @@ const CUSTOM_TYPES = [ "category", "uploaded_image_list", "compact_list", - "secret_list" + "secret_list", + "upload" ]; export default Ember.Mixin.create({ diff --git a/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs b/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs new file mode 100644 index 00000000000..d13892157db --- /dev/null +++ b/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs @@ -0,0 +1,2 @@ +{{site-settings-image-uploader imageUrl=value type="site_setting"}} +
{{{unbound setting.description}}}
diff --git a/app/assets/javascripts/discourse.js.es6 b/app/assets/javascripts/discourse.js.es6 index e66abede413..e84865fb6bb 100644 --- a/app/assets/javascripts/discourse.js.es6 +++ b/app/assets/javascripts/discourse.js.es6 @@ -62,7 +62,7 @@ const Discourse = Ember.Application.extend({ @observes("notifyCount") faviconChanged() { if (Discourse.User.currentProp("dynamic_favicon")) { - let url = Discourse.SiteSettings.favicon_url; + let url = Discourse.SiteSettings.site_favicon_url; if (/^http/.test(url)) { url = Discourse.getURL("/favicon/proxied?" + encodeURIComponent(url)); } diff --git a/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 b/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 index 33a594360d4..06264d5c199 100644 --- a/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 +++ b/app/assets/javascripts/discourse/lib/desktop-notifications.js.es6 @@ -70,8 +70,8 @@ function confirmNotification() { { body: I18n.t("notifications.popup.confirm_body"), icon: - Discourse.SiteSettings.logo_small_url || - Discourse.SiteSettings.logo_url, + Discourse.SiteSettings.site_logo_small_url || + Discourse.SiteSettings.site_logo_url, tag: "confirm-subscription" } ); @@ -150,8 +150,11 @@ function onNotification(data) { }); const notificationBody = data.excerpt; + const notificationIcon = - Discourse.SiteSettings.logo_small_url || Discourse.SiteSettings.logo_url; + Discourse.SiteSettings.site_logo_small_url || + Discourse.SiteSettings.site_logo_url; + const notificationTag = "discourse-notification-" + Discourse.SiteSettings.title + diff --git a/app/assets/javascripts/discourse/mixins/upload.js.es6 b/app/assets/javascripts/discourse/mixins/upload.js.es6 index eac1fcff186..4d89f1ab912 100644 --- a/app/assets/javascripts/discourse/mixins/upload.js.es6 +++ b/app/assets/javascripts/discourse/mixins/upload.js.es6 @@ -22,10 +22,13 @@ export default Em.Mixin.create({ ".json?client_id=" + (this.messageBus && this.messageBus.clientId) + "&authenticity_token=" + - encodeURIComponent(Discourse.Session.currentProp("csrfToken")) + encodeURIComponent(Discourse.Session.currentProp("csrfToken")) + + this.uploadUrlParams ); }, + uploadUrlParams: "", + uploadOptions() { return {}; }, diff --git a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 index 6a9a0f1aa2c..c0532d14712 100644 --- a/app/assets/javascripts/discourse/widgets/home-logo.js.es6 +++ b/app/assets/javascripts/discourse/widgets/home-logo.js.es6 @@ -20,14 +20,14 @@ export default createWidget("home-logo", { const { siteSettings } = this; const mobileView = this.site.mobileView; - const mobileLogoUrl = siteSettings.mobile_logo_url || ""; + const mobileLogoUrl = siteSettings.site_mobile_logo_url || ""; const showMobileLogo = mobileView && mobileLogoUrl.length > 0; - const logoUrl = siteSettings.logo_url || ""; + const logoUrl = siteSettings.site_logo_url || ""; const title = siteSettings.title; if (!mobileView && this.attrs.minimized) { - const logoSmallUrl = siteSettings.logo_small_url || ""; + const logoSmallUrl = siteSettings.site_logo_small_url || ""; if (logoSmallUrl.length) { return h("img#site-logo.logo-small", { key: "logo-small", diff --git a/app/assets/javascripts/wizard/components/image-preview-apple-touch-icon-url.js.es6 b/app/assets/javascripts/wizard/components/image-preview-apple-touch-icon.js.es6 similarity index 100% rename from app/assets/javascripts/wizard/components/image-preview-apple-touch-icon-url.js.es6 rename to app/assets/javascripts/wizard/components/image-preview-apple-touch-icon.js.es6 diff --git a/app/assets/javascripts/wizard/components/image-preview-favicon-url.js.es6 b/app/assets/javascripts/wizard/components/image-preview-favicon.js.es6 similarity index 100% rename from app/assets/javascripts/wizard/components/image-preview-favicon-url.js.es6 rename to app/assets/javascripts/wizard/components/image-preview-favicon.js.es6 diff --git a/app/assets/javascripts/wizard/components/image-preview-logo-small-url.js.es6 b/app/assets/javascripts/wizard/components/image-preview-logo-small.js.es6 similarity index 100% rename from app/assets/javascripts/wizard/components/image-preview-logo-small-url.js.es6 rename to app/assets/javascripts/wizard/components/image-preview-logo-small.js.es6 diff --git a/app/assets/javascripts/wizard/components/image-preview-logo-url.js.es6 b/app/assets/javascripts/wizard/components/image-preview-logo.js.es6 similarity index 100% rename from app/assets/javascripts/wizard/components/image-preview-logo-url.js.es6 rename to app/assets/javascripts/wizard/components/image-preview-logo.js.es6 diff --git a/app/assets/stylesheets/common/admin/settings.scss b/app/assets/stylesheets/common/admin/settings.scss index 53921f04e7a..b42348f12d6 100644 --- a/app/assets/stylesheets/common/admin/settings.scss +++ b/app/assets/stylesheets/common/admin/settings.scss @@ -37,6 +37,10 @@ width: 100% !important; // !important overrides hard-coded mobile width of 68px } } + .uploaded-image-preview { + background-size: auto; + background-repeat: no-repeat; + } } .setting-controls { float: left; diff --git a/app/controllers/admin/site_settings_controller.rb b/app/controllers/admin/site_settings_controller.rb index 4075f45545b..d12405ff051 100644 --- a/app/controllers/admin/site_settings_controller.rb +++ b/app/controllers/admin/site_settings_controller.rb @@ -13,6 +13,11 @@ class Admin::SiteSettingsController < Admin::AdminController value = params[id] value.strip! if value.is_a?(String) raise_access_hidden_setting(id) + + if SiteSetting.type_supervisor.get_type(id) == :upload + value = Upload.get_from_url(value) || '' + end + SiteSetting.set_and_log(id, value, current_user) render body: nil end diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rb index 6e157cc5961..07a3ac76327 100644 --- a/app/controllers/metadata_controller.rb +++ b/app/controllers/metadata_controller.rb @@ -13,10 +13,14 @@ class MetadataController < ApplicationController private def default_manifest - logo = SiteSetting.large_icon_url.presence || SiteSetting.logo_small_url.presence || SiteSetting.apple_touch_icon_url.presence + logo = SiteSetting.site_large_icon_url.presence || + SiteSetting.site_logo_small_url.presence || + SiteSetting.site_apple_touch_icon_url.presence + if !logo - logo = path('/images/d-logo-sketch-small.png') + logo = '/images/d-logo-sketch-small.png' end + file_info = get_file_info(logo) display = Regexp.new(SiteSetting.pwa_display_browser_regex).match(request.user_agent) ? 'browser' : 'standalone' @@ -30,7 +34,7 @@ class MetadataController < ApplicationController theme_color: "##{ColorScheme.hex_for_name('header_background', view_context.scheme_id)}", icons: [ { - src: logo, + src: UrlHelper.absolute(logo), sizes: file_info[:size], type: file_info[:type] } diff --git a/app/controllers/site_controller.rb b/app/controllers/site_controller.rb index 298001e273b..42d1ffe984e 100644 --- a/app/controllers/site_controller.rb +++ b/app/controllers/site_controller.rb @@ -37,16 +37,19 @@ class SiteController < ApplicationController def basic_info results = { - logo_url: UrlHelper.absolute(SiteSetting.logo_url), - logo_small_url: UrlHelper.absolute(SiteSetting.logo_small_url), - apple_touch_icon_url: UrlHelper.absolute(SiteSetting.apple_touch_icon_url), - favicon_url: UrlHelper.absolute(SiteSetting.favicon_url), + logo_url: UrlHelper.absolute(SiteSetting.site_logo_url), + logo_small_url: UrlHelper.absolute(SiteSetting.site_logo_small_url), + apple_touch_icon_url: UrlHelper.absolute(SiteSetting.site_apple_touch_icon_url), + favicon_url: UrlHelper.absolute(SiteSetting.site_favicon_url), title: SiteSetting.title, description: SiteSetting.site_description, header_primary_color: ColorScheme.hex_for_name('header_primary') || '333333', header_background_color: ColorScheme.hex_for_name('header_background') || 'ffffff' } - results[:mobile_logo_url] = SiteSetting.mobile_logo_url.presence + + if mobile_logo_url = SiteSetting.site_mobile_logo_url.presence + results[:mobile_logo_url] = UrlHelper.absolute(mobile_logo_url) + end DiscourseHub.stats_fetched_at = Time.zone.now if request.user_agent == "Discourse Hub" diff --git a/app/controllers/static_controller.rb b/app/controllers/static_controller.rb index 5b444fdc87e..c6252dfb784 100644 --- a/app/controllers/static_controller.rb +++ b/app/controllers/static_controller.rb @@ -108,10 +108,10 @@ class StaticController < ApplicationController is_asset_path hijack do - data = DistributedMemoizer.memoize(FAVICON + SiteSetting.favicon_url, 60 * 30) do + data = DistributedMemoizer.memoize(FAVICON + SiteSetting.site_favicon_url, 60 * 30) do begin file = FileHelper.download( - SiteSetting.favicon_url, + UrlHelper.absolute(SiteSetting.site_favicon_url), max_file_size: 50.kilobytes, tmp_file_name: FAVICON, follow_redirect: true @@ -122,7 +122,7 @@ class StaticController < ApplicationController data rescue => e AdminDashboardData.add_problem_message('dashboard.bad_favicon_url', 1800) - Rails.logger.debug("Invalid favicon_url #{SiteSetting.favicon_url}: #{e}\n#{e.backtrace}") + Rails.logger.debug("Invalid favicon_url #{SiteSetting.site_favicon_url}: #{e}\n#{e.backtrace}") "" end end diff --git a/app/controllers/uploads_controller.rb b/app/controllers/uploads_controller.rb index 922e4767e33..b04b393cc56 100644 --- a/app/controllers/uploads_controller.rb +++ b/app/controllers/uploads_controller.rb @@ -21,6 +21,7 @@ class UploadsController < ApplicationController file = params[:file] || params[:files]&.first pasted = params[:pasted] == "true" for_private_message = params[:for_private_message] == "true" + for_site_setting = params[:for_site_setting] == "true" is_api = is_api? retain_hours = params[:retain_hours].to_i @@ -34,6 +35,7 @@ class UploadsController < ApplicationController url: url, type: type, for_private_message: for_private_message, + for_site_setting: for_site_setting, pasted: pasted, is_api: is_api, retain_hours: retain_hours @@ -93,7 +95,16 @@ class UploadsController < ApplicationController serialized ||= (data || {}).as_json end - def self.create_upload(current_user:, file:, url:, type:, for_private_message:, pasted:, is_api:, retain_hours:) + def self.create_upload(current_user:, + file:, + url:, + type:, + for_private_message:, + for_site_setting:, + pasted:, + is_api:, + retain_hours:) + if file.nil? if url.present? && is_api maximum_upload_size = [SiteSetting.max_image_size_kb, SiteSetting.max_attachment_size_kb].max.kilobytes @@ -114,6 +125,7 @@ class UploadsController < ApplicationController opts = { type: type, for_private_message: for_private_message, + for_site_setting: for_site_setting, pasted: pasted, } diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5a6998c6e3f..38893536a11 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -192,11 +192,16 @@ module ApplicationHelper opts ||= {} opts[:url] ||= "#{Discourse.base_url_no_prefix}#{request.fullpath}" - if opts[:image].blank? && (SiteSetting.default_opengraph_image_url.present? || SiteSetting.twitter_summary_large_image_url.present?) - opts[:twitter_summary_large_image] = SiteSetting.twitter_summary_large_image_url if SiteSetting.twitter_summary_large_image_url.present? - opts[:image] = SiteSetting.default_opengraph_image_url.present? ? SiteSetting.default_opengraph_image_url : SiteSetting.twitter_summary_large_image_url - elsif opts[:image].blank? && SiteSetting.apple_touch_icon_url.present? - opts[:image] = SiteSetting.apple_touch_icon_url + twitter_summary_large_image_url = + SiteSetting.site_twitter_summary_large_image_url + + opengraph_image_url = SiteSetting.opengraph_image_url + + if opts[:image].blank? && (opengraph_image_url.present? || twitter_summary_large_image_url.present?) + opts[:twitter_summary_large_image] = twitter_summary_large_image_url if twitter_summary_large_image_url.present? + opts[:image] = opengraph_image_url.present? ? opengraph_image_url : twitter_summary_large_image_url + elsif opts[:image].blank? && SiteSetting.site_apple_touch_icon_url.present? + opts[:image] = SiteSetting.site_apple_touch_icon_url end # Use the correct scheme for open graph image @@ -271,7 +276,7 @@ module ApplicationHelper end def application_logo_url - @application_logo_url ||= (mobile_view? && SiteSetting.mobile_logo_url).presence || SiteSetting.logo_url + @application_logo_url ||= (mobile_view? && SiteSetting.site_mobile_logo_url).presence || SiteSetting.site_logo_url end def login_path diff --git a/app/helpers/user_notifications_helper.rb b/app/helpers/user_notifications_helper.rb index fbf647be5c8..5d9c98a1936 100644 --- a/app/helpers/user_notifications_helper.rb +++ b/app/helpers/user_notifications_helper.rb @@ -18,13 +18,14 @@ module UserNotificationsHelper end def logo_url - logo_url = SiteSetting.digest_logo_url - logo_url = SiteSetting.logo_url if logo_url.blank? || logo_url =~ /\.svg$/i - + logo_url = SiteSetting.site_digest_logo_url + logo_url = SiteSetting.site_logo_url if logo_url.blank? || logo_url =~ /\.svg$/i return nil if logo_url.blank? || logo_url =~ /\.svg$/i + if logo_url !~ /http(s)?\:\/\// logo_url = "#{Discourse.base_url}#{logo_url}" end + logo_url end diff --git a/app/jobs/scheduled/clean_up_uploads.rb b/app/jobs/scheduled/clean_up_uploads.rb index 9f5aed5e7d4..92ec65d165f 100644 --- a/app/jobs/scheduled/clean_up_uploads.rb +++ b/app/jobs/scheduled/clean_up_uploads.rb @@ -46,6 +46,11 @@ module Jobs result = Upload.where("uploads.retain_hours IS NULL OR uploads.created_at < current_timestamp - interval '1 hour' * uploads.retain_hours") .where("uploads.created_at < ?", grace_period.hour.ago) + .joins(<<~SQL) + LEFT JOIN site_settings ss + ON ss.value::integer = uploads.id + AND ss.data_type = #{SiteSettings::TypeSupervisor.types[:upload].to_i} + SQL .joins("LEFT JOIN post_uploads pu ON pu.upload_id = uploads.id") .joins("LEFT JOIN users u ON u.uploaded_avatar_id = uploads.id") .joins("LEFT JOIN user_avatars ua ON ua.gravatar_upload_id = uploads.id OR ua.custom_upload_id = uploads.id") @@ -62,6 +67,7 @@ module Jobs .where("ce.upload_id IS NULL") .where("tf.upload_id IS NULL") .where("ue.upload_id IS NULL") + .where("ss.value IS NULL") result = result.where("uploads.url NOT IN (?)", ignore_urls) if ignore_urls.present? diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb index f5b4e9f9f66..b5ef271ba5d 100644 --- a/app/models/site_setting.rb +++ b/app/models/site_setting.rb @@ -168,6 +168,55 @@ class SiteSetting < ActiveRecord::Base SiteSetting::Upload end + %i{ + site_logo_url + site_logo_small_url + site_mobile_logo_url + site_favicon_url + }.each { |client_setting| client_settings << client_setting } + + def self.site_logo_url + self.logo&.url || self.logo_url + end + + def self.site_logo_small_url + self.logo_small&.url || self.logo_small_url + end + + def self.site_digest_logo_url + self.digest_logo&.url || self.digest_logo_url + end + + def self.site_mobile_logo_url + self.mobile_logo&.url || self.mobile_logo_url + end + + def self.site_large_icon_url + self.large_icon&.url || self.large_icon_url + end + + def self.site_favicon_url + self.favicon&.url || self.favicon_url + end + + def self.site_apple_touch_icon_url + self.apple_touch_icon&.url || self.apple_touch_icon_url + end + + def self.opengraph_image_url + self.opengraph_image&.url || self.default_opengraph_image_url + end + + def self.site_twitter_summary_large_image_url + self.twitter_summary_large_image&.url || + self.twitter_summary_large_image_url + end + + def self.site_push_notifications_icon_url + SiteSetting.push_notifications_icon&.url || + SiteSetting.push_notifications_icon_url + end + def self.shared_drafts_enabled? c = SiteSetting.shared_drafts_category c.present? && c.to_i != SiteSetting.uncategorized_category_id.to_i diff --git a/app/models/upload.rb b/app/models/upload.rb index 9e50a49b36d..bf3d4155154 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -21,6 +21,7 @@ class Upload < ActiveRecord::Base attr_accessor :for_theme attr_accessor :for_private_message attr_accessor :for_export + attr_accessor :for_site_setting validates_presence_of :filesize validates_presence_of :original_filename @@ -33,6 +34,10 @@ class Upload < ActiveRecord::Base UserAvatar.where(custom_upload_id: self.id).update_all(custom_upload_id: nil) end + def to_s + self.url + end + def thumbnail(width = self.thumbnail_width, height = self.thumbnail_height) optimized_images.find_by(width: width, height: height) end diff --git a/app/services/push_notification_pusher.rb b/app/services/push_notification_pusher.rb index 204e3f668be..2e39eb9cac9 100644 --- a/app/services/push_notification_pusher.rb +++ b/app/services/push_notification_pusher.rb @@ -65,9 +65,11 @@ class PushNotificationPusher protected def self.get_badge - return !SiteSetting.push_notifications_icon_url.blank? ? - SiteSetting.push_notifications_icon_url : - ActionController::Base.helpers.image_url("push-notifications/discourse.png") + if SiteSetting.site_push_notifications_icon_url.present? + SiteSetting.site_push_notifications_icon_url + else + ActionController::Base.helpers.image_url("push-notifications/discourse.png") + end end def self.send_notification(user, subscription, message) diff --git a/app/views/embed/comments.html.erb b/app/views/embed/comments.html.erb index 25735bfc4a9..59d38298cf7 100644 --- a/app/views/embed/comments.html.erb +++ b/app/views/embed/comments.html.erb @@ -40,7 +40,7 @@ <% if @topic_view.topic.posts_count > 0 %>