-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Add category moderation groups and more attributes to generic importer #32561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
script/bulk_import/generic_bulk.rb
Outdated
@@ -562,6 +631,7 @@ def import_user_options | |||
email_level: row["email_level"], | |||
email_messages_level: row["email_messages_level"], | |||
email_digests: row["email_digests"], | |||
hide_profile_and_presence: row["hide_profile_and_presence"] || false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be some work to make this setting more granular by splitting it into hide_profile
and hide_presence
, but hide_profile_and_presence
still appears to be kept in sync as follows:
discourse/app/models/user_option.rb
Lines 228 to 235 in 4117b08
def update_hide_profile_and_presence | |
if hide_profile_changed? || hide_presence_changed? | |
self.hide_profile_and_presence = hide_profile || hide_presence | |
elsif hide_profile_and_presence_changed? | |
self.hide_profile = hide_profile_and_presence | |
self.hide_presence = hide_profile_and_presence | |
end | |
end |
Simply setting hide_profile_and_presence
might be problematic. You could:
- Set both
hide_profile
andhide_presence
to the value ofhide_profile_and_presence
, if it’s explicitly provided inprocess_user_options
- Update the converter framework to support to also support
hide_profile
andhide_presence
and replicate the logic above to keep them in sync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made a couple of updates here. Let me know if this would work? This is actually not used in the converter. It was due to an error that was caused during the import that requested this to be added if I remember correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the error:
ERROR: null value in column "hide_profile_and_presence" of relation "user_options" violates not-null constraint
…user option, and multi-tag-group support
979c141
to
016ca7a
Compare
@@ -1225,6 +1243,7 @@ def process_group(group) | |||
|
|||
group[:created_at] ||= NOW | |||
group[:updated_at] ||= group[:created_at] | |||
group[:assignable_level] ||= Group::ALIAS_LEVELS[:nobody] if @assign_plugin_enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's safe to set this unconditionally. There's no need for @assign_plugin_enabled
in that case. A comment might be enough.
visibility_level: row["visibility_level"], | ||
members_visibility_level: row["members_visibility_level"], | ||
mentionable_level: row["mentionable_level"], | ||
messageable_level: row["messageable_level"], | ||
} | ||
group_data[:assignable_level] = row["assignable_level"] if defined?(::DiscourseAssign) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the condition here.
This PR improves the generic bulk import and base scripts by adding support for several previously unimplemented features and attributes: