Add default_sort_key field to users.
This commit is contained in:
Родитель
1e4f86a4ee
Коммит
4aebb3a28a
|
@ -48,7 +48,7 @@ put "#{APIPREFIX}/users/:user_id" do |user_id|
|
|||
if not user
|
||||
user = User.new(external_id: user_id)
|
||||
end
|
||||
user.update_attributes(params.slice(*%w[username email]))
|
||||
user.update_attributes(params.slice(*%w[username email default_sort_key]))
|
||||
if user.errors.any?
|
||||
error 400, user.errors.full_messages.to_json
|
||||
else
|
||||
|
|
|
@ -6,7 +6,8 @@ class User
|
|||
field :external_id, type: String
|
||||
field :username, type: String
|
||||
field :email, type: String
|
||||
|
||||
field :default_sort_key, type: String, default: "date"
|
||||
|
||||
has_many :comments, inverse_of: :author
|
||||
has_many :comment_threads, inverse_of: :author
|
||||
has_many :activities, class_name: "Notification", inverse_of: :actor
|
||||
|
@ -62,7 +63,8 @@ class User
|
|||
"follower_ids" => subscriptions_as_source.map(&:subscriber_id),
|
||||
"id" => id,
|
||||
"upvoted_ids" => upvoted_ids,
|
||||
"downvoted_ids" => downvoted_ids)
|
||||
"downvoted_ids" => downvoted_ids,
|
||||
"default_sort_key" => default_sort_key)
|
||||
end
|
||||
if params[:course_id]
|
||||
hash = hash.merge("threads_count" => comment_threads.where(course_id: params[:course_id]).count,
|
||||
|
|
Загрузка…
Ссылка в новой задаче