Add default_external_links_in_new_tab site setting
This commit is contained in:
parent
ed2e53bb06
commit
a897c2b091
|
@ -63,6 +63,7 @@ class User < ActiveRecord::Base
|
|||
before_save :ensure_password_is_hashed
|
||||
after_initialize :add_trust_level
|
||||
after_initialize :set_default_email_digest
|
||||
after_initialize :set_default_external_links_in_new_tab
|
||||
|
||||
after_save :update_tracked_topics
|
||||
|
||||
|
@ -596,6 +597,12 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def set_default_external_links_in_new_tab
|
||||
if has_attribute?(:external_links_in_new_tab) && self.external_links_in_new_tab.nil?
|
||||
self.external_links_in_new_tab = !SiteSetting.default_external_links_in_new_tab.blank?
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def previous_visit_at_update_required?(timestamp)
|
||||
|
|
|
@ -752,6 +752,7 @@ en:
|
|||
allow_uploaded_avatars: "Allow users to upload their custom avatars"
|
||||
allow_animated_avatars: "Allow users to use animated gif for avatars. WARNING: it is highly recommended to run the avatars:regenerate rake task after changing that setting."
|
||||
default_digest_email_frequency: "How often users receive digest emails by default. They can change this setting in their preferences."
|
||||
default_external_links_in_new_tab: "Open external links in a new tab. Users can change this in their preferences."
|
||||
|
||||
detect_custom_avatars: "Whether or not to check that users have uploaded custom avatars"
|
||||
max_daily_gravatar_crawls: "The maximum amount of times Discourse will check gravatar for custom avatars in a day"
|
||||
|
|
|
@ -126,6 +126,7 @@ users:
|
|||
client: true
|
||||
default: 14
|
||||
delete_all_posts_max: 15
|
||||
default_external_links_in_new_tab: false
|
||||
|
||||
posting:
|
||||
min_post_length:
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class RemoveDefaultFromExternalLinksInNewTab < ActiveRecord::Migration
|
||||
def up
|
||||
change_column_default :users, :external_links_in_new_tab, nil
|
||||
end
|
||||
|
||||
def down
|
||||
change_column_default :users, :external_links_in_new_tab, false
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue