bump pg gem

Change-Id: I00d26eba514f8ced09cc0bfa42e8754e74e4ef69
Reviewed-on: https://gerrit.instructure.com/42284
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
fix grading standard can-edit logic

remove worse-than-useless policy block (the controllers are not
using it, checking :manage_grades on the context instead), and
let the view check whether the grading standard has assessed an
assignment, consistent with learning outcomes.

(Also, consistent with learning outcomes, the API can still edit
them. we just make it hard to mess with them accidentally in the
UI. I don't actually like this much, but apparently people
depend on this behavior.)

test plan:
 1. link an assignment to a grading scheme
 2. verify the grading scheme can still be edited
    on the grading schemes page
 3. as a student, submit the assignment
 4. verify the grading scheme can still be edited
 5. as a teacher, grade the student's submission
 6. verify the grading scheme cannot be edited on
    the grading standards page (no pencil icon appears)

fixes CNVS-15933

Change-Id: I21b67a25083169312c8b1c929d8e8ef305adc36c
Reviewed-on: https://gerrit.instructure.com/42234
Product-Review: Hilary Scharton <hilary@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
set up grading_period model, migration, and tests

closes CNVS-15906

test plan:
-run rake db:migrate
-verify the migration successfully runs, creating the grading_periods table and adding the index for course_id and account_id

Change-Id: If991a00fc79bc4aecabe8189a43432e2158709c8
Reviewed-on: https://gerrit.instructure.com/42161
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
don't use write_attribute for user_has_posted in streams

refs CNVS-15830

test plan:
 * create a discussion topic that requires a user to post
 * query the stream for that course via the API - the user_has_posted
   field should be true or false, but not nil

Change-Id: I213f26951773301ef31668289eae2fc7f9001d49
Reviewed-on: https://gerrit.instructure.com/41975
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
don't use write_attribute as temp storage for conversation stream items

refs CNVS-15830

test plan:
 * involve yourself in a conversation
 * on your dashboard, the last message and last author info should be
   correct and not asplode

Change-Id: I997be1a0f40939d1999ffbc99ec7b28ed322ffbc
Reviewed-on: https://gerrit.instructure.com/41976
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
created new styling for CNVS-15493

new colors are based on $canvas-neutral

contrast for context on quizzes tab. can be viewed at '/quizzes'

rewrote quiz list text and icons to have single darken function. also, one less selector!

regular: #808080 on #fff :: 3.95:1
high contrast: #6d6d6d on #fff :: 5.17:1

Test plan:
- Navigated to quizzes tab. If there are no quizzes create one. 
- Verify contrast of publish icon, and 'pts' and 'question' text has been updated. You can verify the color contrast using http://webaim.org/resources/contrastchecker/
- After verifying enable high contrast.
- Repeat previous tests to verify high contrast color ratios.
 
Change-Id: I83ec5baf03d0264efcf0d7110c7f2be240f15b83
Reviewed-on: https://gerrit.instructure.com/41679
Reviewed-by: Chris Hart <chart@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
fix 'let students take this quiz now' so that it correctly unlocks the quiz

when unlocking a quiz (with no time limit or for a specified period), the
quiz will now unlock correctly, and the students will be able to take it.

fixes CNVS-11727

test plan:
  - Create a quiz. Set a due date, but no "from" or "until" date.
  - Save and publish the quiz.
  - Lock the quiz; note that the date/time at which you lock it now appears in the "until" field.
  - Unlock the quiz with "No time limit". Note that the current date/time appears in the
      "Available from" cell, and the "Until" date has been cleared out.
  - Verify that you are able to take the quiz as a student, and note that there is no
      specified end date for the quiz.
  - Lock the quiz again, then unlock the quiz with a time limit (choose any date). Note that
      the current date appears in the "Available from" cell, and the specified end date
      appears in the "Until" cell.
  - Verify that you are able to take the quiz as a student, and note that there is a specified
      end date for the quiz.

Change-Id: I94ed3e26b7c91e84728c27e58c0e130444ef95a2
Reviewed-on: https://gerrit.instructure.com/42016
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
DA - needs grading

fixes CNVS-15482

test plan:
 * with DA on
 - create an assignment and submit it as several students in different sections
 - as a teacher again, change the assignment to only be visible to one section
   (one that has student submissions)
 > on your dashboard, only the students' submissions from that section
   should show in your 'needs grading' right-side bar
 > on the course dashboard the same should be true
 - as a section limited teacher who is limited to the section with visibility,
   your dashboard and course dashboard should only show
   submissions from your section as needing grading

 * with DA off
 - repeat the steps above and all submissions should be in the needs grading
   count in all places

Change-Id: I6c2fad7d7dea42c2e7edc968e8db113bdcab3a3c
Reviewed-on: https://gerrit.instructure.com/41604
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
Quiz question integrity after regrade

The problem was that quiz questions were going through some
transformations when generated for a submission, but those
transformations were not applied when we re-generated the questions from
a regrade. This patch makes those xforms happen in both phases.

Closes CNVS-15727

TEST PLAN
---- ----

  - create a quiz with two questions, the second being like MChoice
  - modify the title of the second question
  - take the quiz by a student
  - edit the quiz, and the question, and choose a different answer (and
    make sure it's not what you picked, so you get affected)
    - choose the option to only give full credit to ones who chose the
      *new* answer (again, so the student sub gets affected)
  - reload the student view of the submission and verify:
    - you see the "This question has been regraded." banner
    - you see Question 1 and Question 2 as titles
    - you see the same thing (for titles) from the teacher's perspective

Change-Id: I43a9edc03a381efa0d1c2ccfc7705d0ba912184b
Reviewed-on: https://gerrit.instructure.com/41906
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
Updated zh translation

Change-Id: I49377e9b1961285254c217dedea93bdfba6b8401
spec: remove tests that explicitly cover non-draft-state functionality

refs #CNVS-15563

test plan: tests should pass

Change-Id: I31c3f529fd9c0b0a8b94ddcbb11b2e5a6779876c
Reviewed-on: https://gerrit.instructure.com/42225
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
spec: fix various specs for draft state

refs #CNVS-15563

Change-Id: Idfb6f57d98ae7bd5ecb44e1f033c26904765a2bf
Reviewed-on: https://gerrit.instructure.com/42304
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Adjusts handling of multiple selected files.

Makes it so that the active element in the footer is always
shown.

fixes CNVS-15993

Test Plan:
  - Go to new files
  - Select multiple files to preview
  - The preview should work for only those
  - Close the preview
  - Make sure you have a bunch of files
  - Open the preview
  - Open the footer
  - Navigate through the files
  - The displayed file should always show up in the footer.

Change-Id: I47c24b4af8a9d27936c0aaebc760d9d901d605c6
Reviewed-on: https://gerrit.instructure.com/42318
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Clay Diffrient <cdiffrient@instructure.com>
fix observer linking after sis import

test plan:
* create a student
* as a user with a valid login,
observe the student permanently using the
observees UI ("/profile/observees")
* enroll the student in a course through
an sis import
* should create an observer enrollment
for the observer as expected

closes #CNVS-14943

Change-Id: I087190b3672b51d2b2f91551ea3a0a424ab89091
Reviewed-on: https://gerrit.instructure.com/42205
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
reset conversation context on dialog close

test plan:
* create two courses, e.g. "Course A" and "Course B"
* send a message to all the members of a subset of "Course A"
 e.g. "Course A: Teachers"
* without refreshing the page, open the dialog to send another
message, this time to all the members of a subset of "Course B"
* should accurately show "Course B: Teachers", instead of
 the first course

closes #CNVS-14969

Change-Id: I2af373cdd4292c93aba944936573778679290d0b
Reviewed-on: https://gerrit.instructure.com/42163
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
DA - permissions

fixes CNVS-15852

test plan:
 * setup DA
 * for assignments
   - as a student, submit an assignment
   - as a teacher, remove visibility from that student
   - as a student, type in the url (/courses/:id/assignments/:id/submissions/:id)
     for your submission for that assignment
   > there should not be a link to resbumit the assignment
 * for discussions
   - as a student, using the API
   > you should not be able to reply to a discussion for which you do not have
     visibility

Change-Id: Ia4669626c745aac02ac9830865c5a5b2fd75cc37
Reviewed-on: https://gerrit.instructure.com/41947
Product-Review: Hilary Scharton <hilary@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Add progress button an styles

fixes CNVS-15804

Just adds a button link to the upload progress with styles

Test Plan
Given you're using new files
Upload a file or folder
When progress loads, you should see an x next to the progress bar
It should be accessible

Change-Id: I667a2c9162208c319515dd0323e3b219dfa03b0d
Reviewed-on: https://gerrit.instructure.com/42301
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sterling Cobb <sterling@instructure.com>
implement aborting a file upload

fixes CNVS-16087

Adds the ability to abort a file that is currently being uploaded.

Test Case

Given your on new files
When you attempt to upload a large file
Then you should see a clickable x next to that files progress bar
And clicking it should abort the upload
And the file progress should be removed from the view

Change-Id: I39858e075beeaedc1499a5a3a8ed21aae541d116
Reviewed-on: https://gerrit.instructure.com/42332
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
fix restricted access bug

fixes CNVS-16095

Changed some wording and now when you select a "from" date, and re-open
the restricted access form, it will keep state by default.

Test Plan
-------------
Given you're on new files
And you have a file or folder
When you click the 'restricted access icon'
And you click on the restricted access radio button
And select ONLY a 'lock from' date
And you save
And you re-open the restricted access dialog
Then the restricted access radio button should be selected by default
And it should be filled in with the correct date

Change-Id: I6fae117cc5db9712c537c9c586987106208e1199
Reviewed-on: https://gerrit.instructure.com/42342
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
add $Canvas.masqueradingUser.id substitutuion

test plan:
 - add a tool with the custom variable $Canvas.masqueradingUser.id
 - masquerade as a user
 - launch the tool
 - $Canvas.masqueradingUser.id should be your actual canvas id

fixes PLAT-657

Change-Id: I5c6cf1532cac7fa4dcf065652d87500e5d30e474
Reviewed-on: https://gerrit.instructure.com/41750
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>