Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cs_comments_service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
cs_comments_service
Commits
4aebb3a2
Commit
4aebb3a2
authored
Aug 28, 2012
by
Ibrahim Awwal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add default_sort_key field to users.
parent
1e4f86a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
api/users.rb
+1
-1
models/user.rb
+4
-2
No files found.
api/users.rb
View file @
4aebb3a2
...
...
@@ -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
...
...
models/user.rb
View file @
4aebb3a2
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment