Go to file
Ryan Shaw 957ffeaa85 restore "speed up dashcards by only loading tabs shown" & fix bug
Fixes: CORE-1964

This reverts commit 72d558f095

this restores the commit (aka, reverts that ^ revert) that was causing
us bugs on caturday. the root cause of the bug was that
["active_record_types", [], self].cache_key
and
["active_record_types", nil, self].cache_key
return the same string.

how to replay the buggy scenerio:
(as a student, in a course with annnouncements):
* right after having "touched" the course (so there's nothing cached),
* have one person go to  /courses/:course_id/assignments/syllabus
* in the controller action for that, it will do:
  `return unless tab_enabled?(@context.class::TAB_SYLLABUS)`
  that will call Course::uncached_tabs_available(only_check: @context.class::TAB_SYLLABUS)
  which would have called @course.active_record_types(only_check: [])
  (because @context.class::TAB_SYLLABUS is not one of the `tabs_that_can_be_marked_hidden_unused`)
  which woud have written `{}` to redis at ['active_record_types', [], self].cache_key
* now, as a different student, go to /courses/:course_id/annnouncements
  it will call `tab_enabled?(@context.class::TAB_ANNOUNCEMENTS)`
  that will call Course::uncached_tabs_available(only_check: @context.class::TAB_ANNOUNCEMENTS)
  which will call @course.active_record_types(only_check: [:announcements])
  it will do a cache read for ['active_record_types', [:announcements], self].cache_key
  since it it a fresh cach, that will not be found
  then it would have done a cache read for the "everything" cache at
  ['active_record_types', nil, self].cache_key
  THAT WOULD HAVE RETURNED THE CACHED `{}` SINCE `nil.cache_key` and `[].cache_key` ARE THE SAME!
* the user would be told the announcement page is not enabled for that course

the fix is to explicitly not allow Context::active_record_types to ever 
be called with `only_check: []`

and for good measure, we don't allow the implicit conversion of 
nil.cache_key to "" and instead use "everything" for the cache cache_key

I added specs to spefically catch this bug so that it doesn't happen again.

To see the difference, compare the latest patchset of this commit against
patchset 1. patchset 1 is the original version of this code without this
fix.

Change-Id: I513104b90dd94227a04c151ee02a22f4a4ac2832
Reviewed-on: https://gerrit.instructure.com/167400
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2018-10-08 22:33:23 +00:00
.github Add config for github bot to close old issues 2018-07-19 17:16:13 +00:00
Gemfile.d bump sanitize 2018-10-05 21:16:54 +00:00
app restore "speed up dashcards by only loading tabs shown" & fix bug 2018-10-08 22:33:23 +00:00
bin spec: Add git SHA to pact file consumer version. 2018-07-07 00:01:58 +00:00
build Upgrade Yarn version to 1.10.1 2018-10-08 17:14:57 +00:00
client_apps fix essay speedgrader button 2018-10-02 01:44:33 +00:00
config Move Creat Tool from Tool Config 2018-10-05 20:32:02 +00:00
db/migrate Add disabled placements column 2018-10-05 19:15:34 +00:00
doc add a full_width_in_context external tool layout 2018-10-03 16:45:40 +00:00
docker-compose Add dc config to jwk set_keys 2018-08-10 17:44:48 +00:00
frontend_build Add raven to collect deprecations warnings 2018-08-23 16:19:11 +00:00
gems bump sanitize 2018-10-05 21:16:54 +00:00
jest [spec] ensure MutationObserver exists to fix flaky jest test 2018-09-27 16:16:03 +00:00
lib use top-level reference to planner helper 2018-10-08 19:00:20 +00:00
packages Fix new and updated languages for canvas-rce 2018-10-08 21:17:25 +00:00
pact Include context_name in planner item response 2018-08-29 22:20:52 +00:00
public Enhance MathJax for discussions 2018-10-05 06:42:05 +00:00
script add packages/*/node_modules to nuke_node script 2018-09-12 04:12:29 +00:00
spec restore "speed up dashcards by only loading tabs shown" & fix bug 2018-10-08 22:33:23 +00:00
.babelrc add babel-plugin-transform-runtime for smaller JS 2017-10-12 14:35:46 +00:00
.bowerrc introduced bower to manage js dependencies 2013-12-13 17:45:57 +00:00
.codeclimate.yml disable ESLint in code climate 2017-02-14 17:47:39 +00:00
.dockerignore fix canvas-planner docker build process 2018-04-17 14:44:18 +00:00
.editorconfig Add EditorConfig configuration file to help maintain code style 2016-11-15 20:08:55 +00:00
.eslintignore ignore AmbiguousBlockAssociation for specs 2018-02-12 18:37:09 +00:00
.eslintrc.js fix eslint for announcements 2018-08-17 16:33:26 +00:00
.gitignore Add a way to generate better js coverage 2018-07-17 14:19:03 +00:00
.i18nignore bump rails 3 to github branch for ruby 2.2 compatibility 2015-02-18 22:55:20 +00:00
.i18nrc upgrade to node 6 2016-08-09 23:37:07 +00:00
.jshintrc make jslint settings more sane 2012-08-17 11:04:40 -06:00
.npmrc fix brand config previewing and skipping 2015-10-27 16:16:15 +00:00
.nvmrc Use node 8.10.0 instead of 8.9.4 2018-03-09 18:56:22 +00:00
.prettierrc Add .prettierrc so it matches our existing code 2017-11-03 16:21:50 +00:00
.rubocop.yml spec: remove ExpectChange and TimesMap 2018-08-31 14:53:41 +00:00
.selinimumignore Revert and bring InstIcons into Canvas 2016-11-29 20:52:54 +00:00
.stylelintrc stylelint: shorthand-property-no-redundant-values 2018-08-31 18:48:46 +00:00
.travis.yml more travis builds 2014-02-10 16:23:19 +00:00
CONTRIBUTING.md Add CLA FAQ from legal 2018-01-22 16:41:44 -05:00
COPYRIGHT Initial commit. 2011-01-31 18:57:29 -07:00
Dockerfile Upgrade Yarn version to 1.10.1 2018-10-08 17:14:57 +00:00
Dockerfile-production Upgrade Yarn version to 1.10.1 2018-10-08 17:14:57 +00:00
Gemfile allow choosing rails 5.1 via consul 2017-10-11 19:13:02 +00:00
LICENSE Initial commit. 2011-01-31 18:57:29 -07:00
README.md Update README.md since Canvas is still modern 2016-12-15 03:18:28 +00:00
Rakefile remove dead parallelized specs task 2016-11-10 21:41:08 +00:00
bower.json spec: remove ember-qunit 2018-07-13 14:24:41 +00:00
code_of_conduct.md contributor code of conduct 2014-12-23 18:13:59 +00:00
config.ru remove extra logging to debug Passenger connection orphan issue 2017-07-14 16:27:03 +00:00
docker-compose.jenkins.yml Rename docker-compose.test.yml 2017-05-17 18:51:53 +00:00
docker-compose.override.yml upgrade yarn to 1.6.0 2018-04-19 20:31:06 +00:00
docker-compose.yml Use redis:alpine 2017-07-31 22:31:40 +00:00
gulpfile.js polyfill es6.number for IE11 2018-06-12 15:01:24 +00:00
issue_template.md Make issue template disclaimer a comment 2018-05-01 15:00:27 +00:00
jest.config.js add jest-canvas-mock to silence a bunch of warnings 2018-09-07 15:18:15 +00:00
karma.conf.js Add a way to generate better js coverage 2018-07-17 14:19:03 +00:00
package.json Upgrade Yarn version to 1.10.1 2018-10-08 17:14:57 +00:00
schema.graphql graphql: remove fallback from avatar url 2018-09-25 17:30:03 +00:00
webpack.config.js don't pass frontend build files through babel 2016-11-08 20:29:29 +00:00
webpack.production.config.js a couple uglifyJS settings to make prod debugging easier 2018-05-03 19:52:15 +00:00
webpack.test.config.js upgrade react from 0.14.9 to 15.x 2018-09-17 15:42:14 +00:00
yarn.lock Updated yarn.lock 2018-10-08 20:44:44 +00:00

README.md

Canvas LMS

Canvas is a modern, open-source LMS developed and maintained by Instructure Inc. It is released under the AGPLv3 license for use by anyone interested in learning more about or using learning management systems.

Please see our main wiki page for more information

Installation

Detailed instructions for installation and configuration of Canvas are provided on our wiki.