allow you to Send To yourself
seems like it could be useful ¯\_(ツ)_/¯ test plan: - enable direct share - use "Send To" on some item and include yourself in the recipients - ensure the item appears in your received content, and you can import it into a course (or the course it came from, to in effect restore it from a backup) closes LS-1686 flag = none Change-Id: I979302cdd2ae730622a2d76efd7c34d1a1f0e898 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/254562 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Product-Review: Peyton Craighill <pcraighill@instructure.com> Reviewed-by: Nate Armstrong <narmstrong@instructure.com> QA-Review: Nate Armstrong <narmstrong@instructure.com>
This commit is contained in:
parent
e0b6115162
commit
64bffc8c00
|
@ -282,11 +282,6 @@ class ContentSharesController < ApplicationController
|
|||
return false
|
||||
end
|
||||
|
||||
if @receivers.include?(@current_user)
|
||||
render(json: { message: 'You cannot share with yourself' }, status: :bad_request)
|
||||
return false
|
||||
end
|
||||
|
||||
# TODO verify we're allowed to send content to these users, once we decide how to do that
|
||||
end
|
||||
|
||||
|
|
|
@ -1125,7 +1125,7 @@ class CoursesController < ApplicationController
|
|||
reject!('Search term required') unless params[:search_term]
|
||||
return unless authorized_action(@context, @current_user, :read_as_admin)
|
||||
|
||||
users_scope = User.shard(Shard.current).where.not(id: @current_user.id).active.distinct
|
||||
users_scope = User.shard(Shard.current).active.distinct
|
||||
union_scope = teacher_scope(name_scope(users_scope), @context.root_account_id).
|
||||
union(
|
||||
teacher_scope(email_scope(users_scope), @context.root_account_id),
|
||||
|
|
|
@ -272,11 +272,13 @@ describe ContentSharesController do
|
|||
expect(@sent_share.receivers.pluck(:id)).to match_array([@teacher_2.id, @teacher_3.id])
|
||||
end
|
||||
|
||||
it "disallows sharing with yourself" do
|
||||
it "allows sharing with yourself, because why not" do
|
||||
user_session @teacher_1
|
||||
post :add_users, params: { user_id: @teacher_1.id, id: @sent_share.id, receiver_ids: [@teacher_1.id, @teacher_3.id] }
|
||||
expect(response).to have_http_status(:bad_request)
|
||||
expect(response.body).to include 'You cannot share with yourself'
|
||||
expect(response).to be_successful
|
||||
json = JSON.parse(response.body.sub(/^while\(1\);/, ''))
|
||||
expect(json['receivers'].map { |r| r['id'] }).to match_array([@teacher_1.id, @teacher_2.id, @teacher_3.id])
|
||||
expect(@sent_share.receivers.pluck(:id)).to match_array([@teacher_1.id, @teacher_2.id, @teacher_3.id])
|
||||
end
|
||||
|
||||
it "complains if no valid users are included" do
|
||||
|
|
|
@ -3045,13 +3045,13 @@ describe CoursesController do
|
|||
expect(json.map{|user| user['name']}).not_to include('account admin', 'sub-account admin')
|
||||
end
|
||||
|
||||
it 'should not return the searching user' do
|
||||
it 'should return the searching user' do
|
||||
user_session(@teacher)
|
||||
@search_context = @course
|
||||
course_with_teacher(name: 'course teacher')
|
||||
get 'content_share_users', params: {course_id: @search_context.id, search_term: 'teacher'}
|
||||
json = json_parse(response.body)
|
||||
expect(json.map{|user| user['name']}).to match_array(['course teacher'])
|
||||
expect(json.map{|user| user['name']}).to match_array(['course teacher', 'search teacher'])
|
||||
end
|
||||
|
||||
it 'should not return admin roles that do not have the "manage_content" permission' do
|
||||
|
|
Loading…
Reference in New Issue