do not open edit form for users without perm
flag=bbb_modal_update fixes VICE-3144 test plan: - do test with flag ON and OFF - or really, just look at the new specs - visit /courses/:id/conferences/:id_of_conference as a teacher - verify its edit form is auto opened for you - now do it as an invited student - verify edit form is not opened but conference list is scrolled to your conference Change-Id: I94403682065374b3e74d95be6671709a984002b4 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/301713 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com> Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com> QA-Review: Jason Gillett <jason.gillett@instructure.com>
This commit is contained in:
parent
6d01a7a889
commit
8d59f403b8
|
@ -61,6 +61,27 @@ describe "BigBlueButton conferences" do
|
|||
Account.site_admin.enable_feature! :bbb_modal_update
|
||||
end
|
||||
|
||||
context "when a conference exists" do
|
||||
before do
|
||||
@conf = create_big_blue_button_conference
|
||||
@conf.add_invitee(@ta)
|
||||
@conf.add_invitee(@student)
|
||||
@conf.save!
|
||||
end
|
||||
|
||||
it "opens edit form when conference id is in url for teachers" do
|
||||
get "/courses/#{@course.id}/conferences/#{@conf.id}"
|
||||
expect(fj("span:contains('Edit')")).to be_present
|
||||
end
|
||||
|
||||
it "does not open edit form when conference id is in url for students" do
|
||||
user_session @student
|
||||
get "/courses/#{@course.id}/conferences/#{@conf.id}"
|
||||
expect(f("button[title='New Conference']")).to be_present
|
||||
expect(f("body")).not_to contain_jqcss("span:contains('Edit')")
|
||||
end
|
||||
end
|
||||
|
||||
it "validates name length" do
|
||||
initial_conference_count = WebConference.count
|
||||
get conferences_index_page
|
||||
|
@ -249,8 +270,25 @@ describe "BigBlueButton conferences" do
|
|||
Account.site_admin.disable_feature! :bbb_modal_update
|
||||
end
|
||||
|
||||
before do
|
||||
get conferences_index_page
|
||||
context "on a conference that exists" do
|
||||
before do
|
||||
@conf = create_big_blue_button_conference
|
||||
@conf.add_invitee(@ta)
|
||||
@conf.add_invitee(@student)
|
||||
@conf.save!
|
||||
end
|
||||
|
||||
it "opens edit form when conference id is in url for teachers" do
|
||||
get "/courses/#{@course.id}/conferences/#{@conf.id}"
|
||||
expect(fj("span:contains('Edit')")).to be_present
|
||||
end
|
||||
|
||||
it "does not open edit form when conference id is in url for students" do
|
||||
user_session @student
|
||||
get "/courses/#{@course.id}/conferences/#{@conf.id}"
|
||||
expect(f("button[title='New Conference']")).to be_present
|
||||
expect(f("body")).not_to contain_jqcss("span:contains('Edit')")
|
||||
end
|
||||
end
|
||||
|
||||
context "when a conference is open" do
|
||||
|
@ -263,6 +301,7 @@ describe "BigBlueButton conferences" do
|
|||
end
|
||||
|
||||
it "does not include list with recordings", priority: "2" do
|
||||
get conferences_index_page
|
||||
verify_conference_does_not_include_recordings
|
||||
end
|
||||
end
|
||||
|
@ -276,6 +315,7 @@ describe "BigBlueButton conferences" do
|
|||
end
|
||||
|
||||
it "includes list with recordings", priority: "2" do
|
||||
get conferences_index_page
|
||||
verify_conference_includes_recordings
|
||||
end
|
||||
end
|
||||
|
@ -292,6 +332,7 @@ describe "BigBlueButton conferences" do
|
|||
end
|
||||
|
||||
it "removes recording from the list", priority: "2" do
|
||||
get conferences_index_page
|
||||
show_recordings_in_first_conference_in_list
|
||||
delete_first_recording_in_first_conference_in_list
|
||||
verify_conference_does_not_include_recordings
|
||||
|
|
|
@ -225,7 +225,12 @@ const ConferencesRouter = Backbone.Router.extend({
|
|||
conference =
|
||||
this.currentConferences.get(conference) || this.concludedConferences.get(conference)
|
||||
if (!conference) return
|
||||
|
||||
if (!conference.get('permissions').update) {
|
||||
// reached when a user without edit permissions navigates
|
||||
// to a specific conference's url directly
|
||||
$(`#conf_${conference.get('id')}`)[0].scrollIntoView()
|
||||
return
|
||||
}
|
||||
if (ENV.bbb_modal_update) {
|
||||
const {attributes} = conference
|
||||
const options = []
|
||||
|
@ -380,13 +385,8 @@ const ConferencesRouter = Backbone.Router.extend({
|
|||
document.getElementById('react-conference-modal-container')
|
||||
)
|
||||
} else {
|
||||
if (conference.get('permissions').update) {
|
||||
this.editConferenceId = conference.get('id')
|
||||
this.editView.show(conference, {isEditing: true})
|
||||
}
|
||||
// reached when a user without edit permissions navigates
|
||||
// to a specific conference's url directly
|
||||
$(`#conf_${conference.get('id')}`)[0].scrollIntoView()
|
||||
this.editConferenceId = conference.get('id')
|
||||
this.editView.show(conference, {isEditing: true})
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue