mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: topic and category exporters were only exporting users who created the first post
This commit is contained in:
@@ -75,10 +75,10 @@ module ImportExport
|
||||
end
|
||||
|
||||
user_ids.uniq!
|
||||
return [] if user_ids.empty?
|
||||
return User.none if user_ids.empty?
|
||||
|
||||
users = User.where(id: user_ids)
|
||||
export_users(users.to_a)
|
||||
export_users(users)
|
||||
end
|
||||
|
||||
def export_group_users!
|
||||
@@ -118,10 +118,9 @@ module ImportExport
|
||||
return if @export_data[:topics].blank?
|
||||
topic_ids = @export_data[:topics].pluck(:id)
|
||||
|
||||
users = User.joins(:topics).where('topics.id IN (?)', topic_ids).to_a
|
||||
users.uniq!
|
||||
users = User.joins(:posts).where('posts.topic_id IN (?)', topic_ids).distinct
|
||||
|
||||
export_users(users.to_a)
|
||||
export_users(users)
|
||||
end
|
||||
|
||||
def export_topic_users!
|
||||
@@ -132,9 +131,9 @@ module ImportExport
|
||||
|
||||
def export_users(users)
|
||||
data = []
|
||||
users.reject! { |u| u.id == Discourse::SYSTEM_USER_ID }
|
||||
|
||||
users.each do |u|
|
||||
users.find_each do |u|
|
||||
next if u.id == Discourse::SYSTEM_USER_ID
|
||||
x = USER_ATTRS.inject({}) { |h, a| h[a] = u.send(a); h; }
|
||||
x.merge(bio_raw: u.user_profile.bio_raw,
|
||||
website: u.user_profile.website,
|
||||
|
Reference in New Issue
Block a user