diff --git a/lib/api/v1/submission_comment.rb b/lib/api/v1/submission_comment.rb index 4c41b234b8b..6fe302c8e2a 100644 --- a/lib/api/v1/submission_comment.rb +++ b/lib/api/v1/submission_comment.rb @@ -37,6 +37,9 @@ module Api::V1::SubmissionComment if submission_comment.grants_right?(@current_user, :read_author) sc_hash['author'] = user_display_json(submission_comment.author, submission_comment.context) else + if sc_hash.delete('avatar_path') + sc_hash['avatar_path'] = User.default_avatar_fallback + end sc_hash.merge!({ author: {}, author_id: nil, diff --git a/spec/apis/v1/peer_reviews_api_spec.rb b/spec/apis/v1/peer_reviews_api_spec.rb index 49daf94da17..c4a72d614d7 100644 --- a/spec/apis/v1/peer_reviews_api_spec.rb +++ b/spec/apis/v1/peer_reviews_api_spec.rb @@ -383,6 +383,7 @@ describe PeerReviewsApiController, type: :request do it 'should not include submission comments user information when anonymous peer reviews' do + @course.root_account.tap{|a| a.enable_service(:avatars)}.save! @assignment1.update_attribute(:anonymous_peer_reviews, true) @comment = @submission.add_comment(:author => @student2, :comment => "review comment") @user = @student1 @@ -393,6 +394,7 @@ describe PeerReviewsApiController, type: :request do "id"=>@assessment_request.id, "submission_comments" => [{"author_id"=>nil, "author_name"=>"Anonymous User", + 'avatar_path' => User.default_avatar_fallback, "comment"=>"review comment", "created_at"=>@comment.created_at.as_json, "id"=>@comment.id,