Use tos_url site setting in flag modal if it's set
This commit is contained in:
parent
e4a76812a6
commit
5f4dbd6ddc
|
@ -3,10 +3,12 @@ require 'canonical_url'
|
|||
require_dependency 'guardian'
|
||||
require_dependency 'unread'
|
||||
require_dependency 'age_words'
|
||||
require_dependency 'configurable_urls'
|
||||
|
||||
module ApplicationHelper
|
||||
include CurrentUser
|
||||
include CanonicalURL::Helpers
|
||||
include ConfigurableUrls
|
||||
|
||||
def with_format(format, &block)
|
||||
old_formats = formats
|
||||
|
@ -62,14 +64,6 @@ module ApplicationHelper
|
|||
return "#{Discourse::base_uri}/faq"
|
||||
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
|
||||
return "#{Discourse::base_uri}/login"
|
||||
end
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
require_dependency 'configurable_urls'
|
||||
|
||||
class PostActionTypeSerializer < ApplicationSerializer
|
||||
|
||||
attributes :name_key, :name, :description, :long_form, :is_flag, :icon, :id, :is_custom_flag
|
||||
|
||||
include ConfigurableUrls
|
||||
|
||||
def is_custom_flag
|
||||
object.id == PostActionType.types[:notify_user] ||
|
||||
object.id == PostActionType.types[:notify_moderators]
|
||||
|
@ -16,13 +20,13 @@ class PostActionTypeSerializer < ApplicationSerializer
|
|||
end
|
||||
|
||||
def description
|
||||
i18n('description')
|
||||
i18n('description', {tos_url: tos_path})
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def i18n(field)
|
||||
I18n.t("post_action_types.#{object.name_key}.#{field}")
|
||||
def i18n(field, vars={})
|
||||
I18n.t("post_action_types.#{object.name_key}.#{field}", vars)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -236,7 +236,7 @@ en:
|
|||
email_body: "%{link}\n\n%{message}"
|
||||
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'
|
||||
email_title: 'A post in "%{title}" requires moderator attention'
|
||||
email_body: "%{link}\n\n%{message}"
|
||||
|
|
|
@ -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
|
Loading…
Reference in New Issue