add feature flag for commons favorites imports

closes LA-9
flag=none

test plan:
 - when commons_import is off, does not show in wiki page index menu
 - when flag is on and Commons LTI is installed for wiki_index_menu
   placement, it shows up

Change-Id: Ie0ce5748f9c61ee4eef19a55712eea49582eea4e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/216046
Tested-by: Jenkins
Tested-by: Carl Kibler <ckibler@instructure.com>
QA-Review: Jon Willesen <jonw+gerrit@instructure.com>
Product-Review: Carl Kibler <ckibler@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
This commit is contained in:
ckibler 2019-11-05 14:21:48 -08:00 committed by Carl Kibler
parent cf928b37cd
commit 252574f3a4
3 changed files with 29 additions and 1 deletions

View File

@ -163,9 +163,10 @@ class WikiPagesController < ApplicationController
private
def wiki_pages_js_env(context)
wiki_index_menu_tools = @domain_root_account&.feature_enabled?(:commons_favorites) ? external_tools_display_hashes(:wiki_index_menu) : []
@wiki_pages_env ||= {
:wiki_page_menu_tools => external_tools_display_hashes(:wiki_page_menu),
:wiki_index_menu_tools => external_tools_display_hashes(:wiki_index_menu),
:wiki_index_menu_tools => wiki_index_menu_tools,
:DISPLAY_SHOW_ALL_LINK => tab_enabled?(context.class::TAB_PAGES, {no_render: true}),
:STUDENT_PLANNER_ENABLED => context.root_account.feature_enabled?(:student_planner),
:IMMERSIVE_READER_ENABLED => @domain_root_account&.feature_enabled?(:immersive_reader_wiki_pages),

View File

@ -454,3 +454,9 @@ unfavorite_course_from_dashboard:
description: This allows the user to unfavorite a course directly from its
dashboard card.
root_opt_in: true
commons_favorites:
state: hidden
applies_to: RootAccount
display_name: Import Commons Favorites
description: If Commons is installed, allows importing favorited content
items from within Canvas.

View File

@ -149,6 +149,27 @@ describe WikiPagesController do
end
end
context "placements for Commons Favorites Import" do
before do
allow(controller).to receive(:external_tools_display_hashes).and_return(["tool 1", "tool 2"])
end
it "js_env has no placements when feature is disabled" do
@course.root_account.disable_feature! :commons_favorites
get 'show', params: {course_id: @course.id, id: @page.url}
expect(response).to be_successful
expect(controller.external_tools_display_hashes(:wiki_index_menu)).to eq ["tool 1", "tool 2"]
expect(controller.js_env[:wiki_index_menu_tools]).to eq []
end
it "js_env has placements when feature is enabled" do
@course.root_account.enable_feature! :commons_favorites
get 'show', params: {course_id: @course.id, id: @page.url}
expect(response).to be_successful
expect(controller.js_env[:wiki_index_menu_tools]).to eq ["tool 1", "tool 2"]
end
end
context "differentiated assignments" do
before do
assignment = @course.assignments.create!(