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:
@@ -0,0 +1,22 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SystemUserForPublicSections < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
execute(<<-SQL)
|
||||
UPDATE sidebar_sections
|
||||
SET user_id = -1
|
||||
WHERE public IS TRUE
|
||||
SQL
|
||||
execute(<<-SQL)
|
||||
UPDATE sidebar_section_links
|
||||
SET user_id = -1
|
||||
FROM sidebar_sections
|
||||
WHERE sidebar_sections.public IS TRUE
|
||||
AND sidebar_section_links.sidebar_section_id = sidebar_sections.id
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user