Commit Graph

8553 Commits

Author SHA1 Message Date
Cody Cutrer 3d6658f0ce accept t/f for boolean in Api
and document boolean parameter formats

Change-Id: I70b295e93c6f19b471bfc6f4b31f3a7c3642d8f4
Reviewed-on: https://gerrit.instructure.com/70861
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-01-26 02:50:09 +00:00
Simon Williams 6a39d7a0c3 spec: fix coffeescript module namespaces
in qunit, tests run in the namespace of the last module call that
happened. so if you say:

  module('module1');
  test('test1', function() { ... });

then test1 runs in the namespace of module1.  you can pass module1 an
object as a second argument which are functions that will be defined in
the module namespace, and some modules (like setup and teardown) have
special functionality.  unfortunately, you can also pass a test in the
module object and it will happily run, but in the namespace of the
previous module definition.

this is all exacerbated by coffeescript! because in coffeescript:

  module 'module1'
  test 'test1' -> ...

is correct, but

  module 'module1',
  test 'test1' -> ...

runs the test in the previous namespace.  notice the difference? ONE
COMMA! I did an audit of these instances and fixed as many as I could
fine, as well as one legit test issue that came out of fixing them.

Change-Id: I79ea0c673df49e6c09151b50cf765ed9ec760a0d
Reviewed-on: https://gerrit.instructure.com/70950
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
2016-01-26 02:48:26 +00:00
Jon Jensen 9c0b4c999d spec: simplify login/session helper methods
this rabbit hole refactor stems from an observation that destroy_session
could be a no-op (depending on the previous spec), and typically wasn't
useful/necessary. remove lots of other unnecessary stuff, and delineate
more clearly between fake and frd logins

test plan:
1. modified specs (including P2) should all pass
2. all other specs should pass

Change-Id: I8cda5d81f3797c3bb39b98f80c846d346ea36150
Reviewed-on: https://gerrit.instructure.com/70863
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-01-26 02:32:01 +00:00
Jon Jensen 693641626e spec: randomize spec run order
this should make it easier to get past ordering issues during the rerun
phase and retriggers. conversely, this will also expose more flaky tests
lurking in the suite, so we can fix them

test plan:
1. specs should pass
2. it should still say "Randomize with seed N"
3. it should actually be randomized

Change-Id: Ie109ec79290aa32727d8027ca0ae9cb3e07ce8ef
Reviewed-on: https://gerrit.instructure.com/70891
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-01-25 23:01:21 +00:00
MFairbourn 43c8c25b2a spec: fix fragile spec in speedgrader_discussion_submissions_spec
Test Plan:
-Code review
-Specs pass

Change-Id: I73ead75c816d68faba45fc556d961d4ec2dcdbb2
Reviewed-on: https://gerrit.instructure.com/70942
Reviewed-by: Pedro Fajardo <pfajardo@instructure.com>
Tested-by: Jenkins
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2016-01-25 21:41:35 +00:00
MFairbourn f7e1b26f15 spec: fixing a fragile outcome group spec
Test Plan:
-Specs should pass
-Code review

Change-Id: I9e5835dfdb193c726f03aa72d4d378a1b84f6491
Reviewed-on: https://gerrit.instructure.com/70934
Reviewed-by: Pedro Fajardo <pfajardo@instructure.com>
Tested-by: Jenkins
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2016-01-25 18:36:33 +00:00
MFairbourn fe7f893ea5 spec: Checks discussion on main page in seperate test
Test Plan:
-Specs should pass
-Code Review

Change-Id: Ifff8b0e7c38d8fdd55e95dc34844a438be083ffb
Reviewed-on: https://gerrit.instructure.com/70902
Tested-by: Jenkins
Reviewed-by: Pedro Fajardo <pfajardo@instructure.com>
Product-Review: Pedro Fajardo <pfajardo@instructure.com>
QA-Review: Pedro Fajardo <pfajardo@instructure.com>
2016-01-25 16:52:45 +00:00
Brian Palmer d2410941ef move user_id to dedicated errors report field
closes CNVS-26758

Sentry has a dedicated field for this now, opening up additional
functionality such as a count of affected users for each error.

test plan: enable sentry and trigger an in-request error, the error
report will now include your user id in a separate "user" section.

Change-Id: Ia58d54b923f7daa67e2ce060c02f0cfa0494387d
Reviewed-on: https://gerrit.instructure.com/70918
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2016-01-23 20:07:19 +00:00
Ethan Vizitei f5fab37bd6 spec: stabilize groups_teacher_spec
refs CNVS-25916

this spec fails reliably when not all the events have re-bound
yet after switching the leader position of the student.  Adding
a normal ajaximations reliably solves the fragility in local
and jenkins node tests.

TEST PLAN:
 1) groups_teacher_spec:167 should stop being the most common
    fragile spec

Change-Id: I68d39a0566b183d3fb81c6eded599145fda9fc67
Reviewed-on: https://gerrit.instructure.com/70901
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2016-01-23 03:06:01 +00:00
Ryan Taylor 55557f7fa1 Redesign the quiz_stats page for a11y/UI reasons
This rearranges and redefines much of the user experience on this page.

The score distribution chart is now rendered in HTML from React. Other
charts on the page have been rearranged or tweaked to match the new UI
design.

The new table contains all the screenreader data required, there are no
longer tooltips to be rendered on each score column (now a horizontal bar).
The bar chart is not read to screenreaders.
The bar chart indicates correctness by more than color alone.
The donut chart contains "N% responded correctly" in the center
The donut chart is not read by screenreaders, other than a brief
explanatory message.

Closes CNVS-25737
Closes CNVS-25738

Test Plan:

- Full test of quiz stats for both a11y and basic functionality
- Confirm that webpack and require_js builds are working
- Make sure it looks good!

Change-Id: Ie3f1a2ae99e7b2eea56e97e1cb5b6d3f51b83792
Reviewed-on: https://gerrit.instructure.com/70164
Tested-by: Jenkins
Reviewed-by: Davis McClellan <dmcclellan@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Jason Sparks <jsparks@instructure.com>
2016-01-22 22:22:30 +00:00
Davis McClellan 5d13f410e4 Check if a reviewer is the same person as the student
fixes CNVS-23960

test plan:
- Create a peer review assignment with a rubric
- Assign the review to the same student who submitted it via the api
- Ensure that api does not allow this to happen
  (should get a 400 error)

Change-Id: I0cdd3a7856b21c77315f060ef4ffbbd53b32b25e
Reviewed-on: https://gerrit.instructure.com/70498
Tested-by: Jenkins
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Davis McClellan <dmcclellan@instructure.com>
2016-01-22 22:18:41 +00:00
Alex Boyd f91d1bc9c1 spec: fix spec failures introduced by the to-do list rewrite
Fixes CNVS-26697

Test plan N/A

Change-Id: Iab7225c5f207476b47d65198958d96f7288f1ab4
Reviewed-on: https://gerrit.instructure.com/70844
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins
Product-Review: Alex Boyd <aboyd@instructure.com>
QA-Review: Alex Boyd <aboyd@instructure.com>
2016-01-22 20:48:24 +00:00
James Williams c06f95d270 rails 4.2: fix controller, integration and view specs
refs #CNVS-26056

Change-Id: I854a085afc6bff640c814098956344efff65f1a7
Reviewed-on: https://gerrit.instructure.com/70658
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-22 20:01:11 +00:00
Jonathan Featherstone 0db9ae3260 Add notification failure processor
Using the new notification_service allows us to provide more specific
failure feedback to canvas.  When we enqueue a message to the
notification service, we pass along the canvas global message id.  If
the message fails to send, we enqueue a failure message to a
"notification_failure" sqs queue, and reference the global message id.
This allows us to write failure information off to the canvas message
object and put it into an error state.

Test Plan:
  * Start local fake_sqs environment

If using docker
`$ docker pull feathj/fake-sqs`
`$ docker run -it -p 9494:9494 -e VIRTUAL_HOST=sqs.docker feathj/fake-sqs`

If running native
`$ gem install fake_sqs`
`$ fake_sqs`

  * Create `<canvas>/config/notification_failures.yml` file and place
    the following in it:

If using docker
```
development:
  use_ssl: false
  sqs_endpoint: sqs.docker
  sqs_port: 9494
  access_key_id: access key id
  secret_access_key: secret access key
```

If running native
```
development:
  use_ssl: false
  sqs_endpoint: localhost
  sqs_port: 4568
  access_key_id: access key id
  secret_access_key: secret access key
```

  * Create a canvas message to put in error state
    * Login to canvas
    * Create new conversation message
    * Open rails console and confirm that message.state is not
      "transmission_error", also take note of message id
  * Start canvas jobs, from canvas-lms directory:
`$ bundle exec script/delayed_job run`

  * Manually enqueue failure message to fake_sqs
```
require 'yaml'
require 'aws-sdk'
require 'aws-sdk-core'
require 'aws-sdk-resources'
require 'aws-sdk-v1'

client = AWS::SQS::Client.new(
  use_ssl: false,
  sqs_endpoint: '<YOUR_SQS_HOST>',
  sqs_port: <YOUR_SQS_PORT>,
  access_key_id: 'access key id',
  secret_access_key: 'secret access key'
)
client.create_queue(queue_name: 'notification-service-failures') rescue
nil
queue_url = client
  .list_queues[:queue_urls]
  .reject { |queue| /dead/i.match(queue) }
  .detect { |queue| /notification-service-failures/.match(queue) }

puts queue_url
puts client.send_message(queue_url: queue_url, message_body: {
  'global_id' => <YOUR_MESSAGE_ID>,
  'error' => 'the message failed to send amigo'
}.to_json)
```
  * Verify that message is state is set to "transmission_error" and the
    transmission_errors field has your error message

closes CNVS-26442

Change-Id: Ic379142727d4e186ae3032241caca1b1e4c5e074
Reviewed-on: https://gerrit.instructure.com/70447
Reviewed-by: Christina Wuest <cwuest@instructure.com>
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
2016-01-22 19:23:55 +00:00
James Williams 9531a37afd rails 4.2: fix scope.new calls
scope.new no longer keeps the record out of the association

refs #CNVS-26056

Change-Id: I5867253645c1020cde8853ccc389a0730c241652
Reviewed-on: https://gerrit.instructure.com/70788
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-22 16:54:37 +00:00
Cody Cutrer 790664445b rename distinct to distinct_values
to no longer hide the Rails 4.0+ method of the same name

Change-Id: I979fd002c9bb6b168d3d8fd9998545c2d217e68d
Reviewed-on: https://gerrit.instructure.com/70806
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-01-22 14:51:17 +00:00
James Williams 4f9a25a79c rails 4.2: fix migration methods + unhack things
fixes index_exists?, add_index, remove_index, and
 add_foreign_key method calls in migrations

unhacks remove_index to fail silently if the index
 doesn't exist (and removes some unnecessary remove_index calls)

also fixes migration specs for rails 4.2

refs #CNVS-26056

Change-Id: Id878aa4cb871fc5ae6d0d4e7c6e8cfe1c5d88d35
Reviewed-on: https://gerrit.instructure.com/70692
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-22 14:17:36 +00:00
James Williams 6fc3fd2b2c rails 4.2: fix application helper spec
refs #CNVS-26056

Change-Id: I05a4e41493c271d12f54270950dafa5fd323b4c5
Reviewed-on: https://gerrit.instructure.com/70749
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-22 14:17:06 +00:00
Spencer Olson ce9a054c1d gradebook: fix text on "Switch to points" toggle
when toggling between 'Switch to points' and
'Switch to percent' in the gradebook, the
text will now appropriately change when toggling.
before this fix, the text would not change when
clicking the toggle.

closes CNVS-26013

test plan:
1. Create a course, or open a course with no
   assignment weighting.
2. Go to the Gradebook and click on the Total
   column drop down.
3. Click "Switch to points"
4. Click "Ok" in the modal that pops up.
5. Without refreshing the page, click on the
   dropdown on the Total column again.
6. Verify the text now reads "Switch to percent"
7. Click "Switch to percent"
8. Click "Ok" in the modal that pops up.
9. Without refreshing the page, click on the
   dropdown on the Total column again.
10. Verify the text now reads "Switch to points"

Change-Id: Ib17df940954d0bb73305e41b91bdf48da550788a
Reviewed-on: https://gerrit.instructure.com/70624
Reviewed-by: Strand McCutchen <smccutchen@instructure.com>
Tested-by: Jenkins
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2016-01-22 05:04:42 +00:00
Jon Jensen f61ccb21d1 spec: don't let invalid _csrf_token break subsequent specs
the vast majority of specs stub out login stuff, so this cookie never gets
set or used (csrf token on the page trumps it). however, frd logins (and
their specs) do care about this cookie. so make sure we clean up after
ourselves.

test plan:
1. oauth_spec.rb and terms_of_use_spec.rb should always pass when they
   follow this spec

Change-Id: I87a9158b0b401e7afea1875853c52a156ffd8af7
Reviewed-on: https://gerrit.instructure.com/70791
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Jenkins
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-01-21 22:42:10 +00:00
Brian Palmer 186603294e spec: fix fragile spec due to undefined response ordering
Change-Id: Ibd870d0b9bdf3c9d1e5893f094009bb8a901a01d
Reviewed-on: https://gerrit.instructure.com/70792
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2016-01-21 21:17:51 +00:00
James Williams 5881701e8c rails 4.2: api spec fixes
refs #CNVS-26056

Change-Id: I082e29c642b9150260f6571f0aa8ef397c6e2cca
Reviewed-on: https://gerrit.instructure.com/70593
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-21 16:14:03 +00:00
Simon Williams 64464bb39f querying enrollments_api#show with invalid account returns 404
we may eventually want to support querying by subaccount, but for now we
want to fix an error where the user got a template error instead of
a 404.

fixes CNVS-26628

test plan:
- create a course in a subaccount
- create an enrollment and note the id
- query /api/v1/accounts/:sub_account_id/enrollments/:id
- you should get a 404

Change-Id: I3c453d32152df6339df020d38025338cd4981039
Reviewed-on: https://gerrit.instructure.com/70635
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2016-01-21 15:49:54 +00:00
Cody Cutrer 9e085fa446 prevent duplicate singleton auth providers via API
test plan:
 * using the API, try to create a Facebook auth provider multiple times
 * it should only succeed once

Change-Id: Ib3bfff9a5cd933bca00304d3cecf19abeb653677
Reviewed-on: https://gerrit.instructure.com/63265
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-01-21 01:13:19 +00:00
Nathan Mills f94d1a5d98 handle underscores in tool launch urls and domain field
fixes PLAT-1300

test plan
install a tool that uses and underscore in the domain or subdomain
try and launch the tool
it shouldn't throw a canvas error

Change-Id: I91164574be94e7e10d5e9820d0ecef48a5503005
Reviewed-on: https://gerrit.instructure.com/70044
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2016-01-20 22:38:15 +00:00
Cody Cutrer 81026ae0ca clarify if a pseudonym can have a password
fixes CNVS-22672

test plan:
 * have both canvas and non canvas auth configured on an account
 * add a pseudonym not linked to an auth config
 * you should still be able to change the password both as an admin
   and on the /profile/settings page
 * add an SIS id to the login
 * you should be able to change the password as an admin, but not on
   the /profile/settings page
 * create a login explicitly linked to the non canvas auth
 * you should not be able to change that password on either page
 * create a login explicitly linked to canvas auth, with an SIS ID
 * you should be able to change the password on either page

Change-Id: I68ee27d36dc5eb20ca81a145dd097f3f8f37b155
Reviewed-on: https://gerrit.instructure.com/63817
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
2016-01-20 21:43:21 +00:00
Brian Palmer 8d723a7c61 api doc request parameter formatting
refs CNVS-26515

Request params are now formatted in an HTML table, with separate fields
for name, type, required/optional, valid enum values, and description.
This is at the same time more compact and more readable.

To parse this information out of what is actually free-form text
comments, I'm re-using the OpenAPI (swagger) parsing code, which I
tweaked and simplified slightly. Eventually I'd like to see the whole
API documentation generated from the OpenAPI spec, and then we can
slowly move away from using free-form code comments to more declarative
code constructs, but still generate an OpenAPI spec and get the same API
docs.

test plan: Generate the api documentation, and view request parameter
information. you should see the new formatting.

Change-Id: Ida00869d96a9b2d9fa84c29079ddf2511a2d5917
Reviewed-on: https://gerrit.instructure.com/70485
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2016-01-20 21:09:48 +00:00
Ryan Shaw abd2df3e7a load custom css/js for high contrast in newUI
In new UI, load custom CSS / JS even for users
that have High Contrast turned on.

closes: CNVS-22656

Originally, we tried to just say that to ensure schools
could not mess up their own high contrast compliance,
we would not load custom css or js for high contrast
users in NewUI.

This was problematic for things like the school using
js to add a custom help menu or something that the rest
of their classmates would see but the high contrast
user would not see. or using some "display: none"s in
css to hide things that they didn't want people to see,
but the high contrast users would still see.

This change makes it so custom css and js overrides
are loaded for high contrast users too. that means that
there is a possibility that the school could mess up
high contrast ratios with their css but I think given
the problems above this is the best we can do.

Product reviewers: (colleen, dana, aaron) please
review this description and + or - 1 if you agree.

test plan:
* turn on high contrast in New UI
* any custom css/js file you have set for your account
  (or any of your account's parents) should be loaded

Change-Id: I72ed06688f0b7b131ec00c2ea6031597277e7445
Reviewed-on: https://gerrit.instructure.com/69941
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Dana Danger <dana@instructure.com>
2016-01-20 20:56:39 +00:00
Simon Williams 727b3098d8 render bad_request on saml logout when aac cannot be found
fixes CNVS-26484

test plan:
- set up a saml idp
- sign logout requests with an invalid issuer (idp_entity_id)
- you should get a 400 response.

Change-Id: I45b912f41c15777d82fa09aed3e067fd2f47155c
Reviewed-on: https://gerrit.instructure.com/70295
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2016-01-20 20:56:09 +00:00
Ethan Vizitei 3fe135ca69 stabilize discussions spec
refs CNVS-25916

the click_option calls use "fj" which doesn't wait for load time,
and so they often fire before the right stuff has loaded.  Add
checks to make sure the page is loaded before proceeding to interact
with it.

TEST PLAN:
 1) discussions/discussions_edit_page_spec pass rate should increase

Change-Id: I4cd6cfc9cae650394fc5c93f098a63ef67ee03a5
Reviewed-on: https://gerrit.instructure.com/70657
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2016-01-20 20:37:11 +00:00
Ethan Vizitei aff49d9c6a spec: stabilize calendar2_event_create_spec
refs CNVS-25916

this line fails a lot because the calendar hasn't quite loaded yet.
Make sure the calendar is present and visible before continuing
the spec.

TEST PLAN:
 1) calendar2_event_create_spec pass rate should increase

Change-Id: Iab573163a296357f3dfa0e8e70f789b11010402b
Reviewed-on: https://gerrit.instructure.com/70662
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2016-01-20 20:35:25 +00:00
Derek Bender 37ea2c4e9b Add missing submission comments in speedgrader
Previously, speedgrader would omit comments from the submitting student
for group assignments when the submitter unchecked "Send Comment to the
Whole Group"

This will look across all submissions within group and collect all unique
comments for display.

fixes: CNVS-20346

Test Plan:
 - create and publish a course with at least 2 students
 - add the students to a group
 - create a group assignment and publish it
 - as the first student, submit and leave a comment, do not check
     the box that says "Send Comment to the Whole Group"
 - go to the submission and leave another comment without checking the box
 - masquerade as the non-submitting student and repeat the above step
 - stop masquerading and go to speedgrader
 - both comments should be present
 - this should be the same as the submission details page and in gradebook

Change-Id: I9955804202f4381d8afc0fbe3e5dc23b3ca94747
Reviewed-on: https://gerrit.instructure.com/69547
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-01-20 20:01:14 +00:00
Amber Taniuchi 05c104c745 add validation for crocodocable document in firefox
crocodoc/canvadoc annotations have some issues in firefox
so we display a warning for those using firefox. Previously
we were only checking for Canvadoc annotations settings,
but adding further check for crocodocable document so
that the warning shows up anytime a document is
annotatable via crocodoc since Canvadocs are not
available to everyon yet.

fixes CNVS-23286

Test Plan:
1. In /plugins/crocodoc, enable crocodoc
2. In /plugins/canvadocs, enable both canvadocs and annotations
3. Create an assignment that accepts file uploads
4. Create a submission with a pdf
5. Open speedgrader for this assignment in FF
Verify: You see a green flash message at the top that says,
"Warning: Crocodoc has limitations when used in Firefox.
Comments will not always be saved."
6. Do the same thing in Chrome
Verify: You don't see a flash warning about FF
7. Also repeat steps above except with an assignment that accepts
url submissions only.
Verify: In FF, that you don't see a flash warning about FF and
annotations since url submissions are not previewable with
crocodoc.
8. Disable Canvadoc annotations (remove checkbox and apply in plugins)
9. Repeat step 5 and verify warning still shows up in FF
10. Create an assignment that has turnitin enabled
11. Submit to the assignment with text entry (make sure text is long)
12. Repeat step 6 and verify warning still shows up in FF

Change-Id: I7fef65bf78117bbd983f89f5774b792e8c68aa9c
Reviewed-on: https://gerrit.instructure.com/68846
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Christi Wruck
2016-01-20 18:03:22 +00:00
James Williams f62911d1d2 rails 4.2: fix initializer specs
refs #CNVS-26056

Change-Id: I6bd8f15c375afc1bbb49d156949c1a92bd1c01d3
Reviewed-on: https://gerrit.instructure.com/70497
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-20 15:18:12 +00:00
Cody Cutrer a76d029902 don't try to create a communication channel with an empty e-mail
fixes CNVS-13389

test plan:
 * enable CAS on an account
 * go to create a user from the account settings page
 * fill in a username, but not an e-mail address
 * it should succeed; double verify that the user was created
   (as opposed to silently failing)

Change-Id: Ibe1e4e53ef94cfb2c369436428a5668f79a706d0
Reviewed-on: https://gerrit.instructure.com/70542
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-01-19 20:43:12 +00:00
Ethan Vizitei a9c691fbee spec: stabilize terms_of_use_spec and auth_spec
refs CNVS-25916

Both of these specs periodically fail with
bad authenticity tokens.  Although it happens
frequently, I've not been able to reproduce
these failures either locally or manually on
jenkins nodes.  Some possibilities are
polluted sessions or cached html (that has an
old authenticity token in it).

As a stopgap to prevent false failures, I'm adding
page refreshes at key points in these workflows
if logins fail the first time to try to get a
proper authenticity token for the given server
loaded into the session.  Also doing session
destroys where it seems like it might have
been missed in case there are bad bits of session
being left around.

TEST PLAN:
 1) oauth_spec should pass selenium build
 2) terms_of_use_spec should pass selenium build

Change-Id: I772a5ec137ca94ed4b2a29f826a9dfe9b7fcea09
Reviewed-on: https://gerrit.instructure.com/70568
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2016-01-19 20:27:28 +00:00
James Williams 57f962d4aa enforce term date restrictions on course admin users
test plan:
* add a teacher to a course
* in the account enrollment term, set access dates for teacher
 to start in the future
* the course should show up in the list of "Future Enrollments"
 but should not be accessible

closes #CNVS-25707

Change-Id: I869baaad67c88854cbc0585c7043ae80d0b40d32
Reviewed-on: https://gerrit.instructure.com/70261
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-01-19 20:00:13 +00:00
Alex Boyd 7799495aa3 Redesign the To-Do, Coming Up, and Recent Feedback lists
Fixes CNVS-25877

Test plan:
 - Create a user with:
   - an assignment that needs to be submitted
   - an assignment that needs to be graded
   - an assignment whose grades the user needs to moderate
   - an assignment that they need to peer review
   - a calendar event that they can see
 - Go to the user's home page
 - Ensure all of the assignments show up in the to-do list
 - Ensure they show up in Coming Up as well
 - Ensure that the calendar event shows up under Coming Up
 - Go to the courses where you created the assignments
 - Ensure that each assignment shows up on its respective course to-do
   list
 - Submit an assignment
 - As a teacher, ensure that the assignment shows up as needing
   grading, and that the number in the badge to the left is 1
 - Ensure that screenreaders read the badge as "1 submission
   needs grading"
 - Make another submission as a different user
 - Clear the cache by running `Rails.cache.clear` at a Rails console
 - As the teacher, ensure that the badge is now 2
 - Ensure that screenreaders read the badge as "2 submissions
   need grading"
 - Repeat 8 more times as different users, so that there are now
   10 submissions
 - Clear the cache again
 - Ensure that the badge now says "9+"
 - Ensure that screenreaders read the badge as "More than 9
   submissions need grading"
 - As the user who submitted the assignment, ensure that the grade
   shows up on the To-Do list, Coming Up, and Recent Feedback
 - As a teacher, leave a submission comment
 - As the user who submitted the assignment, ensure that the comment
   shows up under Recent Feedback
 - Create a public course
   - You can make a course public by going to its settings page
     and checking "Make this course publicly visible"
 - Log out
 - Visit /courses/<id>, where <id> is the id of the course
 - Ensure that the course shows as expected, and that nothing
   shows up on the to-do list
 - Automated tests should cover everything else

Change-Id: I18673995db94d896bf2c39515258e61065b48319
Reviewed-on: https://gerrit.instructure.com/69474
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Tested-by: Jenkins
Product-Review: Allison Weiss <allison@instructure.com>
2016-01-19 19:52:16 +00:00
Strand McCutchen 94ed3ea48b when future GPs exist GB Importer can create assignments
When the GradebookImporter receives data which would create
a new assignment, but there exists a future grading period,
the new assignment is not creatable due to MGP logic. This
change makes assignment creation and editing of assignments
without due dates possible through the GradebookImporter.

fixes CNVS-25380

Test plan:

 0. In a course with a student…
 1. Create a grading period in the present and another in
    the future.
 2. Export the gradebook.
 3. Open the exported file and add a new assignment column
    to the gradebook.csv, putting the name in row 1 and
    possible points in row 2.
 4. Import the gradebook.
 5. Verify that the gradebook is imported and a new
    assignment is created.
Change-Id: I8f88547582c1a632c7129eac72a4ba4e7f12a624
Reviewed-on: https://gerrit.instructure.com/68498
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Jenkins
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Jason Carter <jcarter@instructure.com>
Product-Review: Christi Wruck
2016-01-19 18:12:45 +00:00
Keith Garner 1a3a166b08 display download submissions button on screenreader gradebook
Screenreader gradebook now displays the "Download All Submissions"
button if any of the allowed submission types on an assignment is
downloadable. An empty zip file is now created if an assignment allows
both downloadable and non-downloadable submissions and all submissions
are of the non-downloadable variety.

fixes CNVS-26135

test plan:
 - As a teacher create an assignment with text and media type
   submissions selected
 - As a student submit the assignment
 - As a teacher go to the individual view gradebook
 - Select the assignment under Content Selection
 - Look for Download All Submissions button
 - Click "download all submissions"
 - If the student submitted a text type, expect to see it in the zip
   file.
 - If the student submitted a media type, expect an zip file with no
   entries.

Change-Id: I84913d6950ce8a8db28460c0ea26a2469dec86d9
Reviewed-on: https://gerrit.instructure.com/70437
Reviewed-by: Strand McCutchen <smccutchen@instructure.com>
Tested-by: Jenkins
QA-Review: KC Naegle <knaegle@instructure.com>
Product-Review: Christi Wruck
2016-01-19 17:45:08 +00:00
Jeremy Stanley 0b1f399126 don't send new file notifications for concluded courses
test plan:
 - ensure students do not receive "new file" notifications
   for unpublished or concluded courses
   (note that new file notifications can be delayed several
    minutes due to batching)

fixes CNVS-26214

Change-Id: I791f6917e15938c825962e1b21ddf5e59d4fe6c9
Reviewed-on: https://gerrit.instructure.com/70110
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
Product-Review: Dan Minkevitch <dan@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
2016-01-18 23:55:20 +00:00
Steven Burnett e7b4a339b3 fix error handling with notifications sqs queue
fixes CNVS-25481

Test-Plan:
- change the sqs queue in a way to cause a failure.  Notice
  message object reports as such and error is logged

Change-Id: I5ac0b9ac720b41546aa605e835b3badcfbbd17fa
Reviewed-on: https://gerrit.instructure.com/70262
Reviewed-by: Alex Boyd <aboyd@instructure.com>
Tested-by: Jenkins
Product-Review: Gentry Beckmann <gbeckmann@instructure.com>
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
2016-01-18 23:41:01 +00:00
James Williams b1f3daf044 rails 4.2: misc spec fixes
refs #CNVS-26056

Change-Id: Ia94ee2fcfded1ec66cb77a19085b005c81304800
Reviewed-on: https://gerrit.instructure.com/70251
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-18 21:45:39 +00:00
James Williams ac886d3bd3 rails 4.2: fix suspension of after_save touch callbacks
refs #CNVS-26056

Change-Id: Ie5e8ce8e693b1b03aefc6dd56af5f4901e27a5a2
Reviewed-on: https://gerrit.instructure.com/70478
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-18 21:45:19 +00:00
Spencer Olson 2658d2c05c mobile: add grading period scores to endpoints
adds support for a 'current_grading_period_scores'
argument that can be passed to api/v1/courses,
api/v1/courses/:id, api/v1/users/:user_id/courses,
and api/v1/users/self/favorites/courses. if this
argument is passed to these endpoints, scores for
the current grading period will be returned.

closes CNVS-26203

test plan:
 - run
     $ bundle exec rake doc:api
   to generate API documentation.
 - view the documentation at
   public/doc/api/index.html and navigate to the
   documentation for the Courses controller.
 - verify there is documentation explaining how
   to pass the 'current_grading_period_scores'
   argument, and explaining what will be returned.
 - hit the api/v1/courses, api/v1/courses/:id,
   api/v1/users/:user_id/courses, and
   api/v1/users/self/favorites/courses endpoints
   and pass in 'current_grading_period_scores'
   as an include[] argument. verify you get the
   expected responses back, as outlined in the
   API documentation for 'current_grading_period
   _scores'.
 - ping me with any questions :)

Change-Id: Ic8985c6a85af120b9d07ef2cd4e8e049e0c327fc
Reviewed-on: https://gerrit.instructure.com/69836
Tested-by: Jenkins
Reviewed-by: Derek Bender <djbender@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Keith T. Garner <kgarner@instructure.com>
2016-01-18 21:19:18 +00:00
Joel Hough 5e8215b249 make Context.get_account work with CourseSections
fixes CNVS-26336

test plan
- make a calendar event with a course section context (an event
 with 'Use a different date for each section' checked will do)
- view the calendar feed
- ensure the calendar feed renders

Change-Id: I391d5b43463a20ef34d85925021c51821e9fc5ba
Reviewed-on: https://gerrit.instructure.com/70070
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Tested-by: Jenkins
QA-Review: Adrian Russell <arussell@instructure.com>
Product-Review: Robert Lamb <rlamb@instructure.com>
2016-01-18 21:08:51 +00:00
Ethan Vizitei 0a5cd6797d identifiable error on cache miss
refs CNVS-26368

make sure we can find instances where we're unable to find accounts
by throwing a specific error (rather than counting on
ActiveRecord::RecordNotFound) for that case.

TEST PLAN:
 1) we should start seeing AccountCacheErrors showing up in Sentry

Change-Id: I9ae05df6a7ac2ca921ace70f10eeae32f11b2e70
Reviewed-on: https://gerrit.instructure.com/70468
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2016-01-18 18:20:11 +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
August Thornton 777b735452 handle exceptions for protect from forgery
refs CNVS-18870

test plan:
  - navigate to $(yourcanvasdomain)/canvas/login
  - paste the following in the javascript console
    in the browser of your choosing:
      document.cookie = "_csrf_token=1"
  - attempt a login with valid credentials
  - expect a flash error with:
      "Invalid Authenticity Token"

Change-Id: I1349026227e8e733a3199c8c000323fffc32127e
Reviewed-on: https://gerrit.instructure.com/70321
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2016-01-18 16:53:59 +00:00
Andrew Butterfield 53b1e3a1c8 Calendar control now behaves like tabs
fixes CNVS-25666

Test plan:
* Visually the appearance of the calendar button control should be the
  same as it always has been
* For KO and SR users when the calendar button control is tabbed to, the
  active button should receive focus
* The following constraints should be true no matter which button in the
  calendar button control has focus
  * When tab is pressed and a button in the calendar button control
    already has focus, focus should transition to the next focusable
    element in the DOM outside of the calendar button control
  * Similarly, when shift+tab is pressed focus should transition to the
    previous focusable element in the DOM outside of the calendar button
    control
* When using the calendar button control with a SR it should announce
  itself as a tab list and state which tab is currently selected
* As new tabs are activated using the arrow keys the SR should announce
  which is currently selected
* Pressing the left and up arrow keys should change the active button to
  the previous button in the calendar button control and the calendar
  view should be updated to the newly activate button's view.
* This behavior should wrap around when the beginning of the list is
  reached
* Pressing the right and down arrow keys should change the active button
  to the next button in the calendar button control and the calendar
  view should be updated to the newly activate button's view.
* This behavior should wrap around when the end of the list is
  reached

Change-Id: I308b6cd121d71a7c24bbb7c235aa99b1d5250d44
Reviewed-on: https://gerrit.instructure.com/70237
Tested-by: Jenkins
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Product-Review: Aaron Cannon <acannon@instructure.com>
QA-Review: Adrian Russell <arussell@instructure.com>
2016-01-18 16:14:15 +00:00