Commit Graph

3138 Commits

Author SHA1 Message Date
Nathan Mills 7e4ffb6ffc remove expiration code for oauth tokens
test-plan:
when you get an access via oauth2 token you shouldn't get an expiration, and it shouldn't be set in the db

Change-Id: Ie0b15b54ef789b9a94b726026c09fe9497f0adc5
Reviewed-on: https://gerrit.instructure.com/64749
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-10-07 21:59:34 +00:00
Dan Minkevitch 731ee214da Allow admins to change users' default emails
fixes CNVS-23604

Test Plan:
1. As an Administrator, create a user (Users > Add a New User)
2. Add an email address and save the user
3. Edit the User (Users > click on name > click Edit link in Name and Email section
4. Administrator should be able to edit the email address field
5. Upon saving the updated email address, the change should be reflected in the UI

Change-Id: Iaba72fb5bd8bd75697f3d2e3c869a75b0686310f
Reviewed-on: https://gerrit.instructure.com/64466
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-10-07 21:30:37 +00:00
Cameron Matheson 189ce7e3f2 make Turnitin::Client#id shard aware
refs CNVS-17473
fixes CNVS-21075

Test plan:
  turnitin still works

Change-Id: I36c34b2a4be67e4d0348dba2de43880ce4a8520a
Reviewed-on: https://gerrit.instructure.com/56782
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2015-10-07 20:57:02 +00:00
John Corrigan c825ffc544 render images, audio and video in epubs
fixes CNVS-21798

Summary of changes:
- Add files to epub as it's being built.
- Update links to image files to be path specific to epub.
- Update links to audio files to be epub-compatible `<audio>` tags.
- Update links to video files to be epub-compatible `<video>` tags.

test plan (requires console access):
- Prereq: have a course with uploaded images, audio and video files, and
  reference that media in assignment bodies.
- Make sure you have at least one completed content export in the db
  (can be triggered via console or via the content export UI).
- open rails console
- run the following commands:
- - `ContentExport.include(CC::Exporter::Epub::Exportable)`
- - `ContentExport.last.convert_to_epub`
- This will output a path to the generated epub, something like:
"/var/folders/7g/w8y0n7_j18v65h93xhmm9z4hxzj3r2/T/2052fbd0-860d-4114-9969-0adc7f5ecb79.Name
of Course.epub"
- Open up the folder of the file (assuming you're on Mac OSX) like so:
`open -a finder /var/folders/7g/w8y0n7_j18v65h93xhmm9z4hxzj3r2/T`.
- Find the file in that directory (in this case the file name is
  2052fbd0-860d-4114-9969-0adc7f5ecb79.Name of Course.epub
- Observe that images displayed inline work.
- Observe that links to images work.
- Observe that links to audio have been converted to audio players, and
  that the controls work.
- Observe that links to video have been converted to video players, and
  that the controls work.
- Repeat steps for discussion topics, wiki pages & quiz descriptions.

Change-Id: I5a48c3300ccffc00230d94137a93731394ef0ebb
Reviewed-on: https://gerrit.instructure.com/62842
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-10-07 17:20:28 +00:00
Jeremy Stanley f53907c0dd fix lock-by-date modules in public courses
test plan:
 - create a public course
 - add some modules
 - set one or more modules to unlock in the future
 - ensure that both logged-in students and non-logged-in users
   see that modules that are locked by date appear as such
   in the modules UI

fixes CNVS-15095

Change-Id: Id32d8af9cacf9412d3fbc6eed9da8171bf36194b
Reviewed-on: https://gerrit.instructure.com/64329
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-10-06 19:03:40 +00:00
James Williams 2b72c8141e fix assignments on syllabus page
test plan:
* create a course with assignments with due dates
 and calendar events
* the syllabus page should differentiate between
 the assignments and regular events with bold text
 and also say "due by X"

closes #CNVS-22502

Change-Id: I7032c6af99482beda4a15a0d511b2d205af442b2
Reviewed-on: https://gerrit.instructure.com/64573
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-06 18:18:56 +00:00
Jon Willesen 8dd8e03623 record anonymous grading in grade change audit log
anonymous grading is currently only possible from speedgrader.
when a grade is changed in speedgrader, it now sends in a
parameter that indicates whether the "hide student names" flag
was on (by any means).

when the grade changes on a submission, the submission also
remembers whether it was graded anonymously. If the grade
changes and the graded anonymously flag was not explicitly set,
the flag is reset to false. This way we don't have to modify
every place that changes a grade to update the anonymous flag.

this commit includes migrations to add anonymous grading to both
the submission record and the cassandra auditing table. The
grade change audit API was augmented to include this information

finally, added the 'Anonymous' column to the grade change audit
log displays admin tool to display the value of the field
fetched from the API.

closes CNVS-21537

test plan:
 - setup your environment for grade change auditing (requires
   cassandra).
 - check "Grade Change Log" API documentation and behavior for
   the new "graded_anonymously" field.
 - check the behavior of the new "Anonymous" column in the
   "Grade Change Activity" account admin tool.

Change-Id: Ief6c0da2a36986acf8639ba2620820813d2b8047
Reviewed-on: https://gerrit.instructure.com/63815
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2015-10-06 16:20:22 +00:00
Cody Poll 6c30ea57cf Fixing react scrolling issue
Scrolling performance was pretty horrendous. Now it's not.

Test plan:
  This commit touched a lot of different parts of the react gradebook, so it
  basically needs a regression test against how the gradebook was before. Some
  examples include:
    - Column ordering
    - Search for a student functionality
    - Filter by grading periods
    - Adding new grades
    - Editing old grades

fixes CNVS-23053

Change-Id: I0360704f9581775471fc1c0864b7ae863e7a1355
Reviewed-on: https://gerrit.instructure.com/63307
Tested-by: Jenkins
Reviewed-by: Dylan Ross <dross@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Cody Poll <cpoll@instructure.com>
2015-10-05 18:26:12 +00:00
James Williams dbe56e5233 add requirement_count to course copy
test plan:
* create a module with some required module items
* set it so students only need to "Complete One Item"
* copy the course
* the "Complete One Item" setting should be retained

closes #CNVS-23713

Change-Id: I7f113d34b2247c13c9984124c2364a6fece878b6
Reviewed-on: https://gerrit.instructure.com/64496
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Charles Kimball <ckimball@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-05 13:00:10 +00:00
James Williams 1df0ef3bd1 add "access_restricted_by_date" field to courses api
test plan:
* restrict a student from viewing a course using
 course dates
* the courses api should return "access_restricted_by_date"
 for that course

closes #CNVS-22905

Change-Id: I5d5eada2e685ed18fd9ecbe474493c01818297ee
Reviewed-on: https://gerrit.instructure.com/63074
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Charles Kimball <ckimball@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-10-02 19:20:49 +00:00
Ryan Taylor 955f9097c8 Closes N+1 query dependency for quiz submissions
Excludes a particularly expensive calculated attribute from the
calculations required for API index operations.  No known conflict here,
as this functionality was originally added when EMBER quizzes was being
built.

Closes CNVS-23388

Test Plan:
  - Confirm that all quiz submission API and UI interactions are
    unaffected.

Change-Id: Ic71c46fcf377ebc935dbc827dd1cf3be6726f0c0
Reviewed-on: https://gerrit.instructure.com/63776
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-10-02 18:40:07 +00:00
James Williams 34cbc4cd43 moderated grading speedgrader final mark drop-down
test plan:
* create a moderated assignment with student submissions
* add the students to the moderation set

* as a moderator (teacher) go to speedgrader

* should be able to create
 a 2nd mark or a final mark through the drop-down

* should also be able to copy the 1st or 2nd mark
 as a final mark (and should get a warning if there
 already is a final mark)

closes #CNVS-23262

Change-Id: Ie51f378a8665ba78204ca65bb65f4286ada5337d
Reviewed-on: https://gerrit.instructure.com/64105
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-10-02 15:58:52 +00:00
Matthew Berns bb7d6557eb add module sorting to epub
closes CNVS-21801

this adds module sorting functionality to ePub generation

to generate via console
- already have an .imscc file from an exported course
- in rails console
  ContentExport.include(CC::Exporter::Epub::Exportable)
  ContentExport.last.convert_to_epub  (for module sorting)
  ContentExport.last.convert_to_epub({sort_by_content: true}) (for content sorting)

Change-Id: Ie82db12a551ff338d616162211fa7bafcd9f29fe
Reviewed-on: https://gerrit.instructure.com/62681
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-10-01 19:59:17 +00:00
Ryan Shaw 079c9e272c don't proceed like normal if brandable_css cmd fails
fixes: CNVS-23632

it turns out, the way I was doing this ruby would
create a sh subprocess and brandable_css would 
be it's subprocess. so $? would be the sh process
(which would always exit successfully).

test plan:
* in theme editor, try to preview a theme
* but before you do, do something to make it so
brandable_css will fail (like uninstall node or 
rm -rf node_modules or use activity monitor to view
active processes and kill brandable_css when 
it appears)
* it should say "something went wrong generating..."
  instead of continuing like everything worked

Change-Id: I3c80c18381bb52c71d4b79d5b151988d6cf5cc3b
Reviewed-on: https://gerrit.instructure.com/63948
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2015-09-30 21:37:45 +00:00
Abhishek Singh 4ba84e29a4 adds UI & backend for offline content
fixes CNVS-21793, CNVS-21794, CNVS-21795

- Adds EpubExport model to manage state of generated epubs.
- Adds controller to list, create & show epub exports.
- Adds a mini react app to manage UI for creating epub exports.
- Adds shared ApiProgressBar react comoponent to diplay a progress bar
  that polls the progress API.
- Updates ContentExport to have a relationship with EpubExport.

test plan:
- Navigate to `/epub_exports`.
- Observe a list of courses that are active & user is enrolled in.
- Click on the Generate button.
- Observe that info about the state of the export and the timestamp are
  added to the middle of the row.
- Observe that a progress bar is displayed while the export is in
  progress.
- Observe that upon completion, the progress bar is replaced by two
  button / links: Download & Regenerate.
- Observe that Download at the moment does nothing... this is because
  the backend is not yet hooked up to generate the epub.
- Observe that the Regenerate button triggers the process all over
  again.

Change-Id: I6cd844baa06db0c6648ad19389d235b89659919c
Reviewed-on: https://gerrit.instructure.com/62135
Tested-by: Jenkins
Reviewed-by: Matt Berns <mberns@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-09-30 16:22:18 +00:00
Dan Minkevitch 446930d0e2 Import Canvas assignments into existing matching groups
fixes CNVS-23337

Test Plan:
* Import an assignment into a course from another
  canvas course, making sure that the assignment
  is marked as "Group Assignment" and the group
  that it belongs to exists in both the source and
  destination courses
* The imported assignment should be imported
  as part of the existing group of the same name
  from the source course

Change-Id: I32446e1c15d643d33e8a2bb49e6b9381afe85ebe
Reviewed-on: https://gerrit.instructure.com/63717
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
2015-09-28 21:12:44 +00:00
Rob Orton d252a7f2b4 mobile css and js overrides
closes CNVS-19900

test plan:
 - create a brand_config for an account
 - apply brand_config
 - add ?mobile=1 to an api request that returns a
   body (like a wiki page);
   observe no additional stylesheets in the body
 - go to /accounts/self/, and go to brand
   config and upload a mobile_css_override
 - add ?mobile=1 and check the api result again
   your stylesheet should be there appended to the
   body of the wiki page
 - back in brand_config, remove the uploaded file
 - check your source again - there should not be
   an empty stylesheet tag

Change-Id: Ief728a397d185282a57f8cede0916c7ffe4a2584
Reviewed-on: https://gerrit.instructure.com/61885
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2015-09-28 19:24:55 +00:00
Jeremy Stanley c9856738d8 copy to final provisional grade
test plan:
 1. create a moderated assignment
 2. associate a rubric with the assignment
 3. add a student to the moderation set, using g/63360, or if that's
    not available yet, the Rails console:

assignment.moderated_grading_selections.create! student: student

 4. submit to the assignment as a student
 5. grade the assignment as a TA in speedgrader, commenting and marking
    the rubric in the process
 6. as a teacher, view the submission using the "Get a single submission"
    API endpoint, including provisional_grades, submission_comments,
    and rubric_assessment

GET /api/v1/courses/{course_id}/assignments/{assignment_id}/submissions/{user_id}?include[]=provisional_grades&include[]=submission_comments&include[]=rubric_assessment

 7. retrieve the provisional_grade_id from the above, to use in the next step
 8. as a teacher, call the copy_to_final_grade endpoint to copy the TA's
    provisional grade to the "final" provisional grade editable by
    moderators

POST /api/v1/courses/{course_id}/assignments/{assignment_id}/provisional_grades/{provisional_grade_id}/copy_to_final_mark

 9. as a teacher, repeat the GET from step 6 and ensure that the provisional
    grade appears twice, once with the TA as the scorer_id and once with the teacher
    - the teacher's entry should have final=true while the TA's is false
    - the comments and rubric assessment written by the TA should be included
      in the teacher's provisional grade, but still attributed to the TA's user id

closes CNVS-23300

Change-Id: Id09f828ddb4c262ef5452a62702a3a1828091486
Reviewed-on: https://gerrit.instructure.com/63563
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2015-09-25 22:24:23 +00:00
Brad Humphrey 64ef3becc7 Allow LTI tools to submit scores for 0 point assignments
fixes PLAT-1238

Change-Id: I601a3c81b7b10c13467dca15b4fe251dd032be18
Reviewed-on: https://gerrit.instructure.com/64033
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2015-09-25 21:29:59 +00:00
Andrew Butterfield 350a8a34e0 Submission api no longer causes 500 error
A regression happened that broke SIS grade pass back in the following
gerrit:

https://gerrit.instructure.com/#/c/62210/

fixes CNVS-23599

Test plan:
* Create a course
* Create an assignment
* Create a submission for that assignment
* Make an api call with:
   /api/v1/courses/<courseid>/assignments/<assignmentid>/submissions?include[]=user
* Ensure an internal server error does not occur and that the submission
  json includes a user for each submission.

Change-Id: I1c5bf4d88fe2e8ff8f9b73878e0860a06a566b7c
Reviewed-on: https://gerrit.instructure.com/63970
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2015-09-25 17:10:10 +00:00
Jacob Fugal e2f11f5542 don't try and eager load in a data fixup
fixes CNVS-21318

eager load will try and select all the columns of the joined table by
name. but due to race conditions, being in the middle of running
migrations, it's possible the process will know of a column that hasn't
been created yet. naming it in the select will break the query.

Change-Id: I71ddd01c77f8f6157e36a01103dff52b7b967284
test-plan: N/A
Reviewed-on: https://gerrit.instructure.com/63902
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2015-09-24 17:05:16 +00:00
Derek Bender 6258bd46a6 ensure a user's enrollments api works when given a grading period
fixes CNVS-22526

Test plan:

1. Obtain an account-level grading period id. A list of all
    grading period ids can be accessed through:
      /api/v1/accounts/self/grading_periods
2. Create a course and enroll a student in it. Note the
    student's id from the course's people page.
3. Create an assignment in the course due during the
    grading period.
4. Navigate to the gradebook, set the account-level
    grading period, and verify the assignment is in it.
5. Give a grade to the student's assignments
6. Call the API and verify that it responds with data.
    The response will contain "grades" which should
    correspond exactly to the info for the student in the
    grading period.
    The API itself will look like:
    /api/v1/users/:student_id/enrollments?grading_period_id=:grading_period_id

Change-Id: I6c1080345a338750402e86194503f3b0911a4da9
Reviewed-on: https://gerrit.instructure.com/63215
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2015-09-24 16:19:16 +00:00
Michael Nomitch 1936564adc dont save duplicate brand_config
fixes CNVS-23390

test plan:
  - make two sub accounts that are brandable
  - give each subaccount the same theme by
    changing a variable to the same thing
    - i.e. button color to "red"
    - apply the themes
  - on the parent account, change a color
    that is not the one you just changed on
    the children
    - preview the theme
    - apply the theme
  - you dont get an error when applying the theme
  - the change trickles down to the children properly

Change-Id: I8a9f0d33cc215fc6864178788faaab8644ada367
Reviewed-on: https://gerrit.instructure.com/63720
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2015-09-23 22:39:00 +00:00
Brad Horrocks 62eb09cdb6 As a OAuth consumer I want to get a refresh token during OAuth2 Registration
refresh token is now returned in oath registration

Fixes PLAT-1218

Test Plan:
Create a dev_key that has an invalid redirect_ur, this makes it easier
to subvert the oauth process later.

attempt to authorize your new key with a user. I used something like
blackmesa.canvas.dev/login/oauth2/auth?client_id=30000000000001&response_type=code&redirect_uri=http://blackmesa.dev/redirect&state=YYY

Sign in and authorize. You should be redirected to something similar to
http://blackmesa.dev/redirect?code=1c8d2ff5498eb879db9737d494a4bbd64810c84cf7e1776d1f4cebdb9699244c6209add4838d02f0d67b969a599cee589fecbeef5f84ababb1ef6e4cb9099b68&state=YYY

Take the code out of the url. open up
[postman](<https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en)
create a new post request with the following params
    code: #{code}
    client_id: #{your dev key's client id}
    client_secret: #{your dev key's client secret}

make sure the response includes a refresh_token property. A postman
request that can be imported [can be found
here](https://gist.github.com/defektive/f1cced73b08e5f6a2925)

 ________
< Thanks >
 --------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Change-Id: I8a8a8450825309232c903251231dec8c5d4e7463
Reviewed-on: https://gerrit.instructure.com/63256
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-09-23 20:59:34 +00:00
James Williams 02f67869f4 fix media comment link replacement in imported questions
test plan:
* create a quiz with a question with a bunch of
 text and a media comment
* export the course to a file
* re-import the course
* the quiz and question should work as before

closes #CNVS-22857

Change-Id: I309a6bd39d55bbc6959c4e89bd4d6ea1f3220c55
Reviewed-on: https://gerrit.instructure.com/63777
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Charles Kimball <ckimball@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-09-23 19:35:01 +00:00
Michael Nomitch 8f443fe92d subaccount theme progress bars
fixes CNVS-22541

test plan:
  - go to account that has sub accounts
    with their own themes already made
  - redo the style of the parent account
  - hit Apply
  - you see the progress of each of the children
  - each child progress bar goes away when
    it is done
  - once all are done you are redirected to the
    account settings page

Change-Id: I109ed9f17acd549dc527a3c62813aeb3ab1bc634
Reviewed-on: https://gerrit.instructure.com/62392
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
Product-Review: Colleen Palmer <colleen@instructure.com>
2015-09-22 16:17:59 +00:00
James Williams 3d62ae80a8 turn on and remove nc_or feature flag
closes #CNVS-22745 #CNVS-22790

Change-Id: I7e3287c6e4a55d2f735004b2f58470ec62471e50
Reviewed-on: https://gerrit.instructure.com/62948
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-09-22 12:16:39 +00:00
Brad Horrocks a11fdec9f6 Make LTI configurations accept canvas icon class
Support passing a class for an icon for styling goodness.

added support for `canvas_icon_class` allowing use od css classes from canvas
style guide which can make it look better and maintain our styling
standards.

Fixes PLAT-1222

Test Plan:

prereq's
- "LOR External Tools" feature flag enabled
- (notice the lack of lti example tool, you dont need it)

A new commons icon has been added so you should probably run the
following
`bundle exec rake brand_configs:clean canvas:compile_assets`

Add a new LTI tool to the account using [this xml](https://gist.github.com/defektive/dbd182cb04500e236bde)
check placements to make sure they show a fancy new icon instead of a
crappy star. course_home_sub_navigation should show up as the commons icon

placements to look at
:assignment_menu - cog on an assignment
:course_home_sub_navigation - right side of page
:course_settings_sub_navigation
:discussion_topic_menu
:file_menu (no icon)
:global_navigation (no icon)
:module_menu
:quiz_menu
:wiki_page_menu

Change-Id: Ib462e928a5a3811df490f9bf2441b755db2882a9
Reviewed-on: https://gerrit.instructure.com/62492
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-09-21 17:59:40 +00:00
Nathan Mills 214cc361d5 Use global asset strings for generating lti_context_id
fixes PLAT-1189

test-plan:
Before you cherry pick do a bunch of launches and record the resource_link_id, and the context_id
cherry pick this commit
do the exact same launches and make sure the resource_link_id, and context_id did not change between this code change

Change-Id: I0852cf19e62fc4b662cd71e0497004bcf8e440d0
Reviewed-on: https://gerrit.instructure.com/63008
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-09-21 16:10:21 +00:00
Nathan Mills 00f5e79abe set expiration time for oauth2 generated access tokens
fixes: PLAT-1220

test-plan:
*using the oauth flow generate an access token
*you shouldl get an expires_in time with the token
*the token should expire after the expire_in time lapses

Change-Id: If25bea7a11dbd0c8e717d53eb131fdae6c156606
Reviewed-on: https://gerrit.instructure.com/62951
Tested-by: Jenkins
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-09-21 16:10:13 +00:00
James Williams 2dad511048 preload attachments in calendar events public feed
test plan:
* basic regression test the calendar events public feed api

closes #CNVS-22774

Change-Id: I0a21788d25c63b404a4c6410f5d01e785bed1ed8
Reviewed-on: https://gerrit.instructure.com/62941
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Charles Kimball <ckimball@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
2015-09-21 14:22:26 +00:00
James Williams df8399a834 performance improvements for assignment overrides, etc
- preload context module data for student assignments
 in calendar_events_api (improves locked_json)
- preload adhoc assignment overrides
 (i.e. assignment_student_overrides) instead of doing
 N+1 queries
- search the preloaded assignment_overrides when possible
 instead of calling yet another query

test plan:
* regression test assignments api index, assignment groups
 api index, calendar events api index, in particular
 with regards to assignment overrides

refs #CNVS-22774

Change-Id: I5c027e346c733ce0dac2fcd702c5272ff861d1b3
Reviewed-on: https://gerrit.instructure.com/62892
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Charles Kimball <ckimball@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
2015-09-21 14:22:16 +00:00
James Williams d0689a15a2 improve performance in assignments/assignment groups api index
test plan:
* assignments and assignment groups api index should
 work as before

closes #CNVS-22864

Change-Id: I4b72f0fd5d5a8dc40a7669ee3929c60ddc401114
Reviewed-on: https://gerrit.instructure.com/62851
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Charles Kimball <ckimball@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
2015-09-21 14:22:05 +00:00
Brandon Broschinsky a25fe068c9 add notes option in scheduler
fixes: PFS-2584

**Test Plan
1. create new appt. group
2. as student reserve a slot in the appt. group
3. enter comments for the appt. and save
4. validate that on appt. popup it shows entered comments
5. as teacher view the appt. group slot the student reserved
6. should show comments the student entered.

Change-Id: I6e20c16da1fcbf1555ac22c011b2bf7a5db8eb67
Reviewed-on: https://gerrit.instructure.com/63129
Tested-by: Jenkins
QA-Review: Adrian Russell <arussell@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2015-09-18 20:31:08 +00:00
Cody Cutrer 2c2e687e59 qualified names fixes for migrations
refs CNVS-21900

Change-Id: I6b7e323e3c700aee3a7c86cb8f06fce78e5606df
Reviewed-on: https://gerrit.instructure.com/63384
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-09-17 22:03:28 +00:00
Josh Orr dd185220bf Add group favorites
Adds group context to user's favorites.  Adds favorite_for_user? method to groups.
Adds get "users/self/favorites/groups"
     post "users/self/favorites/groups/:id"
     delete "users/self/favorites/groups/:id"
     delete "users/self/favorites/groups"
endpoints to favorites api.

Corrected get "users/self/favorites/groups" to return all user's groups if no groups are favorited.

Adds ?include[]=favorites option to groups api.

Fixes PLAT-1213

test-plan:
Using PostMan or other API test tool:
List group favorites using either the Group or favorite endpoint, verify that the test user has no group favorites
Add 4 groups and make the test user a member of 3 of them
Use the favorites endpoint to add 3 of the test group as  favorites.
List group favorites using the endpoint not used above.  Verify that 3 of the groups are favorites and one is not.
Use the favorites api to remove one of the groups from favorites
List group favorites and ensure that the 2 correct groups are marked as favorites
Use the favorites api to clear all group favorites
List group favorites to ensure that there are no group favorites

Change-Id: Id7b92126f9c2a34b3a301640e925aa26c494c26a
Reviewed-on: https://gerrit.instructure.com/62301
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Matthew Rice <mrice@instructure.com>
2015-09-17 19:22:54 +00:00
Cody Cutrer 2e5d300041 some optimizations for DiscussionTopics#index
avoid an unnecssary join, and an unnecessary round-trip through ruby

test plan:
  * load discussions page for a course

Change-Id: I22f7cecb9a83e2112bddb9ed0f1e4fa0e17f83b1
Reviewed-on: https://gerrit.instructure.com/63419
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-09-17 16:15:56 +00:00
Alex Boyd 2957135958 Hide recurring calendar events feature flag
Fixes CNVS-23267

Test plan:
 - As an account admin who is not also a site admin, view the
   account's feature flags and make sure that recurring calendar
   events does not show up in the list
 - As a site admin, view the feature flags again and make sure
   that recurring calendar events shows up this time

Change-Id: I881632535e7d295b388c14d84d82246c4d8a38fa
Reviewed-on: https://gerrit.instructure.com/63398
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Adrian Russell <arussell@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
2015-09-16 18:48:11 +00:00
Brad Horrocks 1aff77fe8b allow deactivating developer keys
Fixes PLAT-1232

test plan:
* go to developer keys UI
* you should be to deactive and reactivate keys
* deactivate a key that you have a token for
* the token should no longer work, even though it's not expired

Change-Id: I7388226c710ab0841692902886a49146a037e615
Reviewed-on: https://gerrit.instructure.com/50008
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-09-16 18:31:33 +00:00
James Williams 88b5e8e101 improve outcome results controller performance for large numbers
avoids large queries when the course has a lot of outcomes

test plan:
* regression test outcome results api

closes #CNVS-12716

Change-Id: I9752ebcc605f52eaee81d934308a7b0850032abe
Reviewed-on: https://gerrit.instructure.com/62260
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-09-16 16:28:21 +00:00
Andrew Huff df632b6020 ensure turnitin assignment names are unique
fixes CNVS-22602

This modifies assignment titles by appending their canvas id to the
title on the assignment model that we send to turnitin. This ensures
that turnitin will always see a unique title, which should fix the bug
that has caused a few recent support weeks. (see JIRA ticket for
details)

Also, cleans up some specs as per betterspecs.org

Also, fixes some specs that didn't work as intended

Test plan:
  * As the teacher, create a turnitin assignment
  * As the student, submit a submission to this assignment. (make sure
    it's fairly lengthy or turnitin will silently fail to process it)
  * As the teacher, wait for turnitin to process the submission
  * View the submission in turnitin
  * Verify that the assignment title in turnitin's interface has the
    assignment's ID between the assignment's name and the assignment's
    due date (for example, it might be called "My Assignment - 123 - DUE
    AUG 21 2015".)

Change-Id: If9dde5846499c3fa9692eb903894343be7cec584
Reviewed-on: https://gerrit.instructure.com/61524
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2015-09-16 16:03:59 +00:00
Nathan Mills 2ddd5e7e67 add error message for exceded turnitin lti retries
fixes PLAT-1208

test-plan:
submit a turnitin assignment via lti
make sure it doesn't break
there isn't a good way to simulate an error so the focus should be on us not breaking anything

Change-Id: I4d1dc2ca15af2226e0151be2ce1837435fea1fa0
Reviewed-on: https://gerrit.instructure.com/62408
Tested-by: Jenkins
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-09-15 20:55:57 +00:00
Michael Nomitch 0ae1969b67 dont require global includes for a root account theme editor
fixes CNVS-23140

test plan:
  - in root account settings turn
    allow_global_incldues off
  - root account can still access
    theme editor
  - child accounts cannot
  - turn allow_global_incldues on
    and sub_account_includes on
  - you can still access them editor
  - child accounts can as well

Change-Id: I88008b06547aedf28d95025d38ed660e74868260
Reviewed-on: https://gerrit.instructure.com/62983
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-09-15 19:20:58 +00:00
Derek Bender 70a179ab0c add user_summary to submission_json
- new submission_json API include key 'user_summary' for provisional
  grades front-end
- extracted ModeratedGrading::NullProvisionalGrade to its own file.
- added the scored_by scope to ProvisionalGrade
- minor refactors to user_display_json
- minor refactors to submission_json & submission_provisional_grades_json

test plan:
- hit the submissions_api index action and include[]=user_summary
- ensure users are listed with their submissions

closes: CNVS-22974

Change-Id: Ia1248859bb0d34aab1940a4b38a034bbf3f244ae
Reviewed-on: https://gerrit.instructure.com/62210
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Derek Bender <djbender@instructure.com>
2015-09-14 23:25:01 +00:00
James Williams ad5bc644c8 move the modules student view "enhancements" out of the erb
test plan:
* the modules page for students should actually work now

* there should be no view caching issues
* only the students' own submissions should be used to
 show progress on the page

* should have useful icons and tooltip information

closes #CNVS-22897

Change-Id: Ic3651f1b587427cfca1a38f0386f70ed46f3bae4
Reviewed-on: https://gerrit.instructure.com/62590
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-09-14 20:43:12 +00:00
Keith Garner 5e89f78e34 during gradebook import pass_fail partial scores passes, 0 fails
During Gradebook imports with pass_fail scores, points possible as
well as partial points in the CSV are considered passing.  0 will be
considered as failing. (The words "complete" and "incomplete" can
still be passed.)  Furthermore, the confirmation screen now reports
"complete" or "incomplete" instead of the points being imported For
the canvas user, this will result in a clearer understanding of the
grade changes happening as a result of the import.

fixes CNVS-21255
fixes gh-624

test plan:
  - Create a course with a student and 5 pass_fail assignments with 4
    points possible
  - In the gradebook:
    - Leave three assignment as null
    - Set one assignment to complete
    - Set one assignment to incomplete
  - Export the current gradebook to CSV
  - Edit the CSV to:
    - Set the first null assignment to 4 points
    - Set the second null assignment to 1 point
    - Set the third null assignment to 0 points
    - Set the complete assignment to 0 points
    - Set the incomplete assignment to 1 point
  - Import the CSV back into the gradebook
  - Observe:
    - On the confirmation screen the words "complete" and "incomplete"
      are used
    - The first null assignment shows as complete
    - The second null assignment shows as complete
    - The third null assignment shows as incomplete
    - The complete assignment now shows as incomplete
    - The incomplete assignment now shows as complete

Change-Id: I92921a3d88ad64f069573a2b27c41936151cec3c
Reviewed-on: https://gerrit.instructure.com/62206
Reviewed-by: Cody Poll <cpoll@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Tested-by: Jenkins
Product-Review: Keith T. Garner <kgarner@instructure.com>
2015-09-14 16:41:31 +00:00
Alex Boyd ac7e972311 Let StatsD know when messages are sent via Twilio
Fixes CNVS-21546

Test plan N/A (just regression test international SMS messaging)

Change-Id: I135bef152b61b798208548835af20222a65f6b00
Reviewed-on: https://gerrit.instructure.com/61407
Tested-by: Jenkins
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Alex Boyd <aboyd@instructure.com>
2015-09-14 15:46:52 +00:00
Alex Boyd 0fc41e8d5a Send messages via Twilio
Fixes CNVS-21548, CNVS-20625, CNVS-21580

Test plan:
 - Copy config/twilio.yml.example to config/twilio.yml
 - Configure config/twilio.yml with credentials from a Twilio
   account
 - Create a user
 - Enable the international_sms feature flag for the account
   of the user you created
 - Create a communication channel from a Rails console, using
   a phone number with which you can test. Assuming
   1-801-555-0100 as the phone number, and assuming that the
   id of the user that you created is 42, you can do that with:
     User.find(42).communication_channels.create!(
       path_type: 'sms', path: '+18015550100')
 - As a site admin, confirm the user's communication channel
 - Cause a notification to be sent to the user
 - Ensure that you receive a text message
 - Multiple outbound numbers (will need a paid Twilio account
   to test):
   - Configure config/twilio.yml with credentials from a
     Twilio account that has multiple outbound phone numbers
   - Create multiple users and add new phone numbers for each
     using the above steps, and confirm them
   - Cause notifications to be generated for each user and
     ensure that they come from different phone numbers
     - You may need to test several phone numbers before a
       notification is sent from a different number
   - Cause more notifications to be sent and ensure that each
     phone number receives notifications from the same
     outbound phone number every time

Change-Id: I103c93a8096acaaabd29530b0a0b5c43bc05c26b
Reviewed-on: https://gerrit.instructure.com/59901
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2015-09-14 15:46:23 +00:00
Alex Boyd 6039fd0506 Allow entry of international phone numbers
Fixes CNVS-20605

Test plan:
 - Enable the international SMS feature flag
   - You can do this from a console with this, assuming your root
     account's id is 1:
       Account.find(1).enable_feature!(:international_sms)
 - As a test user, pull up your settings page
 - Under "Other Contacts", click "Add Contact Method"
 - Verify that you see two fields, "Country" and "Cell Number"
 - Verify that the country names and country codes presented in the
   "Country" dropdown are as given in the AC of CNVS-20605
 - Click "Reigster SMS" and verify you get a popup saying that
   "Country is required"
 - Select "Belgium (+32)" from the dropdown
 - Verify that no extra fields show up
 - Click "Register SMS" and verify that you get a popup saying
   that "Cell Number is required"
 - Enter "12345", then click "Register SMS"
 - Ensure that a box pops up saying that "We sent a four-character
   confirmation code to +3212345".
 - Close the dialog, then click "Add Contact Method" again
 - This time, select "United States (+1)"
 - Regression test this part of the dialog - it should work as
   it always has
 - Regression test adding email addresses via the "Email" tab as
   well
 - Disable the international SMS feature flag
   - You can do this with:
       Account.find(1).disable_feature!(:international_sms)
 - Regression test both adding email addresses and adding phone
   numbers and verify that they work as they did before, with
   no mention of the ability to select different countries

Change-Id: I83982d1ee1fc3e22dced29fd28a714333e531899
Reviewed-on: https://gerrit.instructure.com/59811
Reviewed-by: Joel Hough <joel@instructure.com>
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
2015-09-14 15:46:17 +00:00
Cody Cutrer 95df6788db exclude non-active e-mail address from user search
fixes gh-689

test plan:
 * see the github ticket

Change-Id: I90a29ca9b898c72e4aeb4c0a00ebcb3d91dd1880
Reviewed-on: https://gerrit.instructure.com/62996
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-09-11 16:56:48 +00:00