Adjust exporter for user profiles

This commit is contained in:
Karina Kwiatek 2021-12-22 00:02:26 +01:00
parent 8fa4feb469
commit 08bafb1d78
1 changed files with 16 additions and 6 deletions

View File

@ -34,17 +34,22 @@ class Exporter
private private
def collect_user_info def collect_user_info
%i(answered_count asked_count ban_reason banned_until bio comment_smiled_count commented_count %i(answered_count asked_count ban_reason banned_until comment_smiled_count commented_count
confirmation_sent_at confirmed_at created_at crop_h crop_h_h crop_h_w crop_h_x crop_h_y confirmation_sent_at confirmed_at created_at crop_h crop_h_h crop_h_w crop_h_x crop_h_y
crop_w crop_x crop_y current_sign_in_at current_sign_in_ip display_name email follower_count friend_count crop_w crop_x crop_y current_sign_in_at current_sign_in_ip display_name follower_count friend_count
id last_sign_in_at last_sign_in_ip locale location motivation_header permanently_banned id last_sign_in_at last_sign_in_ip locale permanently_banned
privacy_allow_anonymous_questions privacy_allow_public_timeline privacy_allow_stranger_answers privacy_allow_anonymous_questions privacy_allow_public_timeline privacy_allow_stranger_answers
privacy_show_in_search profile_header_content_type profile_header_file_name profile_header_file_size privacy_show_in_search profile_header_content_type profile_header_file_name profile_header_file_size
profile_header_updated_at profile_picture_content_type profile_picture_file_name profile_picture_file_size profile_header_updated_at profile_picture_content_type profile_picture_file_name profile_picture_file_size
profile_picture_updated_at screen_name show_foreign_themes sign_in_count smiled_count updated_at website).each do |f| profile_picture_updated_at screen_name show_foreign_themes sign_in_count smiled_count updated_at).each do |f|
@obj[f] = @user.send f @obj[f] = @user.send f
end end
@obj[:profile] = {}
%i(display_name motivation_header website location description).each do |f|
@obj[:profile][f] = @user.send f
end
EXPORT_ROLES.each do |role| EXPORT_ROLES.each do |role|
@obj[role] = @user.has_role?(role) @obj[role] = @user.has_role?(role)
end end
@ -228,11 +233,16 @@ class Exporter
def user_stub(user) def user_stub(user)
uobj = {} uobj = {}
%i(answered_count asked_count bio comment_smiled_count commented_count created_at display_name follower_count %i(answered_count asked_count comment_smiled_count commented_count created_at follower_count
friend_count id location motivation_header permanently_banned screen_name smiled_count website).each do |f| friend_count id permanently_banned screen_name smiled_count).each do |f|
uobj[f] = user.send f uobj[f] = user.send f
end end
uobj[:profile] = {}
%i(display_name motivation_header website location description).each do |f|
uobj[:profile][f] = user.send f
end
EXPORT_ROLES.each do |role| EXPORT_ROLES.each do |role|
uobj[role] = user.has_role?(role) uobj[role] = user.has_role?(role)
end end