Remove commons_favorites flag

closes LF-313
flag = none

Test plan:
 (Requires commons to be installed)
 - Go to the modules page
 - Click the menu icon next to a module item; choose Share to Commons
 - Expect to be able to share item to commons
 - Mark it as a favorite in commons
 - Click the menu icon in the modules header; choose Commons Favorites
 - Expect to be able to import the item back to canvas
 - Repeat for pages, assignments, quizzes, files, and discussions

Change-Id: I7bf6027eef845142cfd5cc5c86c8cd725e0bdf40
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/318807
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
This commit is contained in:
Jackson Howe 2023-05-22 16:21:46 -06:00
parent a1b890b07f
commit 601bff6e52
15 changed files with 14 additions and 80 deletions

View File

@ -2878,16 +2878,8 @@ class ApplicationController < ActionController::Base
HAS_GRADING_PERIODS: @context.grading_periods?,
VALID_DATE_RANGE: CourseDateRange.new(@context),
assignment_menu_tools: external_tools_display_hashes(:assignment_menu),
assignment_index_menu_tools: (if @domain_root_account&.feature_enabled?(:commons_favorites)
external_tools_display_hashes(:assignment_index_menu)
else
[]
end),
assignment_group_menu_tools: (if @domain_root_account&.feature_enabled?(:commons_favorites)
external_tools_display_hashes(:assignment_group_menu)
else
[]
end),
assignment_index_menu_tools: external_tools_display_hashes(:assignment_index_menu),
assignment_group_menu_tools: external_tools_display_hashes(:assignment_group_menu),
discussion_topic_menu_tools: external_tools_display_hashes(:discussion_topic_menu),
quiz_menu_tools: external_tools_display_hashes(:quiz_menu),
current_user_has_been_observer_in_this_course: current_user_has_been_observer_in_this_course,

View File

@ -117,12 +117,6 @@ class ContextModulesController < ApplicationController
@menu_tools[p] = tools.select { |t| t.has_placement? p }
end
# only show tray tools when feature flag is enabled
unless @domain_root_account&.feature_enabled?(:commons_favorites)
@menu_tools[:module_index_menu] = []
@menu_tools[:module_group_menu] = []
end
if @context.grants_any_right?(@current_user, session, :manage_content, *RoleOverride::GRANULAR_MANAGE_COURSE_CONTENT_PERMISSIONS)
module_file_details = load_module_file_details
end

View File

@ -427,11 +427,7 @@ class DiscussionTopicsController < ApplicationController
discussion_topic_menu_tools: external_tools_display_hashes(:discussion_topic_menu),
student_reporting_enabled: @context.feature_enabled?(:react_discussions_post),
discussion_anonymity_enabled: @context.feature_enabled?(:react_discussions_post),
discussion_topic_index_menu_tools: (if @domain_root_account&.feature_enabled?(:commons_favorites)
external_tools_display_hashes(:discussion_topic_index_menu)
else
[]
end),
discussion_topic_index_menu_tools: external_tools_display_hashes(:discussion_topic_index_menu),
show_additional_speed_grader_links: Account.site_admin.feature_enabled?(:additional_speedgrader_links),
}
if @context.is_a?(Course) && @context.grants_right?(@current_user, session, :read) && @js_env&.dig(:COURSE_ID).blank?

View File

@ -411,7 +411,7 @@ class FilesController < ApplicationController
has_external_tools = !context.is_a?(Group) && tool_context
file_menu_tools = (has_external_tools ? external_tools_display_hashes(:file_menu, tool_context, [:accept_media_types]) : [])
file_index_menu_tools = if has_external_tools && @domain_root_account&.feature_enabled?(:commons_favorites)
file_index_menu_tools = if has_external_tools
external_tools_display_hashes(:file_index_menu, tool_context)
else
[]

View File

@ -145,11 +145,7 @@ class Quizzes::QuizzesController < ApplicationController
DIRECT_SHARE_ENABLED: @context.grants_right?(@current_user, session, :direct_share)
},
quiz_menu_tools: external_tools_display_hashes(:quiz_menu),
quiz_index_menu_tools: (if @domain_root_account&.feature_enabled?(:commons_favorites)
external_tools_display_hashes(:quiz_index_menu)
else
[]
end),
quiz_index_menu_tools: external_tools_display_hashes(:quiz_index_menu),
SIS_NAME: sis_name,
MAX_NAME_LENGTH: max_name_length,
DUE_DATE_REQUIRED_FOR_ACCOUNT: due_date_required_for_account,

View File

@ -166,10 +166,9 @@ class WikiPagesController < ApplicationController
def wiki_pages_js_env(context)
set_k5_mode # we need this to run now, even though we haven't hit the render hook yet
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: wiki_index_menu_tools,
wiki_index_menu_tools: external_tools_display_hashes(:wiki_index_menu),
DISPLAY_SHOW_ALL_LINK: tab_enabled?(context.class::TAB_PAGES, { no_render: true }) && !@k5_details_view,
CAN_SET_TODO_DATE: context.grants_any_right?(@current_user, session, :manage_content, :manage_course_content_edit)
}

View File

@ -65,12 +65,6 @@ common_cartridge_page_conversion:
description: If enabled, Common Cartridge importers will convert HTML files into
Pages
applies_to: Course
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.
compact_live_event_payloads:
state: allowed
applies_to: RootAccount

View File

@ -167,20 +167,8 @@ describe ContextModulesController do
subject
end
context "when commons favorites FF is off" do
it "ignores tray placement tools" do
expect(tool_definitions[:module_index_menu]).to eq []
end
end
context "when commons favorites FF is on" do
before :once do
@course.root_account.enable_feature! :commons_favorites
end
it "sends tray placement tool definitions" do
expect(tool_definitions[:module_index_menu].first[:id]).to eq tool.id
end
it "sends tray placement tool definitions" do
expect(tool_definitions[:module_index_menu].first[:id]).to eq tool.id
end
it "sends modal placement tool definitions" do

View File

@ -74,25 +74,11 @@ 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
it "js_env has placements for Commons Favorites Import" do
allow(controller).to receive(:external_tools_display_hashes).and_return(["tool 1", "tool 2"])
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
context "when K5 mode is enabled and user is a student" do

View File

@ -40,8 +40,6 @@ describe "assignments index menu tool placement" do
@course.assignments.create(name: "test assignment", assignment_group: @agroup1)
@assignment1 = @course.assignments.first
@agroup2 = @course.assignment_groups.create!(name: "assignments group2")
Account.default.enable_feature!(:commons_favorites)
end
it "is able to launch the index menu tool via the tray", custom_timeout: 30 do

View File

@ -35,8 +35,6 @@ describe "context modules" do
@tool.save!
@module1 = @course.context_modules.create!(name: "module1")
@module2 = @course.context_modules.create!(name: "module2")
Account.default.enable_feature!(:commons_favorites)
end
it "is able to launch the index menu tool via the tray", custom_timeout: 30 do

View File

@ -88,12 +88,11 @@ describe "course wiki pages" do
end
end
context "with commons fav FF ON" do
context "commons favorites" do
before do
@tool = Account.default.context_external_tools.new(name: "a", domain: "google.com", consumer_key: "12345", shared_secret: "secret")
@tool.wiki_index_menu = { url: "http://www.example.com", text: "Commons Fav" }
@tool.save!
Account.default.enable_feature!(:commons_favorites)
course_with_teacher_logged_in
@course.save!
user_session(@teacher)

View File

@ -28,8 +28,6 @@ describe "discussion index menu tool placement" do
@tool = Account.default.context_external_tools.new(name: "a", domain: "google.com", consumer_key: "12345", shared_secret: "secret")
@tool.discussion_topic_index_menu = { url: "http://www.example.com", text: "Import Stuff" }
@tool.save!
Account.default.enable_feature!(:commons_favorites)
end
it "is able to launch the index menu tool via the tray", custom_timeout: 60 do

View File

@ -29,8 +29,6 @@ describe "files page with tools" do
@tool = Account.default.context_external_tools.new(name: "a", domain: "google.com", consumer_key: "12345", shared_secret: "secret")
@tool.file_index_menu = { url: "http://www.example.com", text: "Import Stuff" }
@tool.save!
Account.default.enable_feature!(:commons_favorites)
end
it "is able to launch the index menu tool via the tray", custom_timeout: 60 do

View File

@ -29,8 +29,6 @@ describe "quiz index menu tool placement" do
@tool = Account.default.context_external_tools.new(name: "a", domain: "google.com", consumer_key: "12345", shared_secret: "secret")
@tool.quiz_index_menu = { url: "http://www.example.com", text: "Import Stuff" }
@tool.save!
Account.default.enable_feature!(:commons_favorites)
end
it "is able to launch the index menu tool via the tray", custom_timeout: 60 do