Use tos_url site setting in flag modal if it's set
This commit is contained in:
parent
e4a76812a6
commit
5f4dbd6ddc
4 changed files with 21 additions and 12 deletions
app
config/locales
lib
|
@ -3,10 +3,12 @@ require 'canonical_url'
|
||||||
require_dependency 'guardian'
|
require_dependency 'guardian'
|
||||||
require_dependency 'unread'
|
require_dependency 'unread'
|
||||||
require_dependency 'age_words'
|
require_dependency 'age_words'
|
||||||
|
require_dependency 'configurable_urls'
|
||||||
|
|
||||||
module ApplicationHelper
|
module ApplicationHelper
|
||||||
include CurrentUser
|
include CurrentUser
|
||||||
include CanonicalURL::Helpers
|
include CanonicalURL::Helpers
|
||||||
|
include ConfigurableUrls
|
||||||
|
|
||||||
def with_format(format, &block)
|
def with_format(format, &block)
|
||||||
old_formats = formats
|
old_formats = formats
|
||||||
|
@ -62,14 +64,6 @@ module ApplicationHelper
|
||||||
return "#{Discourse::base_uri}/faq"
|
return "#{Discourse::base_uri}/faq"
|
||||||
end
|
end
|
||||||
|
|
||||||
def tos_path
|
|
||||||
SiteSetting.tos_url.blank? ? "#{Discourse::base_uri}/tos" : SiteSetting.tos_url
|
|
||||||
end
|
|
||||||
|
|
||||||
def privacy_path
|
|
||||||
SiteSetting.privacy_policy_url.blank? ? "#{Discourse::base_uri}/privacy" : SiteSetting.privacy_policy_url
|
|
||||||
end
|
|
||||||
|
|
||||||
def login_path
|
def login_path
|
||||||
return "#{Discourse::base_uri}/login"
|
return "#{Discourse::base_uri}/login"
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
require_dependency 'configurable_urls'
|
||||||
|
|
||||||
class PostActionTypeSerializer < ApplicationSerializer
|
class PostActionTypeSerializer < ApplicationSerializer
|
||||||
|
|
||||||
attributes :name_key, :name, :description, :long_form, :is_flag, :icon, :id, :is_custom_flag
|
attributes :name_key, :name, :description, :long_form, :is_flag, :icon, :id, :is_custom_flag
|
||||||
|
|
||||||
|
include ConfigurableUrls
|
||||||
|
|
||||||
def is_custom_flag
|
def is_custom_flag
|
||||||
object.id == PostActionType.types[:notify_user] ||
|
object.id == PostActionType.types[:notify_user] ||
|
||||||
object.id == PostActionType.types[:notify_moderators]
|
object.id == PostActionType.types[:notify_moderators]
|
||||||
|
@ -16,13 +20,13 @@ class PostActionTypeSerializer < ApplicationSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
def description
|
def description
|
||||||
i18n('description')
|
i18n('description', {tos_url: tos_path})
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def i18n(field)
|
def i18n(field, vars={})
|
||||||
I18n.t("post_action_types.#{object.name_key}.#{field}")
|
I18n.t("post_action_types.#{object.name_key}.#{field}", vars)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -236,7 +236,7 @@ en:
|
||||||
email_body: "%{link}\n\n%{message}"
|
email_body: "%{link}\n\n%{message}"
|
||||||
notify_moderators:
|
notify_moderators:
|
||||||
title: 'Notify moderators'
|
title: 'Notify moderators'
|
||||||
description: 'This post requires general moderator attention based on the <a href="/faq">FAQ</a>, <a href="/tos">TOS</a>, or for another reason not listed above.'
|
description: 'This post requires general moderator attention based on the <a href="/faq">FAQ</a>, <a href="%{tos_url}">TOS</a>, or for another reason not listed above.'
|
||||||
long_form: 'notified moderators'
|
long_form: 'notified moderators'
|
||||||
email_title: 'A post in "%{title}" requires moderator attention'
|
email_title: 'A post in "%{title}" requires moderator attention'
|
||||||
email_body: "%{link}\n\n%{message}"
|
email_body: "%{link}\n\n%{message}"
|
||||||
|
|
11
lib/configurable_urls.rb
Normal file
11
lib/configurable_urls.rb
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
module ConfigurableUrls
|
||||||
|
|
||||||
|
def tos_path
|
||||||
|
SiteSetting.tos_url.blank? ? "#{Discourse::base_uri}/tos" : SiteSetting.tos_url
|
||||||
|
end
|
||||||
|
|
||||||
|
def privacy_path
|
||||||
|
SiteSetting.privacy_policy_url.blank? ? "#{Discourse::base_uri}/privacy" : SiteSetting.privacy_policy_url
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Reference in a new issue