Remove "Duplicating Objects" feature flag.

Closes FALCOR-233

Test Plan:
* Go to Account->Settings->Feature Options. There should now not
  be any setting for "Duplicate Objects"
* It should still be possible to duplicate assignments and wiki
  pages (except for discussion topics and quizzes)

Change-Id: Ib75ebdbc7852e1e11e455e4c72633b6bc9d64385
Reviewed-on: https://gerrit.instructure.com/116813
Tested-by: Jenkins
Reviewed-by: Steven Burnett <sburnett@instructure.com>
QA-Review: Dan Sasaki <dsasaki@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
This commit is contained in:
Venk Natarajan 2017-06-23 14:03:42 -06:00 committed by Dan Minkevitch
parent 0cbc08777d
commit 51a8d87c45
10 changed files with 137 additions and 213 deletions

View File

@ -274,7 +274,7 @@ define [
canDuplicate: ->
# For now, forbid duplicating quizzes. We will implement that later.
(@userIsAdmin || @canManage()) && ENV.DUPLICATE_ENABLED && @isDuplicableAssignment()
(@userIsAdmin || @canManage()) && @isDuplicableAssignment()
canMove: ->
@userIsAdmin or (@canManage() and @model.canMove())

View File

@ -59,7 +59,6 @@ define [
json.CAN =
MANAGE: !!@WIKI_RIGHTS.manage
PUBLISH: !!@WIKI_RIGHTS.manage && @contextName == 'courses'
DUPLICATE: !!ENV.DUPLICATE_ENABLED
json.cannot_edit_by_master_course = json.is_master_course_child_content && json.restricted_by_master_course

View File

@ -603,10 +603,6 @@ class AssignmentsApiController < ApplicationController
return unless authorized_action(old_assignment, @current_user, :create)
if !@context.root_account.feature_enabled?(:duplicate_objects)
return render json: { error: 'duplicating objects not enabled' }, status: 400
end
new_assignment = old_assignment.duplicate
new_assignment.save!
render :json => assignment_json(new_assignment, @current_user, session)

View File

@ -63,7 +63,6 @@ class AssignmentsController < ApplicationController
HAS_ASSIGNMENTS: @context.active_assignments.count > 0,
QUIZ_LTI_ENABLED: @context.quiz_lti_tool.present?,
DUE_DATE_REQUIRED_FOR_ACCOUNT: due_date_required_for_account,
DUPLICATE_ENABLED: @domain_root_account.feature_enabled?(:duplicate_objects)
}
js_env(hash)

View File

@ -171,10 +171,6 @@ class WikiPagesApiController < ApplicationController
# @returns the page that was created
def duplicate
return unless authorized_action(@page, @current_user, :create)
if !@context.root_account.feature_enabled?(:duplicate_objects)
return render json: { error: 'duplicating objects not enabled' }, status: :bad_request
end
if @page.deleted?
return render json: { error: 'cannot duplicate deleted page' }, status: :bad_request
end

View File

@ -79,10 +79,6 @@ class WikiPagesController < ApplicationController
end
js_env :wiki_page_menu_tools => external_tools_display_hashes(:wiki_page_menu)
set_tutorial_js_env
hash = {
DUPLICATE_ENABLED: @domain_root_account.feature_enabled?(:duplicate_objects)
}
js_env(hash)
@padless = true
end
end

View File

@ -35,7 +35,7 @@
</a>
</li>
{{/unless}}
{{#if CAN.DUPLICATE}}
{{#if CAN.MANAGE}}
<li>
<a href="#" class="icon-copy-course duplicate-wiki-page" title="{{#t}}Duplicate{{/t}}">
{{#t}}Duplicate{{/t}}

View File

@ -253,15 +253,6 @@ END
root_opt_in: true,
beta: true
},
'duplicate_objects' =>
{
display_name: -> { I18n.t('Duplicate Objects') },
description: -> { I18n.t("Allows the duplicating of objects in Canvas") },
applies_to: 'Account',
state: 'hidden',
root_opt_in: true,
beta: true
},
'allow_opt_out_of_inbox' =>
{
display_name: -> { I18n.t('features.allow_opt_out_of_inbox', "Allow Users to Opt-out of the Inbox") },

View File

@ -925,13 +925,6 @@ describe AssignmentsApiController, type: :request do
student_in_course(active_all: true)
end
describe 'duplicating enabled' do
before :once do
a = @course.account
a.enable_feature!(:duplicate_objects)
a.save!
end
it "students cannot duplicate" do
assignment = @course.assignments.create(
:title => "some assignment",
@ -1051,27 +1044,6 @@ describe AssignmentsApiController, type: :request do
end
end
it 'should not duplicate if feature disabled' do
a = @course.account
a.disable_feature!(:duplicate_objects)
a.save!
assignment = @course.assignments.create(
:title => "some assignment",
:assignment_group => @group,
:due_at => Time.zone.now + 1.week
)
api_call_as_user(@teacher, :post,
"/api/v1/courses/#{@course.id}/assignments/#{assignment.id}/duplicate.json",
{ :controller => "assignments_api",
:action => "duplicate",
:format => "json", :course_id => @course.id.to_s,
:assignment_id => assignment.id.to_s },
{},
{},
{ :expected_status => 400 })
end
end
describe "POST /courses/:course_id/assignments (#create)" do
def create_assignment_json(group, group_category)
{ 'name' => 'some assignment',

View File

@ -34,13 +34,6 @@ describe WikiPagesApiController, type: :request do
wiki_page_model({ :title => "Wiki Page" })
end
describe 'duplicate feature enabled' do
before :once do
a = @course.account
a.enable_feature!(:duplicate_objects)
a.save!
end
it "returns unauthorized if not a teacher" do
api_call_as_user(@student, :post,
"/api/v1/courses/#{@course.id}/pages/#{@page.url}/duplicate.json",
@ -83,22 +76,4 @@ describe WikiPagesApiController, type: :request do
expect(json["title"]).to eq "Assignment Wiki Copy"
end
end
it 'duplicate feature disabled' do
a = @course.account
a.disable_feature!(:duplicate_objects)
a.save!
wiki_page_assignment_model({ :title => "Assignment Wiki" })
api_call_as_user(@teacher, :post,
"/api/v1/courses/#{@course.id}/pages/#{@page.url}/duplicate.json",
{ :controller => "wiki_pages_api",
:action => "duplicate",
:format => "json",
:course_id => @course.id.to_s,
:url => @page.url },
{},
{},
{ :expected_status => 400 })
end
end
end