From 0f67350764b67678b234c2827acb7dbf51da00e6 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Tue, 27 Aug 2019 10:23:57 -0400 Subject: [PATCH] FIX: only use app argument for official iOS app banner When showing the native app banner, we include an app argument to automatically add the current site to the official DiscourseHub app. However, the app id can be changed via a hidden site setting, and when changed, that argument is no longer useful. This ensures the argument is only included for the official iOS app banner. --- app/helpers/application_helper.rb | 6 ++++++ app/views/layouts/application.html.erb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a440e726c4f..ff7cc872274 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -338,6 +338,12 @@ module ApplicationHelper current_user && current_user.trust_level >= 1 && SiteSetting.native_app_install_banner_ios end + def ios_app_argument + # argument only makes sense for DiscourseHub app + SiteSetting.ios_app_id == "1173672076" ? + ", app-argument=discourse://new?siteUrl=#{Discourse.base_url}" : "" + end + def allow_plugins? !request.env[ApplicationController::NO_PLUGINS] end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 3f6c9ff7441..fdebcba6f25 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -44,7 +44,7 @@ <%- if include_ios_native_app_banner? %> - + <%- end %> <%= render partial: "common/discourse_stylesheet" %>