Show correct usernames on comments, have correct linenumbers on request_for_comments
This commit is contained in:
@ -40,7 +40,17 @@ class CommentsController < ApplicationController
|
|||||||
#@comments = Comment.where(file_id: params[:file_id])
|
#@comments = Comment.where(file_id: params[:file_id])
|
||||||
|
|
||||||
#add names to comments
|
#add names to comments
|
||||||
@comments.map{|comment| comment.username = Xikolo::UserClient.get(comment.user_id.to_s)[:display_name]}
|
# if the user is internal, set the name
|
||||||
|
# todo:
|
||||||
|
# if the user is external, fetch the displayname from xikolo
|
||||||
|
@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
|
||||||
|
#alternativ: Xikolo::UserClient.get(comment.user_id.to_s)[:display_name]
|
||||||
|
end
|
||||||
|
}
|
||||||
else
|
else
|
||||||
@comments = Comment.all.limit(0) #we need an empty relation here
|
@comments = Comment.all.limit(0) #we need an empty relation here
|
||||||
end
|
end
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
<%= InternalUser.find(@request_for_comment.requestorid) %> | <%= @request_for_comment.requested_at %>
|
<%= InternalUser.find(@request_for_comment.requestorid) %> | <%= @request_for_comment.requested_at %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<!--
|
|
||||||
-->
|
|
||||||
|
|
||||||
<div id='commentitor' class='editor' data-read-only='true' data-file-id='<%=@request_for_comment.fileid%>'>
|
<!--
|
||||||
<%= CodeOcean::File.find(@request_for_comment.fileid).content %>
|
do not put a carriage return in the line below. it will be present in the presentation of the source code, otherwise.
|
||||||
|
-->
|
||||||
|
<div id='commentitor' class='editor' data-read-only='true' data-file-id='<%=@request_for_comment.fileid%>'><%= CodeOcean::File.find(@request_for_comment.fileid).content %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
Reference in New Issue
Block a user