mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: public sidebar sections belong to system user (#20972)
Before, public sidebar sections were belonging to admin. However, a better choice is system user.
This commit is contained in:
committed by
GitHub
parent
6b9dd22ba7
commit
b72282123b
@@ -12,6 +12,8 @@ class SidebarSection < ActiveRecord::Base
|
||||
|
||||
accepts_nested_attributes_for :sidebar_urls, allow_destroy: true
|
||||
|
||||
before_save :set_system_user_for_public_section
|
||||
|
||||
validates :title,
|
||||
presence: true,
|
||||
uniqueness: {
|
||||
@@ -20,6 +22,12 @@ class SidebarSection < ActiveRecord::Base
|
||||
length: {
|
||||
maximum: MAX_TITLE_LENGTH,
|
||||
}
|
||||
|
||||
private
|
||||
|
||||
def set_system_user_for_public_section
|
||||
self.user_id = Discourse.system_user.id if self.public
|
||||
end
|
||||
end
|
||||
|
||||
# == Schema Information
|
||||
|
||||
Reference in New Issue
Block a user