From 5adc486cef919491e0b042a4c7bf078179d0e54c Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 29 May 2014 14:59:14 +1000 Subject: [PATCH] BUGFIX: missing avatars in topic map Cleanup uneeded column --- app/controllers/users_controller.rb | 2 +- app/models/post.rb | 1 + app/models/user.rb | 1 - app/models/user_profile.rb | 8 ++++++++ app/serializers/topic_post_count_serializer.rb | 3 --- ...20140529045508_remove_use_uploaded_avatar_from_user.rb | 5 +++++ 6 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 db/migrate/20140529045508_remove_use_uploaded_avatar_from_user.rb diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 310a991fe40..5a2c34c0e84 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -297,7 +297,7 @@ class UsersController < ApplicationController results = UserSearch.new(term, topic_id: topic_id, searching_user: current_user).search - user_fields = [:username, :use_uploaded_avatar, :upload_avatar_template, :uploaded_avatar_id] + user_fields = [:username, :upload_avatar_template, :uploaded_avatar_id] user_fields << :name if SiteSetting.enable_names? to_render = { users: results.as_json(only: user_fields, methods: :avatar_template) } diff --git a/app/models/post.rb b/app/models/post.rb index 1ba2829d5ef..832125e68bf 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -585,6 +585,7 @@ end # version :integer default(1), not null # cook_method :integer default(1), not null # wiki :boolean default(FALSE), not null +# baked_at :datetime # # Indexes # diff --git a/app/models/user.rb b/app/models/user.rb index 267e4721655..c2e299d3d44 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -799,7 +799,6 @@ end # blocked :boolean default(FALSE) # dynamic_favicon :boolean default(FALSE), not null # title :string(255) -# use_uploaded_avatar :boolean default(FALSE) # uploaded_avatar_id :integer # email_always :boolean default(FALSE), not null # mailing_list_mode :boolean default(FALSE), not null diff --git a/app/models/user_profile.rb b/app/models/user_profile.rb index 25760e43f95..e762563147c 100644 --- a/app/models/user_profile.rb +++ b/app/models/user_profile.rb @@ -1,2 +1,10 @@ class UserProfile < ActiveRecord::Base end + +# == Schema Information +# +# Table name: user_profiles +# +# user_id :integer not null, primary key +# location :string(255) +# diff --git a/app/serializers/topic_post_count_serializer.rb b/app/serializers/topic_post_count_serializer.rb index f720cd11451..586f9f2d79d 100644 --- a/app/serializers/topic_post_count_serializer.rb +++ b/app/serializers/topic_post_count_serializer.rb @@ -18,7 +18,4 @@ class TopicPostCountSerializer < BasicUserSerializer object[:user].uploaded_avatar_id end - def include_uploaded_avatar_id? - SiteSetting.allow_uploaded_avatars? && object[:user].use_uploaded_avatar - end end diff --git a/db/migrate/20140529045508_remove_use_uploaded_avatar_from_user.rb b/db/migrate/20140529045508_remove_use_uploaded_avatar_from_user.rb new file mode 100644 index 00000000000..21bb9956e3b --- /dev/null +++ b/db/migrate/20140529045508_remove_use_uploaded_avatar_from_user.rb @@ -0,0 +1,5 @@ +class RemoveUseUploadedAvatarFromUser < ActiveRecord::Migration + def change + remove_column :users, :use_uploaded_avatar + end +end