From 9d933c933ebdd10e6de86780a9d1bbe4e86024ab Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sat, 25 Apr 2020 21:14:26 +0100 Subject: [PATCH] Remove unused (removed) roles from Your Data / Export --- Rakefile | 60 ----------------------------------- app/views/user/data.html.haml | 35 -------------------- lib/exporter.rb | 12 +++---- 3 files changed, 5 insertions(+), 102 deletions(-) diff --git a/Rakefile b/Rakefile index ab71e59f..1fe43af8 100644 --- a/Rakefile +++ b/Rakefile @@ -227,66 +227,6 @@ namespace :justask do puts "#{user.screen_name} is no longer banned." end - desc "Gives blogger status to an user." - task :blog, [:screen_name] => :environment do |t, args| - fail "screen name required" if args[:screen_name].nil? - user = User.find_by_screen_name(args[:screen_name]) - fail "user #{args[:screen_name]} not found" if user.nil? - user.blogger = true - user.save! - puts "#{user.screen_name} is now a blogger." - end - - desc "Removes blogger status from an user." - task :unblog, [:screen_name] => :environment do |t, args| - fail "screen name required" if args[:screen_name].nil? - user = User.find_by_screen_name(args[:screen_name]) - fail "user #{args[:screen_name]} not found" if user.nil? - user.blogger = false - user.save! - puts "#{user.screen_name} is no longer a blogger." - end - - desc "Gives supporter status to an user." - task :sup, [:screen_name] => :environment do |t, args| - fail "screen name required" if args[:screen_name].nil? - user = User.find_by_screen_name(args[:screen_name]) - fail "user #{args[:screen_name]} not found" if user.nil? - user.supporter = true - user.save! - puts "#{user.screen_name} is now an supporter." - end - - desc "Removes supporter status from an user." - task :desup, [:screen_name] => :environment do |t, args| - fail "screen name required" if args[:screen_name].nil? - user = User.find_by_screen_name(args[:screen_name]) - fail "user #{args[:screen_name]} not found" if user.nil? - user.supporter = false - user.save! - puts "#{user.screen_name} is no longer an supporter." - end - - desc "Gives contributor status to an user." - task :contrib, [:screen_name] => :environment do |t, args| - fail "screen name required" if args[:screen_name].nil? - user = User.find_by_screen_name(args[:screen_name]) - fail "user #{args[:screen_name]} not found" if user.nil? - user.contributor = true - user.save! - puts "#{user.screen_name} is now a contributor." - end - - desc "Removes contributor status from an user." - task :decontrib, [:screen_name] => :environment do |t, args| - fail "screen name required" if args[:screen_name].nil? - user = User.find_by_screen_name(args[:screen_name]) - fail "user #{args[:screen_name]} not found" if user.nil? - user.contributor = false - user.save! - puts "#{user.screen_name} is no longer a contributor." - end - desc "Lists all users." task lusers: :environment do User.all.each do |u| diff --git a/app/views/user/data.html.haml b/app/views/user/data.html.haml index 8dae340a..e7296259 100644 --- a/app/views/user/data.html.haml +++ b/app/views/user/data.html.haml @@ -111,41 +111,6 @@ %span.label.label-danger %i.fa.fa-fw.fa-close - %p.data-heading Supporter - %p - - if current_user.supporter? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - - %p.data-heading Contributor - %p - - if current_user.contributor? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - - %p.data-heading Blogger - %p - - if current_user.blogger? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close - - %p.data-heading Translator - %p - - if current_user.translator? - %span.label.label-success - %i.fa.fa-fw.fa-check - - else - %span.label.label-danger - %i.fa.fa-fw.fa-close .row .col-md-6.col-sm-6.col-xs-12 %h3 IP diff --git a/lib/exporter.rb b/lib/exporter.rb index 1086708f..f84ce038 100644 --- a/lib/exporter.rb +++ b/lib/exporter.rb @@ -34,15 +34,14 @@ class Exporter private def collect_user_info - %i(answered_count asked_count ban_reason banned_until bio blogger comment_smiled_count commented_count - confirmation_sent_at confirmed_at contributor created_at crop_h crop_h_h crop_h_w crop_h_x crop_h_y + %i(answered_count asked_count ban_reason banned_until bio 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 crop_w crop_x crop_y current_sign_in_at current_sign_in_ip display_name email follower_count friend_count id last_sign_in_at last_sign_in_ip locale location motivation_header permanently_banned 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 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 supporter translator - updated_at website).each do |f| + profile_picture_updated_at screen_name show_foreign_themes sign_in_count smiled_count updated_at website).each do |f| @obj[f] = @user.send f end @@ -229,9 +228,8 @@ class Exporter def user_stub(user) uobj = {} - %i(answered_count asked_count bio blogger comment_smiled_count commented_count contributor created_at - display_name follower_count friend_count id location motivation_header permanently_banned screen_name - smiled_count supporter translator website).each do |f| + %i(answered_count asked_count bio comment_smiled_count commented_count created_at display_name follower_count + friend_count id location motivation_header permanently_banned screen_name smiled_count website).each do |f| uobj[f] = user.send f end