only show courses and groups in conversation dropdown
fixes #6091 Test plan: After creating a course with student groups and course sections, click on the link to "Inbox" to create a new conversation. Clicking the addressbook icon in the "To" field should only show Courses and Student Groups in the top level (no course sections). You should still be able to search for Course Sections. Change-Id: I40b58d8a6255bbd59c58c6e1a64a66897b6c4727 Reviewed-on: https://gerrit.instructure.com/7061 Tested-by: Hudson <hudson@instructure.com> Reviewed-by: Jon Jensen <jon@instructure.com> Reviewed-by: Zach Pendleton <zachp@instructure.com>
This commit is contained in:
parent
40c4954d09
commit
f43f85894d
|
@ -630,7 +630,14 @@ class ConversationsController < ApplicationController
|
|||
|
||||
result = []
|
||||
if context_name.nil?
|
||||
result = @contexts.values.map(&:values).flatten
|
||||
result = if params[:search].blank?
|
||||
courses = @contexts[:courses].values
|
||||
group_ids = @current_user.current_groups.map(&:id)
|
||||
groups = @contexts[:groups].slice(*group_ids).values
|
||||
courses + groups
|
||||
else
|
||||
@contexts.values.map(&:values).flatten
|
||||
end
|
||||
elsif options[:synthetic_contexts]
|
||||
if context_name =~ /\Acourse_(\d+)(_(groups|sections))?\z/ && (course = @contexts[:courses][$1.to_i]) && course[:active]
|
||||
course = Course.find_by_id(course[:id])
|
||||
|
|
|
@ -91,7 +91,7 @@ shared_examples_for "conversations selenium tests" do
|
|||
@course.enroll_user(s2, "StudentEnrollment", :section => @other_section)
|
||||
|
||||
@group = @course.groups.create(:name => "the group")
|
||||
@group.users << s1
|
||||
@group.users << s1 << @user
|
||||
|
||||
new_conversation
|
||||
@input = find_with_jquery("#create_message_form input:visible")
|
||||
|
@ -173,7 +173,7 @@ shared_examples_for "conversations selenium tests" do
|
|||
it "should allow browsing" do
|
||||
browse_menu
|
||||
|
||||
menu.should eql ["the course", "the group", "the other section", "the section"]
|
||||
menu.should eql ["the course", "the group"]
|
||||
browse "the course" do
|
||||
menu.should eql ["Everyone", "Teachers", "Students", "Course Sections", "Student Groups"]
|
||||
browse("Everyone") { menu.should eql ["Select All", "nobody@example.com", "student 1", "student 2"] }
|
||||
|
@ -194,27 +194,17 @@ shared_examples_for "conversations selenium tests" do
|
|||
end
|
||||
browse "Student Groups" do
|
||||
menu.should eql ["the group"]
|
||||
browse("the group") { menu.should eql ["student 1"] }
|
||||
browse("the group") { menu.should eql ["Select All", "nobody@example.com", "student 1"] }
|
||||
end
|
||||
end
|
||||
browse("the group") { menu.should eql ["student 1"] }
|
||||
browse "the other section" do
|
||||
menu.should eql ["Students"]
|
||||
browse("Students") { menu.should eql ["student 2"] }
|
||||
end
|
||||
browse "the section" do
|
||||
menu.should eql ["Everyone", "Teachers", "Students"]
|
||||
browse("Everyone") { menu.should eql ["Select All", "nobody@example.com", "student 1"] }
|
||||
browse("Teachers") { menu.should eql ["nobody@example.com"] }
|
||||
browse("Students") { menu.should eql ["student 1"] }
|
||||
end
|
||||
browse("the group") { menu.should eql ["Select All", "nobody@example.com", "student 1"] }
|
||||
end
|
||||
|
||||
it "should check already-added tokens when browsing" do
|
||||
browse_menu
|
||||
|
||||
browse("the group") do
|
||||
menu.should eql ["student 1"]
|
||||
menu.should eql ["Select All", "nobody@example.com", "student 1"]
|
||||
toggle "student 1"
|
||||
tokens.should eql ["student 1"]
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue