improve relationship support for Canvas::APISerializer

Adds better support for relationships with regards to
ActiveModel::Serializers through Canvas::APISerializer:

- Serializing a url is now the default if your relationship is
`embed: :ids` (implied embed_in_root: false)
- Serializing IDs is the default if your relationship is
`embed: :ids, embed_in_root: true` (relationship is sideloaded with
the main response)
- Stringifying ids is now the default. You can opt out by defining
a `stringify_ids?` method on your serializer.
- Introduce Canvas::APIArraySerializer for our own needs since
ActiveModel::ArraySerializer calls `serializable_object` instead
of `as_json`, bypassing stringification.

Also fixes an issue where subclassing Canvas::APISerializer
would not get stringified if you overrode `serializable_object`.

test plan:
  - make sure the jsonapi version of the quizzes api still works.

Change-Id: I301648d3e21b887eb7c2502cc00dec023fbbf79d
Reviewed-on: https://gerrit.instructure.com/28116
QA-Review: Myller de Araujo <myller@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
work around weird mysql behavior with text column defaults

refs CNVS-7032

Change-Id: Ia6474a8ae39e78b858a993993852139ec9f0c624
Reviewed-on: https://gerrit.instructure.com/28795
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
spec: create announcements in the past to avoid sub-second precision problems in mysql

refs CNVS-7032

Change-Id: Iccb42f6f2ae2a13f2a3c002305c76ceb405693e0
Reviewed-on: https://gerrit.instructure.com/28803
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
spec: fix delayed jobs specs on mysql dependent on subsecond precision

refs CNVS-7032

Change-Id: I6ac3cba00d45bccec6c0c8067ff43a2b0c21161d
Reviewed-on: https://gerrit.instructure.com/28808
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
spec: fix conversation batch spec for non-empty db

Change-Id: I71947c68f66e6a07b5172384217b5b068874886e
Reviewed-on: https://gerrit.instructure.com/28866
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
fix MediaObject.refresh_media_files job for assessment questions

don't puke trying to find folders for things that don't have folders

Change-Id: Ie2291ecb4a8bf63b3c550b5c35b543bdb5257ddd
Reviewed-on: https://gerrit.instructure.com/27943
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
TMailParser is unused, and incompatible with Rails 3

refs CNVS-10649

Change-Id: I772731024951bc295b8fb1a9643195ace4a36f0d
Reviewed-on: https://gerrit.instructure.com/28887
QA-Review: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
spec: fix sub-second precision error on assignments override spec

refs CNVS-7032

Change-Id: Ic480d1630550fb687c6fe59b12ad4d5621da8e89
Reviewed-on: https://gerrit.instructure.com/28863
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
spec: ignore fragile spec for now

Change-Id: I8d23885d7f774c688a1f3894d0edf30e36a997f5
Reviewed-on: https://gerrit.instructure.com/28852
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
round group_weights to two decimals

fixes CNVS-10309

Test Plan:
  - Go to old assignments index as teacher
  - Change group weights decimals to have many digits
  - Ensure:
    - Group weight gets rounded to two digits
    - Total weight is rounded to two digits

Change-Id: Idcedb1ea77a0d5bb4e3a14ea979d95c0197d52ba
Reviewed-on: https://gerrit.instructure.com/28325
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
ensure that document matches student in speedgrader

fixes CNVS-1739

ajax calls to get the document were coming in out of order -
this fix makes sure that the student id of the response
matches the current student id

test plan:
  - As teacher make assignment that allows document submissions
  - As 5-10 students, submit pdfs/word documents for the assignment
  (no need to redo the above steps if you already have this setup somewhere)
  - In speedgrader try to click very quickly and get the wrong document to
    appear for a student (hint: this is easier with larger documents)
     - Do this with Crocodoc previews, Google Doc previews, and Scribd previews
     (each has a slightly different fix, so it is important to test each)
     - You shouldn't be able to get the wrong assignment to show up

Change-Id: Icac0a6d94f1ed7a73adbbc6fbcb47d84ff8e349d
Reviewed-on: https://gerrit.instructure.com/28300
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
fix data fixup helper method definition

Change-Id: I5d0a754db2b1443208825dd4918b2ad82953cd5a
Reviewed-on: https://gerrit.instructure.com/28931
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
spec: ensure scopes for pagination are ordered

Change-Id: Ia05f6e813622f1431c542ceb577507de09c678c9
Reviewed-on: https://gerrit.instructure.com/28886
QA-Review: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
TinyMCE: Give Switch Views links more meaningful labels

Fixes CNVS-9799

Test plan:
- Visit every RCE editor in Canvas that offers a control for switching
  between the visual and HTML editor (nearly all of them).
- Verify that the control label is clear about what it does. I.E. not simply
  "Switch Views".
- Switch back and forth between views, and verify that the control always
  works, and that the label is correctly updated when the view changes.

Change-Id: Idc62f57b4914b170428c9e97b7286af177dac269
Reviewed-on: https://gerrit.instructure.com/27989
QA-Review: Myller de Araujo <myller@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Product-Review: Aaron Cannon <acannon@instructure.com>
mark specs as pending if saml is not enabled

Depending on which specs were running, AccountAuthorizationConfig might
not have even been loaded before this change, causing Onelogin to be a
missing constant even if SAML is available.

refs CNVS-10467 (fixes a travis.ci build error)

Change-Id: Ifcc93db91f0cb25deab39c1fe3e60dc3e8b63451
Reviewed-on: https://gerrit.instructure.com/28940
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
update the example session_store.yml

Use encrypted_cookie_store by default, since it's the best option. This
fixes the session timeout specs failing with the default config.

Also remove the documentation on memcache/redis session store, since
those are deprecated.

refs CNVS-10467 (fixes a travis.ci build error)

Change-Id: Iafe633f601565d4306bb2f144d5d846d6fd527d5
Reviewed-on: https://gerrit.instructure.com/28946
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
remove icons from gradebook navigation pills

fixes CNVS-10627

test plan:
  * in a course with outcome gradebook enabled, navigate to
    gradebook and verify that the navigation pills only
    display text and not any icons.

Change-Id: Ic155deae1e5a8a62283786e117f64e61105c7247
Reviewed-on: https://gerrit.instructure.com/28873
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
fixes a bug in the LTI variable substitutor

test plan:

Add a custom variable with the value $Canvas.user.user and $Canvas.user.class.
These values should not be substituted when the tool launches .

fixes PLAT-311

Change-Id: Ifb64ebaeb0c732720d6c5312cbc595a9c6e9c21e
Reviewed-on: https://gerrit.instructure.com/28761
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
add _.cloneDeep to lodash using lodash-cli

Change-Id: Ida5c3f7234efc7523c40e5244c45425ad1a4c21f
Reviewed-on: https://gerrit.instructure.com/28929
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
QA-Review: Stanley Stuart <stanley@instructure.com>
gradebook2 assignment_group weight changes without reload

fixes CNVS-10135

Note: changing weight will break drop rules, this
is being taken care of in another ticket.

Test Plan:
  - make several assignment groups w/ weights
  - go to GB2
  - change weights in modal window
    - ensure weight %s change in headers
    - ensure grades change appropriately
  - toggle weighted groups on/off
    - ensure percentages appear/disappear
    - ensure grades change properly
  - make an assignment group named "<h1>Foo</h1>"
    - play around with weights in gradebook
    - ensure proper escaping in headers and dialogs

Change-Id: I771e27a1a07958dba3fa9cae2c8da11aed3371a7
Reviewed-on: https://gerrit.instructure.com/28075
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Mike Nomitch <mnomitch@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>