FEATURE: Ensure we always fill the short_name in the web manifest

This commit is contained in:
Rafael dos Santos Silva 2020-02-04 14:16:00 -03:00
parent fec1c0f097
commit 5ead60677a
No known key found for this signature in database
GPG Key ID: 5E50360227B34938
1 changed files with 1 additions and 2 deletions

View File

@ -35,6 +35,7 @@ class MetadataController < ApplicationController
manifest = { manifest = {
name: SiteSetting.title, name: SiteSetting.title,
short_name: SiteSetting.short_title.presence || SiteSetting.title.truncate(12, separator: ' ', omission: ''),
display: display, display: display,
start_url: Discourse.base_uri.present? ? "#{Discourse.base_uri}/" : '.', start_url: Discourse.base_uri.present? ? "#{Discourse.base_uri}/" : '.',
background_color: "##{ColorScheme.hex_for_name('secondary', view_context.scheme_id)}", background_color: "##{ColorScheme.hex_for_name('secondary', view_context.scheme_id)}",
@ -64,8 +65,6 @@ class MetadataController < ApplicationController
manifest[:icons] << icon_entry manifest[:icons] << icon_entry
end end
manifest[:short_name] = SiteSetting.short_title if SiteSetting.short_title.present?
if current_user && current_user.trust_level >= 1 && SiteSetting.native_app_install_banner_android if current_user && current_user.trust_level >= 1 && SiteSetting.native_app_install_banner_android
manifest = manifest.merge( manifest = manifest.merge(
prefer_related_applications: true, prefer_related_applications: true,