Remove student planner feature flag

Test plan:
-verify planner is always enabled when a student has an enrollment

flag=none

fixes VICE-331

Change-Id: I6ffb90de94737d01afbac36eee0f36a967ace179
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/242462
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
This commit is contained in:
Drake Harper 2020-07-13 07:34:57 -06:00
parent f8cc3c64ed
commit 6d2e121d6b
46 changed files with 26 additions and 147 deletions

View File

@ -495,7 +495,7 @@ export default class EventDataSource {
if (ENV.STUDENT_PLANNER_ENABLED) {
eventDataSources.push(['/api/v1/planner_notes', params])
}
if (ENV.PLANNER_ENABLED) {
if (ENV.CALENDAR && ENV.CALENDAR.MANAGE_CONTEXTS) {
const [admin_contexts, student_contexts] = _.partition(
params.context_codes,
cc => ENV.CALENDAR.MANAGE_CONTEXTS.indexOf(cc) >= 0

View File

@ -25,9 +25,9 @@ export default class WikiPageCollection extends PaginatedCollection {
this.sortOrders = {
title: 'asc',
created_at: 'desc',
updated_at: 'desc'
updated_at: 'desc',
todo_date: 'desc'
}
if (ENV.STUDENT_PLANNER_ENABLED) this.sortOrders.todo_date = 'desc'
this.setSortField('title')
// remove the front_page indicator on all other models when one is set

View File

@ -208,7 +208,7 @@ export default class EditView extends ValidatedFormView
this
afterRender: =>
@renderStudentTodoAtDate() if ENV.STUDENT_PLANNER_ENABLED && @$todoDateInput.length
@renderStudentTodoAtDate() if @$todoDateInput.length
[context, context_id] = ENV.context_asset_string.split("_")
if context == 'course'
@AssignmentExternalTools = AssignmentExternalTools.attach(
@ -315,7 +315,7 @@ export default class EditView extends ValidatedFormView
data.only_graders_can_rate = false unless data.allow_rating is '1'
data.sort_by_rating = false unless data.allow_rating is '1'
data.allow_todo_date = '0' if data.assignment?.set_assignment is '1'
data.todo_date = @studentTodoAtDateValue if ENV.STUDENT_PLANNER_ENABLED
data.todo_date = @studentTodoAtDateValue
data.todo_date = null unless data.allow_todo_date is '1'
if @groupCategorySelector && !ENV?.IS_LARGE_ROSTER

View File

@ -313,9 +313,6 @@ export default class WikiPageIndexView extends PaginatedCollectionView {
}
collectionHasTodoDate() {
if (!ENV.STUDENT_PLANNER_ENABLED) {
return false
}
return !!this.collection.find(m => m.has('todo_date'))
}

View File

@ -464,8 +464,6 @@ class AssignmentsController < ApplicationController
hash = {
CONTEXT_ACTION_SOURCE: :syllabus,
# don't check for student enrollments because we want this to show for the teacher as well
STUDENT_PLANNER_ENABLED: @domain_root_account&.feature_enabled?(:student_planner)
}
append_sis_data(hash)
js_env(hash)

View File

@ -2000,8 +2000,6 @@ class CoursesController < ApplicationController
@course_home_view ||= default_view
js_env({
# don't check for student enrollments because we want to show course items on the teacher's syllabus
STUDENT_PLANNER_ENABLED: @domain_root_account&.feature_enabled?(:student_planner),
COURSE: {
id: @context.id.to_s,
pages_url: polymorphic_url([@context, :wiki_pages]),

View File

@ -562,9 +562,7 @@ class DiscussionTopicsController < ApplicationController
if post_to_sis && @topic.new_record?
js_hash[:POST_TO_SIS_DEFAULT] = @context.account.sis_default_grade_export[:value]
end
if @context.root_account.feature_enabled?(:student_planner)
js_hash[:STUDENT_PLANNER_ENABLED] = @context.grants_any_right?(@current_user, session, :manage_content)
end
if @topic.is_section_specific && @context.is_a?(Course)
selected_section_ids = @topic.discussion_topic_section_visibilities.pluck(:course_section_id)
@ -1203,7 +1201,7 @@ class DiscussionTopicsController < ApplicationController
process_group_parameters(discussion_topic_hash)
process_pin_parameters(discussion_topic_hash)
process_todo_parameters(discussion_topic_hash)
process_todo_parameters()
if @errors.present?
render :json => {errors: @errors}, :status => :bad_request
@ -1268,11 +1266,7 @@ class DiscussionTopicsController < ApplicationController
end
end
def process_todo_parameters(discussion_topic_hash)
unless @topic.context.root_account.feature_enabled?(:student_planner)
discussion_topic_hash.delete(:todo_date)
return
end
def process_todo_parameters
remove_assign = ['false', false, '0'].include?(params.dig(:assignment, :set_assignment))
if params[:assignment] && !remove_assign && !params[:todo_date]
@topic.todo_date = nil

View File

@ -25,7 +25,6 @@ class PlannerController < ApplicationController
before_action :require_user, unless: :public_access?
before_action :set_user
before_action :require_planner_enabled
before_action :set_date_range
before_action :set_params, only: [:index]

View File

@ -90,7 +90,6 @@ class PlannerNotesController < ApplicationController
include Api::V1::PlannerNote
before_action :require_user
before_action :require_planner_enabled
# @API List planner notes
#

View File

@ -89,7 +89,6 @@ class PlannerOverridesController < ApplicationController
include Api::V1::PlannerOverride
before_action :require_user
before_action :require_planner_enabled
# @API List planner overrides
#

View File

@ -661,7 +661,7 @@ class WikiPagesApiController < ApplicationController
def assign_todo_date
return if params.dig(:wiki_page, :student_todo_at).nil? && params.dig(:wiki_page, :student_planner_checkbox).nil?
if @context.root_account.feature_enabled?(:student_planner) && @page.context.grants_any_right?(@current_user, session, :manage_content)
if @page.context.grants_any_right?(@current_user, session, :manage_content)
@page.todo_date = params.dig(:wiki_page, :student_todo_at) if params.dig(:wiki_page, :student_todo_at)
# Only clear out if the checkbox is explicitly specified in the request
if params[:wiki_page].key?("student_planner_checkbox") &&

View File

@ -168,8 +168,7 @@ class WikiPagesController < ApplicationController
:wiki_page_menu_tools => external_tools_display_hashes(:wiki_page_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),
:CAN_SET_TODO_DATE => context.root_account.feature_enabled?(:student_planner) && context.grants_right?(@current_user, session, :manage_content),
:CAN_SET_TODO_DATE => context.grants_right?(@current_user, session, :manage_content),
:IMMERSIVE_READER_ENABLED => context.account&.feature_enabled?(:immersive_reader_wiki_pages),
:GRANULAR_PERMISSIONS_WIKI_PAGES => context.root_account.feature_enabled?(:granular_permissions_wiki_pages),
}

View File

@ -51,6 +51,7 @@ module AccountsHelper
[
[I18n.t('Card View'), 'cards'],
[I18n.t('Recent Activity'), 'activity'],
].tap { |opts| opts << [I18n.t('List View'), 'planner'] if account.root_account.feature_enabled?(:student_planner)}
[I18n.t('List View'), 'planner']
]
end
end

View File

@ -1056,8 +1056,7 @@ module ApplicationHelper
end
def planner_enabled?
!!(@current_user && @domain_root_account&.feature_enabled?(:student_planner) &&
@current_user.has_student_enrollment?)
!!(@current_user&.has_student_enrollment?)
end
def will_paginate(collection, options = {})

View File

@ -20,7 +20,6 @@ module DashboardHelper
def user_dashboard_view
dashboard_view = @current_user&.dashboard_view
dashboard_view = 'activity' if @current_user&.preferences&.dig(:recent_activity_dashboard) && !@current_user.preferences[:dashboard_view]
dashboard_view = 'cards' if dashboard_view == 'planner' && !@current_user.account.feature_enabled?(:student_planner)
dashboard_view
end

View File

@ -42,9 +42,7 @@ if (ENV.current_user_id) {
)
}
if (ENV.STUDENT_PLANNER_ENABLED) {
collections.push(new SyllabusPlannerCollection([ENV.context_asset_string]))
}
// Perform a fetch on each collection
// The fetch continues fetching until no next link is returned

View File

@ -1876,7 +1876,7 @@ class Account < ActiveRecord::Base
# Different views are available depending on feature flags
def dashboard_views
['activity', 'cards'].tap {|views| views << 'planner' if root_account.feature_enabled?(:student_planner)}
['activity', 'cards', 'planner']
end
# Getter/Setter for default_dashboard_view account setting

View File

@ -31,8 +31,7 @@
:CONFERENCES_ENABLED => Account.site_admin.feature_enabled?(:calendar_conferences)
}
js_env({
:STUDENT_PLANNER_ENABLED => @domain_root_account&.feature_enabled?(:student_planner) && @current_user.has_student_enrollment?,
:PLANNER_ENABLED => @domain_root_account&.feature_enabled?(:student_planner)
:STUDENT_PLANNER_ENABLED => @current_user.has_student_enrollment?,
})
js_bundle :calendar2

View File

@ -25,7 +25,7 @@
# BTW if you add a new thing here, it probably needs adding to the /users/self/todo API
show_legacy_todo_list ||= false
%>
<% if !show_legacy_todo_list && @domain_root_account&.feature_enabled?(:student_planner) %>
<% if !show_legacy_todo_list %>
<div class="todo-list Sidebar__TodoListContainer"></div>
<% else
cache_opts = (contexts.present? ? {} : { :expires_in => 3.minutes })

View File

@ -78,11 +78,9 @@
<div class="show-content user_content clearfix">
<h1 class="page-title">{{title}}</h1>
{{#if ENV.STUDENT_PLANNER_ENABLED}}
{{#if todo_date}}
<b>{{#t "wiki.todo_date"}}To-Do Date:{{/t}} {{tDateToString todo_date "date_at_time"}}</b>
{{/if}}
{{/if}}
{{#if locked_for_user}}
<div class="spinner"></div>
<div class="lock_explanation"></div>

View File

@ -296,12 +296,6 @@ new_user_tutorial:
description: Provide tutorial information for new users in a flyout tray.
applies_to: RootAccount
root_opt_in: true
student_planner:
state: 'on'
display_name: To Do List Dashboard
description: Provides users with a To Do List Dashboard option.
applies_to: RootAccount
root_opt_in: true
rubric_criterion_range:
state: allowed
display_name: Rubric Criterion Range

View File

@ -131,9 +131,7 @@ module Api::V1::DiscussionTopics
json[:sections] = sections_json(topic.course_sections, user, session, section_includes)
end
if topic.context.root_account.feature_enabled?(:student_planner)
json[:todo_date] = topic.todo_date
end
if opts[:root_topic_fields] && opts[:root_topic_fields].length > 0
# If this is called from discussion_topics_api_json then we already

View File

@ -36,9 +36,7 @@ module Api::V1::WikiPage
hash['hide_from_students'] = !hash['published'] # deprecated, but still here for now
hash['front_page'] = wiki_page.is_front_page?
hash['html_url'] = polymorphic_url([wiki_page.context, wiki_page])
if wiki_page.context.root_account.feature_enabled?(:student_planner)
hash['todo_date'] = wiki_page.todo_date
end
hash['updated_at'] = wiki_page.revised_at
if opts[:include_assignment] && wiki_page.for_assignment?

View File

@ -49,10 +49,6 @@ module PlannerApiHelper
end
end
def require_planner_enabled
render json: { message: "Feature disabled" }, status: :forbidden unless @domain_root_account.feature_enabled?(:student_planner)
end
def sync_module_requirement_done(item, user, complete)
return unless item.is_a?(ContextModuleItem)
doneable = mark_doneable_tag(item)

View File

@ -269,7 +269,6 @@ describe DiscussionTopicsController, type: :request do
end
it "should create a topic with all the bells and whistles" do
@course.root_account.enable_feature!(:student_planner)
post_at = 1.month.from_now
lock_at = 2.months.from_now
todo_date = 1.day.from_now.change(sec: 0)

View File

@ -214,8 +214,6 @@ describe "Pages API", type: :request do
end
context 'planner feature enabled' do
before(:once) { @course.root_account.enable_feature!(:student_planner) }
it 'should create a page with a todo_date' do
todo_date = Time.zone.local(2008, 9, 1, 12, 0, 0)
json = api_call(:post, "/api/v1/courses/#{@course.id}/pages",
@ -699,8 +697,7 @@ describe "Pages API", type: :request do
end
it 'should not crash updating front page if the wiki_page param is not available with student planner enabled' do
@course.root_account.enable_feature!(:student_planner)
response = api_call(:put, "/api/v1/courses/#{@course.id}/front_page",
api_call(:put, "/api/v1/courses/#{@course.id}/front_page",
{ :controller => 'wiki_pages_api', :action => 'update_front_page', :format => 'json', :course_id => @course.to_param,
:url => @hidden_page.url },
{}, {},

View File

@ -98,11 +98,6 @@ module Pact::Canvas
seed_users(opts)
@mobile_courses = seed_mobile
enable_default_developer_key!
enable_features
end
def enable_features
@account.enable_feature!(:student_planner)
end
def seed_course

View File

@ -470,7 +470,6 @@ describe AccountsController do
it "should overwrite account users' existing dashboard_view if specified" do
account_with_admin_logged_in
@subaccount = @account.sub_accounts.create!
@account.enable_feature! :student_planner
@account.save!
course_with_teacher(:account => @subaccount, :active_all => true)

View File

@ -978,26 +978,10 @@ describe DiscussionTopicsController do
end
context 'student planner' do
before do
@course.root_account.enable_feature!(:student_planner)
end
before :each do
course_topic
end
it 'js_env STUDENT_PLANNER_ENABLED is true for teachers' do
user_session(@teacher)
get :edit, params: {course_id: @course.id, id: @topic.id}
expect(assigns[:js_env][:STUDENT_PLANNER_ENABLED]).to be true
end
it 'js_env STUDENT_PLANNER_ENABLED is false for students' do
user_session(@student)
get :edit, params: {course_id: @course.id, id: @topic.id}
expect(assigns[:js_env][:STUDENT_PLANNER_ENABLED]).to be false
end
it 'should create a topic with a todo date' do
user_session(@teacher)
todo_date = 1.day.from_now.in_time_zone('America/New_York')

View File

@ -48,7 +48,6 @@ describe PlannerController do
context "as student" do
before :each do
user_session(@student)
@course.root_account.enable_feature!(:student_planner)
end
describe "GET #index" do

View File

@ -42,11 +42,6 @@ describe PlannerNotesController do
end
context "authenticated" do
before :once do
@course_1.root_account.enable_feature!(:student_planner)
@course_2.root_account.enable_feature!(:student_planner)
end
context "as student" do
before :each do
user_session(@student)

View File

@ -55,7 +55,6 @@ describe PlannerOverridesController do
context "as student" do
before :each do
user_session(@student)
@course.root_account.enable_feature!(:student_planner)
end
describe "GET #index" do

View File

@ -2184,7 +2184,6 @@ describe UsersController do
context "with student planner feature enabled" do
before(:once) do
@account = Account.default
@account.enable_feature! :student_planner
end
it "sets ENV.STUDENT_PLANNER_ENABLED to false when user has no student enrollments" do

View File

@ -74,39 +74,6 @@ describe WikiPagesController do
end
end
describe "student planner" do
before :once do
course_with_teacher(active_all: true)
@page = @course.wiki_pages.create!(title: "plan for planning the planner's planned plan... plan", body: "")
end
before do
user_session @teacher
end
context "feature enabled" do
before :once do
@course.root_account.enable_feature! :student_planner
end
describe "GET 'index" do
it "should render" do
get 'index', params: {course_id: @course.id}
expect(response).to be_successful
expect(controller.js_env[:STUDENT_PLANNER_ENABLED]).to be_truthy
end
end
describe "GET 'show" do
it "should render" do
get 'show', params: {course_id: @course.id, id: @page.url}
expect(response).to be_successful
expect(controller.js_env[:STUDENT_PLANNER_ENABLED]).to be_truthy
end
end
end
end
describe ':granular_permissions_wiki_pages in js_env' do
before do
course_with_teacher(active_all: true)

View File

@ -694,7 +694,6 @@ describe ApplicationHelper do
context "with planner enabled" do
before(:each) do
@account = Account.default
@account.enable_feature! :student_planner
end
it "returns the list of groups the user belongs to" do
@ -742,10 +741,6 @@ describe ApplicationHelper do
end
context "with student_planner feature flag enabled" do
before(:each) do
@domain_root_account.enable_feature! :student_planner
end
it "returns false when a user has no student enrollments" do
course_with_teacher(:active_all => true)
@current_user = @user

View File

@ -50,7 +50,6 @@ describe DashboardHelper do
end
it "should return 'planner' if set" do
@course.root_account.enable_feature!(:student_planner)
@current_user.dashboard_view = 'planner'
@current_user.save!
expect(user_dashboard_view).to eq 'planner'

View File

@ -73,7 +73,6 @@ describe "Api::V1::Assignment" do
end
it "includes an associated planner override when flag is passed" do
assignment.context.root_account.enable_feature!(:student_planner)
po = planner_override_model(user: user, plannable: assignment)
json = api.assignment_json(assignment, user, session,
{include_planner_override: true})

View File

@ -29,7 +29,6 @@ describe Api::V1::PlannerItem do
before :once do
course_factory active_all: true
@course.root_account.enable_feature!(:student_planner)
teacher_in_course active_all: true
@reviewer = student_in_course(course: @course, active_all: true).user

View File

@ -24,8 +24,6 @@ describe Api::V1::PlannerOverride do
before :once do
course_factory active_all: true
@course.root_account.enable_feature!(:student_planner)
student_in_course active_all: true
end

View File

@ -1805,7 +1805,6 @@ describe Account do
end
it "should add or overwrite all account users' dashboard_view preference" do
@account.enable_feature!(:student_planner)
@account.default_dashboard_view = 'planner'
@account.save!
@account.reload

View File

@ -211,7 +211,6 @@ describe "calendar2" do
context "to-do dates" do
before :once do
Account.default.enable_feature!(:student_planner)
@course = Course.create!(name: "Course 1")
@course.offer!
@student1 = User.create!(name: 'Student 1')

View File

@ -23,7 +23,6 @@ describe "calendar2" do
include Calendar2Common
before(:once) do
Account.default.enable_feature!(:student_planner)
course_with_teacher(active_all: true, new_user: true)
@student1 = User.create!(name: 'Student 1')
@course.enroll_student(@student1).accept!

View File

@ -23,7 +23,6 @@ describe "student planner" do
include PlannerPageObject
before :once do
Account.default.enable_feature!(:student_planner)
course_with_teacher(active_all: true, new_user: true, course_name: "Planner Course")
@student1 = User.create!(name: 'Student 1')
@course.enroll_student(@student1).accept!

View File

@ -23,7 +23,6 @@ describe "student planner" do
include PlannerPageObject
before :once do
Account.default.enable_feature!(:student_planner)
course_with_teacher(active_all: true, new_user: true, course_name: "Planner Course")
@student1 = User.create!(name: 'Student First')
@course.enroll_student(@student1).accept!

View File

@ -25,7 +25,6 @@ describe "student planner" do
include PlannerPageObject
before :once do
Account.default.enable_feature!(:student_planner)
course_with_teacher(active_all: true, new_user: true, user_name: 'PlannerTeacher', course_name: 'Planner Course')
@student1 = User.create!(name: 'Student 1')
@course.enroll_student(@student1).accept!

View File

@ -23,7 +23,6 @@ describe "teacher planner" do
include PlannerPageObject
before :once do
Account.default.enable_feature!(:student_planner)
course_with_teacher(active_all: true, new_user: true, user_name: 'PlannerTeacher', course_name: 'Planner Course')
@student1 = User.create!(name: 'Student 1')
@course.enroll_student(@student1).accept!