Commit Graph

56 Commits

Author SHA1 Message Date
Aaron Ogata 2f386d104a rename Canvas::DynamicSettings => DynamicSettings
Change-Id: Ia2c1754ce729d95bcbf194f6b31a5a2b36d42bbb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282694
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Charley Kline <ckline@instructure.com>
2022-01-12 21:54:51 +00:00
Jeff Largent cd8f2c76a7 Compute and send stats about feature evaluations
This PS adds logic to compute context about a feature flag being
evaluated at the time it is checked, and pushed to an SQS queue if
configured. Whether or not to push the result of the evaluation to the
queue is both sampled and cached so as to not overwhelm the queue or
produce too much overhead on the Canvas side. The general process is:

1. Feature flag is evaluated
2. A random value between 0-1 is checked against a threshold stored in
   the dynamic setting feature_analytics.sampling_rate.
3. If under the threshold, the LocalCache is checked for any recent
   evaluations of the same flag / context / value combo.
4. If the result isn't already cached, the message is sent to SQS.
5. If anything unexpectedly goes wrong, an error is sent to Sentry and
   feature evaluation continues normally (no user-facing error).

refs DE-926
flag = none

Test plan:
  - Set up config in dynamic_settings.yml like the following:
      feature_analytics:
        cache_expiry: '60'
        sampling_rate: '1.0'
        queue_url: <canvas-feature-analytics SQS queue url in inseng>
        region: 'us-west-2'
  - Start canvas from a vaulted shell with inseng credentials
  - Go to a user's dashboard, a few coures pages, etc..
  - Expect to see messages show up in the SQS queue / its consumers
    after a minute or two delay
  - Expect to not see the same feature / context / value combo show up
    on repeated evaluations

  - Update the sampling_rate in dynamic_settings.yml to '0.0' and
    restart canvas
  - Flush redis cache
  - Go to the same pages as before
  - Expect to not see any more evaluations show up in SQS

Change-Id: I189e127dd5f31dc5d504bf45d354e93f7208107a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278885
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeff Largent <jeff.largent@instructure.com>
Product-Review: Jeff Largent <jeff.largent@instructure.com>
2021-11-30 21:23:59 +00:00
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer 25b301e97d RuboCop: Style/IfInsideElse, Style/SoleNestedConditional
[skip-stages=Flakey]

auto-corrected with post review ensuring line breaks continue to
convey original meaning of separated conditions, and cleaning up
some now-duplicated conditions

Change-Id: Ib9b31226de0665a2e4427fe595639d0d91a33f83
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279151
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 14:28:35 +00:00
Cody Cutrer ff99d18138 RuboCop: Style/RedundantSelf
[skip-stages=Flakey]

auto-corrected

Change-Id: I5f26ad1f8210a74c2198b514235d5134dcd0dae1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279070
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-11-20 16:41:21 +00:00
Cody Cutrer dbd8c46655 RuboCop: Lint
[skip-stages=Flakey]

auto corrections applied:
 * Lint/AmbiguousOperator
 * Lint/AmbiguousOperatorPrecedence
 * Lint/AmbiguousRegexpLiteral
 * Lint/DeprecatedClassMethods
 * Lint/DeprecatedOpenSSLConstant
 * Lint/NonDeterministicRequireOrder
 * Lint/ParenthesesAsGroupedExpression
 * Lint/RedundantRequireStatement
 * Lint/RedundantSafeNavigation
 * Lint/RedundantSplatExpansion
 * Lint/RedundantStringCoercion
 * Lint/RedundantWithIndex
 * Lint/SendWithMixinArgument
 * Lint/SymbolConversion

Change-Id: I222ec19978033544513bb99755994d109435abad
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274551
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-29 03:38:23 +00:00
Cody Cutrer c65d57737a RuboCop: Layout lib
Change-Id: I0655d9a9d750f2debd6378b03d8ddc1403ebc31b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274158
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-09-22 20:01:52 +00:00
Cody Cutrer 63bf92f4c1 don't even MultiCache FeatureFlags.feature_flag_account_ids for root accounts
it'll never hit the db anyway, because it knows it has no parents, so it's a
useless caching

Change-Id: Ie6496b1dbcec1ddc3a32da52cdff7c1614b0d14b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271527
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-08-20 21:55:15 +00:00
Cody Cutrer 4f7db1825d remove polymorphic_where
it natively works as a normal where condition in Rails now

Change-Id: I74e6990e583bfd54bf4bd6c86fd5e00051818b99
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271671
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-08-20 19:13:26 +00:00
Cody Cutrer 3e2762061f cache all feature flags on root accounts
since they are the most common target of feature flag predicates

Change-Id: I2c6be68f442b2eb66f8cd5ad57cafbc83f114ba1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271502
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-08-16 22:52:56 +00:00
Davis Hyer 8f883b7b24 log all feature evaluations
Feature !== FeatureFlag so we were missing a bunch of stats. This commit
moves all logging to the root feature_enabled? check

test plan:
  - tests pass

qa risk: low

Change-Id: I1cd9af13762e40656fb4d1fdc20bec77ee3d4e1a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271023
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-08-10 20:53:47 +00:00
Cody Cutrer db153f2beb return a frozen account chain
so that we can return the same one every time if called multiple times
for the same context

Change-Id: I2c5825ab115c50d1332d05d1e3cecbe45cbe7ea1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/270297
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-07-30 16:13:39 +00:00
Rob Orton 3346d4941b check how many times we are checking flags + state
test plan
 - check status of feature flag
 - it should log a stat containing tags for feature and if it is enabled

fixes VICE-1578
flag = all_the_flags

Change-Id: I42262914255f04649745ca13420ceeb5ca5d26e5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/266840
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
2021-06-18 17:11:54 +00:00
Cody Cutrer ed2f692990 features are never enabled on dummy courses or accounts
Change-Id: I078c5cbb3bc214df3409ff3b8661200e404709d1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/265686
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2021-05-26 16:00:03 +00:00
Jacob Burroughs 1c9ba5a427 Fix allowed_on + root_opt_in to be sane
The previous behavior made no sense for enabled unlocked features.  Even
if they are root_opt_in, they should inherit from siteadmin if allowed_on

Change-Id: I66652a16241dabcfe728097fddd2e631e4fb1e0a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/256574
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-01-12 22:08:22 +00:00
Jacob Burroughs f4a5f2da33 Quad-state feature flags
Allow feature flags to be "allowed on".  Updates user facing langauge
to be enabled/disabled + "(always)" or "(default)", which is clearer
than allowed, especially with 4 states.  Also moves from backbone UI
to react UI rather than retrofitting the changes to the old UI. The
backbone ui can be killed in a separate PS.  The new UI is easier to
ctrl-f on and presents the flags in alphabetical order according to
the user's current locale.

This includes a somewhat gross workaround for a bug in InstUI <Menu>
which is why it goes in an explicit <Popover>

fixes FOO-835

test plan:
- Ensure 'New Feature Flags' feature is off
- Make sure feature flags work in all the expected ways at the siteadmin, account, and course level
- Turn on 'New Feature Flags'
- Make sure that you can still use the feature flag ui in natural ways at each level
- Try turning a feature flag "on" but unlocking it/leaving it unlocked
- Ensure it is inherited on but overridable

Change-Id: I520824cdf6e18b5a7da5ab5f552a7fd3140fd4bf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249917
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2020-12-15 23:18:33 +00:00
Cody Cutrer 06763dd519 add # frozen_string_literal: true for lib
Change-Id: I59b751cac52367a89e03f572477f0cf1d607b405
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/251155
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-27 20:49:50 +00:00
Cody Cutrer 224377a50c only skip feature flag cache for the immediate model
i.e. the page you're on. this prevents constantly querying site admin
feature flags directly when getting user feature flags, while still
preserving what looks like cache coherency when you flip an account
level feature flag

Change-Id: I694c83da3d548ae34428d3ffd8e18e2384df6656
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/249645
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-10-08 22:08:06 +00:00
Cody Cutrer de5707686d cache feature_flag_account_ids in MultiCache for root accounts
Change-Id: I70792d730178f948efd3031c4dad82120a88a7c2
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/246119
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-08-27 15:37:01 +00:00
Jacob Burroughs f6a1b11f59 Hide inherited enabled FFs
fixes FOO-599

test plan:
- Enable a feature flag in siteadmin
- It should not appear in regular accounts
- Enable a course and account flag in a regular account
- On refresh they should still appear
- The course flag should not appear in courses in the account

Change-Id: I6af96794b0f0f9a5534374dd32b3b539a4b7f486
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/244506
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Charley Kline <ckline@instructure.com>
QA-Review: Charley Kline <ckline@instructure.com>
Product-Review: Jonathan Fenton <jfenton@instructure.com>
2020-08-07 21:10:13 +00:00
James Williams 99c0692502 don't cache site admin feature_flag_account_ids
Change-Id: I200163a12c002d6cf4e6b3deba597dff4612c81e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/232114
Tested-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2020-03-30 16:01:56 +00:00
James Williams bbdc741594 skip feature flag cache when showing API results to admins
test plan:
* in a production-like environment, feature flag changes should
 not appear to be undone when refreshing the page (while the
 cache is still in the process of invalidating)

closes #ADMIN-2939

Change-Id: I495820850f8facaa6965188140d979bd5227994d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/211436
Tested-by: Jenkins
QA-Review: Anju Reddy <areddy@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
Reviewed-by: Rex Fleischer <rfleischer@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2019-10-21 12:12:38 +00:00
James Williams 8241b4ebaf don't cache context on feature flag
sometimes can't be marshalled

Change-Id: I10e7f2211272ecc575a0a805e7e8b271b984434d
Reviewed-on: https://gerrit.instructure.com/199499
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2019-06-28 16:27:11 +00:00
James Williams 77d6d56b5e raise error on missing feature
because clay can't spell

also get rid of that feature flag enabling on
every user in specs

also handle development features disabled in prod

Change-Id: Ifd6c590011e6963e7acea90f8f58bd2372123d26
Reviewed-on: https://gerrit.instructure.com/171781
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
QA-Review: Clay Diffrient <cdiffrient@instructure.com>
2018-11-26 16:22:32 +00:00
Keith T. Garner 061e538ba1 Revert "raise error on missing feature"
Looks like it broke for development feature flags when canvas was
running in production mode.

This reverts commit 974a6e809a.

Change-Id: I1946137a2c4fade435ca00fde75f2dcb3a795ac4
Reviewed-on: https://gerrit.instructure.com/171728
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Jenkins
QA-Review: Keith Garner <kgarner@instructure.com>
Product-Review: Keith Garner <kgarner@instructure.com>
2018-11-08 22:59:23 +00:00
James Williams 974a6e809a raise error on missing feature
because clay can't spell

also get rid of that feature flag enabling on
every user in specs

Change-Id: I96b72b94f7421a4d7b1c0215d36733f369862b2f
Reviewed-on: https://gerrit.instructure.com/171457
Tested-by: Jenkins
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
QA-Review: James Williams <jamesw@instructure.com>
Product-Review: James Williams <jamesw@instructure.com>
2018-11-08 14:29:08 +00:00
James Williams 1b2c16c7e6 wrap request cache around common dashboard calls
Change-Id: Ie6c9e4a2682d76f9d82131f38a0ff979e192f2fa
Reviewed-on: https://gerrit.instructure.com/162291
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2018-08-28 15:16:14 +00:00
Cody Cutrer 37e5beb956 use a consistent current shard for feature_flag_account_ids cache
Change-Id: I4ca66fd4a40e3f84987ab2b82391462fa479de8f
Reviewed-on: https://gerrit.instructure.com/142660
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2018-03-06 05:47:52 +00:00
Han Yan f1bb548d7c Quizzes Next Feature Flag support
closes QUIZ-203, closes QUIZ-3434

test plan:
  case 1: when a root account is not provisioned by uuid provisioiner
  - 'Quiz Next' feature flag is not visible in root account, sub
    accounts and courses

  case 2: when a root account is provisioned by uuid provisioiner
  - should see 'Quiz Next' feature flag in root account
  - when the FF in root account is turned to On, all courses have access
    to Quizzes.Next (Quiz Migration and Easy button)
  - when the FF is off, all courses don't have access to Quizzes.Next
  - when the FF is allowed, subaccounts and courses should have options
    to turn Quizzes.Next On or Off

Change-Id: Ib41ce2db9943151f47ad42a676d29b744c381799
Reviewed-on: https://gerrit.instructure.com/135805
Tested-by: Jenkins
Reviewed-by: Brent Burgoyne <bburgoyne@instructure.com>
QA-Review: Dariusz Dzien <ddzien@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2018-01-11 22:39:42 +00:00
Simon Williams ffca880b71 correctly invalidate course/user feature flag cache
test plan:
- change a course/user feature flag
- the change should stick and apply

Change-Id: I2b4045bf6a0c5c57c58591c98ddcd513e8243fa0
Reviewed-on: https://gerrit.instructure.com/126202
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2017-09-15 20:19:49 +00:00
Cody Cutrer 102dca8bdc don't use multicache for course and user feature flags
closes CNVS-39324

Change-Id: I6c9fccaddd3661e3fdc350e94ae9e58854a544ad
Reviewed-on: https://gerrit.instructure.com/125792
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-09-12 21:38:14 +00:00
Landon Wilkins 79215618d4 da licença part 29
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: I49a8930917a609d3f118da1b20b51dedfd5d5903
Reviewed-on: https://gerrit.instructure.com/110053
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 21:59:53 +00:00
James Williams 603058d22e don't set inverse association on feature flags
slightly less performant but it'll fix whatever's associated with
the user that's causing marshalling errors sometimes

closes #CNVS-35073

Change-Id: Id4c18b6de829687c3a7d734fa16629fc3457bd5b
Reviewed-on: https://gerrit.instructure.com/102688
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-02-19 00:52:06 +00:00
Stewie (Nicholas Stewart) 5b0d053da2 Assignment model requires a due_at
This is one piece of SIS-2636

Refs: SIS-2636

Test Plan:
  Verify that an assignment requires a due date under certain
  conditions:
    assignment.post_to_sis = true
    account's sis_require_assignment_due_date is true
    the new_sis_integrations feature flag is on

Change-Id: Id614b6606127cad630b7c622c94893289aad59e6
Reviewed-on: https://gerrit.instructure.com/99181
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Tested-by: Jenkins
Product-Review: Oxana
2017-01-16 20:59:13 +00:00
James Williams 0126d90e8e set inverse_of for polymorphic associations, again
basically means we don't have to reload the contexts
all the time

also make sure that inverse associations are populated
when calling temp_record

Change-Id: I2a0baefeccc814746a241f506a8f2db02aa8eebf
Reviewed-on: https://gerrit.instructure.com/99642
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
2017-01-16 20:15:20 +00:00
Landon Wilkins 7bc6743b0b Revert "set inverse_of for polymorphic associations"
This reverts commit c20d270a4a.

Change-Id: I0227de546fc7ea22efd6b2acb6b77982f52bde52
Reviewed-on: https://gerrit.instructure.com/99570
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Tested-by: Jenkins
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
2017-01-13 18:50:07 +00:00
James Williams c20d270a4a set inverse_of for polymorphic associations
basically means we don't have to reload the contexts
all the time

also make sure that inverse associations are populated
when calling temp_record

Change-Id: I22adf77d218f8084f76632d397161c05945cbae4
Reviewed-on: https://gerrit.instructure.com/98381
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2017-01-13 12:37:26 +00:00
Cody Cutrer 36fe264507 don't bother caching a constant for feature flags
refs CNVS-30659

Change-Id: If90aedf26994f0012fa1efebf875451779c2cc97
Reviewed-on: https://gerrit.instructure.com/86712
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-08-02 20:25:43 +00:00
Derek Bender 0f2a46b95c Merge branch 'master' into dev/grading-periods-update
Change-Id: Iebae44c64860efd766ca7e288ca1ec112a790456
2016-06-20 10:22:17 -05:00
James Williams 304667fa85 add request cache around feature_flag_account_ids
gets called multiple times per request

Change-Id: Id630760d1b34724d3d089e7dd48ad1c8268078b8
Reviewed-on: https://gerrit.instructure.com/82632
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-06-16 12:19:27 +00:00
Spencer Olson 3ba3d62761 Merge branch 'master' into dev/grading-periods-update
Change-Id: Idaf66797a745b9c43aeb70361d476b621799a43f
2016-05-16 13:43:22 -04:00
Jeremy Stanley c8cfaa1e1c fix feature flag page error with hidden+root_opt_in
test plan:
As a site admin user,
 1. Set "Post grades to SIS" to Allowed in a root account
 2. Turn it on in a course
 3. Turn it back off in the root account
 4. Return to the course and reload the feature settings page
 5. The page should load without error

NOTE: the fact that "Post grades to SIS" is still enabled in
the course is the subject of CNVS-29319 and will be addressed
separately.  tl;dr hidden features are weird

fixes CNVS-29365

Change-Id: Ia9958bb6d4a56dc45a717503e437816a82e89b0c
Reviewed-on: https://gerrit.instructure.com/79631
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2016-05-16 17:01:25 +00:00
Spencer Olson 92712ebcbb rip out copying logic for grading periods
remove the copying of grading periods. teachers
and sub-account admins can no longer create
grading periods (although they can still edit
and delete previously-created grading periods),
and they cannot edit root account grading periods.

closes CNVS-26727

test plan:

 1. Course level
 - sign in as a teacher in a course with multiple
   grading periods enabled
 - navigate to the grading periods page at
   /courses/:course_id/grading_standards
 - if there are existing course-level grading
   periods, verify you can edit and delete them
 - verify you cannot create new grading periods
 - if there are not existing course-level grading
   periods, verify account level grading
   periods show up and they are not editable (if
   the sub-account owning the course has grading
   periods, sub-account periods should be displayed.
   if the sub-account does not exist or does not have
   grading periods, the root-account grading periods
   should be displayed)

 2. Root account level
 - sign in as a root account admin and go to the
   account grading periods page at
   /accounts/:account_id/grading_standards
 - verify you can still add new grading periods
   and you can edit existing grading periods

 3. Sub-account level
 - sign in as a sub-account admin and go to the
   sub-account grading periods page at
   /accounts/:sub_account_id/grading_standards
 - if there are existing sub-account grading
   periods, verify you can edit and delete them
 - verify you cannot create new grading periods
 - if there are not existing sub-account grading
   periods, verify root account grading
   periods show up and they are not editable

Change-Id: If2083defa524a81cbc557e39350b553c417e6f81
Reviewed-on: https://gerrit.instructure.com/77396
Tested-by: Jenkins
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-05-05 22:18:51 +00:00
Cody Cutrer e1529eb1ae switch a few things to use account_chain
instead of assuming [self, Account.site_admin]

refs CNVS-26291, CNVS-26292

Change-Id: I8c20a3e29f5af91d04e380794f21705706fd96a8
Reviewed-on: https://gerrit.instructure.com/69841
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-01-18 17:51:42 +00:00
Cody Cutrer ee17716731 remove some kludge-caching of :nil
that was only needed in rails 2

Change-Id: I1e2a00f65237d45ac82daa19eaecf5c589171718
Reviewed-on: https://gerrit.instructure.com/61025
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-08-17 19:27:27 +00:00
Cody Cutrer abc23822f1 improve multicache
explicitly have one copy per node in a ring (instead of relying
on hashing of a different to hopefully evenly spread copies around
the ring).

test plan:
 * configure a ring of redis servers for cache
 * canvas should still work

Change-Id: I17e086aac28c1c095c9717a7625ca51c86d0598f
Reviewed-on: https://gerrit.instructure.com/48069
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-05-06 19:21:21 +00:00
James Williams 16cb09f65e search for feature flags on the correct shard
something i came across while reading some logs

refs #CNVS-14539

Change-Id: Iaec7a290f49c2fa5a4e52550c14918abbdbfec44
Reviewed-on: https://gerrit.instructure.com/53106
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-04-30 12:53:41 +00:00
Jeremy Stanley 8e134c6c20 import files as unpublished if usage rights required
test plan:
 0. enable "better file browsing" and "usage rights required"
    in a course
 1. upload and expand a zip file and confirm the files are
    unpublished initially
 2. confirm that a file imported from an imscc package is
    (a) unpublished in the new course if no usage rights
        were set in the source course, regardless of whether
        the file was published in the source course
    (b) unpublished in the new course if it was unpublished
        in the source course, regardless of whether usage
        rights were set in the source course
    (c) published in the new course if it was published in
        the source course and had usage rights set.
 3. repeat step 2, but with course copy instead

fixes CNVS-19620

Change-Id: I9a32adeafb94e4922ba95ad6466c72aca3fd3598
Reviewed-on: https://gerrit.instructure.com/52465
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2015-04-21 17:37:30 +00:00
Cody Cutrer b1abbc453b spread feature flag cache around a ring
Change-Id: I4831cc45d8646f6f86a34ade6546644c4dacdd49
Reviewed-on: https://gerrit.instructure.com/48065
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-02-03 01:05:24 +00:00
James Williams 0018d01b51 hide quiz answer audit log permission based on feature flag
test plan:
* confirm that the permission to "View the answer matrix
 in Quiz Submission Logs" is only visible when the
 "Quiz Log Auditing" feature flag is allowed on the
 account level

closes #CNVS-18192

Change-Id: Ibbd0a082af20e49ef5fd5471c22ce6c236fbfade
Reviewed-on: https://gerrit.instructure.com/47820
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Tested-by: Jenkins
2015-01-28 21:19:32 +00:00