Code Cleanup: Usage of Polymorphic User instead of ExternalUser and InternalUser
Renamed requestor_user_id -> user_id Index of request_for_comments now returns the n (5?) newest requests per user. Solved via sliding windows in postgres, code added to model. Added route to /my_request_for_comments/ that shows all requests for the current user. Changed view from ERB to slim
This commit is contained in:
@ -41,13 +41,9 @@ class CommentsController < ApplicationController
|
||||
# if the user is internal, set the name
|
||||
|
||||
@comments.map{|comment|
|
||||
if(comment.user_type == 'InternalUser')
|
||||
comment.username = InternalUser.find(comment.user_id).name
|
||||
elsif(comment.user_type == 'ExternalUser')
|
||||
comment.username = ExternalUser.find(comment.user_id).name
|
||||
# alternative: # if the user is external, fetch the displayname from xikolo
|
||||
# Xikolo::UserClient.get(comment.user_id.to_s)[:display_name]
|
||||
end
|
||||
comment.username = comment.user.name
|
||||
# alternative: # if the user is external, fetch the displayname from xikolo
|
||||
# Xikolo::UserClient.get(comment.user_id.to_s)[:display_name]
|
||||
}
|
||||
else
|
||||
@comments = Comment.all.limit(0) #we need an empty relation here
|
||||
|
Reference in New Issue
Block a user