Commit Graph

1678 Commits

Author SHA1 Message Date
Cody Cutrer 266a89e7db use unicode sorting for ruby and db stuff
fixes CNVS-7199, CNVS-4414

abstract some ICU stuff out to Canvas::ICU, and add some missing
functionality in FFI-ICU

test plan:
 * create a bunch of groups in the same category, named 1-10.
   10 should sort after 9, not 1
 * repeat for creating and publishing quizzes *with the same due date*.
   go to the quiz index, and 10 should sort after 9, not 1

Change-Id: I323eb12dfb5bd23dbcbb3b543fa1b90a72f4341b
Reviewed-on: https://gerrit.instructure.com/24732
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-10-02 21:38:03 +00:00
Jacob Fugal 3f0968bb52 application/json+canvas-string-ids Accept header
fixes CNVS-7597

when given this header, data structures passed to render :json are
pre-processed before serialization to json such that any integer values
in 'id', 'foo_id', or 'foo_ids' fields (also 'ids' fields, but we don't
have any of those currently that I'm aware off), at any level (e.g.
within a nested data structure), are cast to strings.

test-plan:
 - full regression testing of both the UI (as it makes API calls) and
   the documented API
 - no UI behavior should change
 - API behavior should change only as described above

Change-Id: I4e0a68957038be063cf488dd9ec2262452dea3cf
Reviewed-on: https://gerrit.instructure.com/23956
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-10-02 18:05:31 +00:00
Jacob Fugal b12791aa99 to_json unnecessary (and wrongish) in render :json
refs CNVS-7597

render :json => thing will call ActiveSupport::JSON.encode(thing) unless
thing is a String. ActiveSupport::JSON.encode(thing) just calls
thing.to_json but with some circular reference checking that we want. we
may also want enhance ActiveSupport::JSON.encode to do additional
processing, and calling to_json straight up would bypass that.

in the cases where we do need to do the structural transformation before
passing to render :json (e.g. because of need to pass arguments), use
as_json to do structural transformation only, vs. to_json that does
serialization of the as_json result.

adds a rake task to lint the controllers to enforce as_json over to_json
in render json calls.

test-plan: heavy regression testing; no end behavior should change
(except a pair of serialization bugs that got fixed)

Change-Id: I7a91a9fe0eca70456bc5bca233f0ed6b27a54aaf
Reviewed-on: https://gerrit.instructure.com/23650
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-10-02 18:05:22 +00:00
Brad Humphrey fa699dd1c4 unit tests for lit outcomes replace result
now we only automatically grade assignments when a grade is passed back,
otherwise we leave them ungraded so that the teacher will be notified.

Test Plan:
 - Install a homework submission tool
 - Submit a grade via LTI
   * Ensure that the grade submits correctly
 - Submit a url without a grade
   * Ensure that the teacher is notified of the ungraded assessment
   * Ensure that the url is recorded for that submission
 - Submit text without a grade
   * Ensure that the teacher is notified of the ungraded assessment
   * Ensure that the text is recorded for that submission

Change-Id: Ic941c54062685ef1bba0aa860682db40cff952e3
Reviewed-on: https://gerrit.instructure.com/24474
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-10-01 21:19:51 +00:00
James Williams 20482e3ff8 extend content migration progress visibility and status view
refs #CNVS-8258

Change-Id: I154828d91802389e0fcd686433c1d075f6bee70c
Reviewed-on: https://gerrit.instructure.com/24638
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-10-01 18:17:21 +00:00
Simon Williams 7418d289c6 force cuty_capt to send 'Accept-Language:en'
the default accept language header that cuty capt sends does not play nicely
with canvas' locale selection.  so for now, force it to send 'en'.  in the
future it would be nice to have it send the user's configured locale, if it
exists.

fixes CNVS-8421

test plan:
- on a machine with the fix applied, and with cuty capt enabled
- submit a url assignment that points to a canvas installation
  * note: the submitted url does not need the fix applied, just the requester
- the screenshot should be in english

Change-Id: I56a534d4d1eaed92c2615ea500b5960708e49112
Reviewed-on: https://gerrit.instructure.com/24716
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-10-01 14:12:51 +00:00
Nick Cloward 14b5840ae3 Add a permission option in the api to return if the user can create topics.
closes CNVS-6824

This adds a permissions attribute to the returned json for discussion topic
contexts (Course, Group).

The permissions attribute contains an optional permission of
"create_discission_topic" which returns true or false depending on whether the
current user can create discussion topics for the course or group.  For
performance reasons this is only added to a single course/group json and not in
lists so the only call that will return it is /api/v1/<context>/<context_id>
where context is a course or group.  Since we did not want to include this on
every response its a custom permissions attribute for course and groups in the
course_json or group_json serialization methods.

Using the includes parameter for the API supplying a value of "permissions"
will include the permissions with "create_discussion_topic" for a group and
course.  When the object is serialized to json it checked to see if the model
implements a serialize_permissions method and calls that to render or override
permissions generated from the policies.

- Create a test Course. Make sure the course allows members to post topics.
- Add a student to the course.
- Make a call to /api/v1/courses/<id> where "<id>" is the id of the created
  course.
- The response should include a permissions attribute with a boolean value for
  "create_discission_topic" see the example below.

- Make a call to /api/v1/courses to return a list of course objects.
- The permissions attribute should not be included in the response.

- Create a test Group tied to the course created in the first step.
- Add a mamber to the group.
- Make a call to /api/v1/groups/<id> where "<id>" is the id of the created
  group.
- The response should include a permissions attribute with a boolean value for
  "create_discission_topic" see the example below.

- Make a call to /api/v1/groups to return a list of group objects.
- The permissions attribute should not be included in the response.

Example Response:
{
	id: 42,
	...
	permissions: {
		create_discission_topic: true
	}
}

Change-Id: Ia02d5aa67e345740a93dd0f63e357e7cb5e1efd6
Reviewed-on: https://gerrit.instructure.com/24478
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2013-09-30 14:32:48 +00:00
Shawn Meredith 497ffa9f1e spec: selenium splitting
Change-Id: I431d30cd846b4a781e3219ccb8680dcd1cef4698
Reviewed-on: https://gerrit.instructure.com/24688
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>
2013-09-26 23:06:55 +00:00
Cody Cutrer 22319f1402 use IANA timezone for LTI variable, and only in standard variable
* use IANA timezone names, not Rails weird names
 * don't send the offset (it will just be a source of bugs)
 * don't allow a custom variable name when a standard
   (http://www.imsglobal.org/LTI/v2p0pd2/uml/purl.imsglobal.org/vocab/lti/v2/variable/index.html)
   one will do just fine

Change-Id: I774a8b34b14507c6e65b1c1b144369ba09d50af3
Reviewed-on: https://gerrit.instructure.com/24665
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-09-25 22:03:01 +00:00
Jon Willesen 3a4c1c24fd add timeouts to incoming message processor
incoming message processor should not wait indefinitely on
external connections. it now implements timeouts on external
connections that are controlled by the Canvas.timeout_protection
method. It uses incoming_message_processor as the serivce name,
which makes these meaningful settings to change the timeout
behavior:
 - service_incoming_message_processor_timeout
 - service_incoming_message_processor_cutoff
 - service_incoming_message_processor_error_ttl

fixes CNVS-8198

test plan:
 - see the incoming message processor wiki page for instructions
   on how to do the configuration and run these tests.
 - create a fifo in an empty directory, configure
   incoming_mail.yml to read from the directory, run
   script/process_incoming_emails and make sure it exits in
   30 seconds or so.
 - use nc -l <port> to listen on a port, configure
   incoming_mail.yml to access that port on localhost, and run
   script/process_incoming_emails and make sure it exits in
   30 seconds or so.
 - run script/process_incoming_emails against an actual email
   account and make sure it can still process emails normally.

Change-Id: I23c67c1e8c0581a1e6ca69ab2c7b8855090688d1
Reviewed-on: https://gerrit.instructure.com/24483
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2013-09-25 16:47:02 +00:00
Brian Palmer 7c8466bb05 properly handle exceptions in reserve_capacity
Passing a nil cost to increment was raising an error, masking the
original error that the block raised in the first place

Change-Id: I7970ed7d454d8b04309087daf557f969e5adb057
Reviewed-on: https://gerrit.instructure.com/24610
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-09-23 19:53:53 +00:00
Brian Palmer 5cd9b153d4 include canvas revision in health_check json response
test plan:

curl -H 'Accept: application/json' http://<domain>/health_check

If you have a VERSION file in your canvas dir it'll report that
version, otherwise "Unknown"

Change-Id: I43c72140541ea441d4ec96a4c179d8db775843b7
Reviewed-on: https://gerrit.instructure.com/24595
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-09-23 19:53:08 +00:00
Cody Cutrer 803ca91821 includes create bad queries. don't use them for content lists
Change-Id: I4afafae06d4a799aaa626f40f37f49dae4af7c13
Reviewed-on: https://gerrit.instructure.com/24609
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-09-23 18:15:03 +00:00
Brian Palmer 3fbb9a6574 fix typo in module definition
Change-Id: I9d1eef6b423f81c4ce1e471e95d3cb5c1f0fa6ae
Reviewed-on: https://gerrit.instructure.com/24574
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-09-23 15:57:26 +00:00
Joel Hough 51a751c720 canvas side support for embedded chat
test plan
- test the embedded chat commit

Change-Id: I8fc75efdeb35415749623770a49640708f5eaa4b
Reviewed-on: https://gerrit.instructure.com/24277
QA-Review: Cam Theriault <cam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-09-20 22:14:47 +00:00
Brian Palmer 9250807988 ensure redis gems are loaded before calling LeakyBucket.lua
Change-Id: Ib9696b6a9ec8bfbd75c9fa49741cf42810f27561
Reviewed-on: https://gerrit.instructure.com/24559
Product-Review: Dave Jungst <dave@instructure.com>
QA-Review: Dave Jungst <dave@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-09-20 17:23:11 +00:00
Zach Pendleton f0f39ec2cb add reply/reply all options to old conversations
fixes CNVS-8112

when replying to a conversation message created in the
new conversations ui, the old conversations ui should
display reply/reply all buttons instead of a single
send button.

the reply button should send a message to only the thread's
original author, while the reply-all button should reply to
every person in the conversation.

test plan:
  * as a user with the new conversation ui enabled, send a
    message to at least two users who are still using the
    old conversations ui;
  * as one of the users with old conversations enabled,
    view your conversations and verify that you see a new
    group message from the first user;
  * verify that when you view the message you have the
    option to reply or to reply all;
  * send a reply message;
  * verify that as another user in the group conversation
    you cannot see the reply message;
  * verify that the original thread author can view the
    reply message;
  * as the user who sent the reply message, send a reply
    all message;
  * verify that all users in the conversation can view the
    reply all message.

Change-Id: I6c9540817c8ad0096242db44a717545c53880437
Reviewed-on: https://gerrit.instructure.com/24430
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Tested-by: Zach Pendleton <zachp@instructure.com>
2013-09-20 16:28:15 +00:00
Stanley Stuart 72181144ef remove AddWorkflowStateForQuizQuestions migration
This data fixup would be very expensive to run in production, as it
touches every quiz question record in the database. Besides, quiz
questions will update their workflow_state to "active" the next time
they are saved, .active? responds true for questions with nil
workflow_state, and the `active` scope on QuizQuestion already includes
quiz questions whose workflow_state is nil.

Change-Id: I72fecc53e2f46fd1c2086ec2dc13d448d74486ab
Reviewed-on: https://gerrit.instructure.com/24553
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-09-20 14:57:08 +00:00
Brian Palmer 9cda90ac6c add a reserve cost to request throttling
closes CNVS-8135

This essentially adds a cost to making multiple requests in parallel, by
adding to the bucket at the beginning of each request, and then
decrementing by the same amount when the request completes.

This way we will now throttle a user who makes many parallel requests,
none of which complete.

test plan:

* The regression portion: ensure that user throttling still works as
  before outside of this new use case.
* To test this new use case, it'd be useful to have a request that takes
  a very long time to finish. You could modify a controller action like
  users#user_dashboard and add a sleep(1000) to the beginning. Then make
  enough requests in parallel, all of which will hang on the sleep, so
  that you get a 403 error. This will require quite a few rails
  processes, of course. You can help that along by increasing
  Setting.set('request_throttle.up_front_cost', '500') , then you'll
  only need two requests in parallel to hit the limit.

Change-Id: I89412b7b325eef512ba77f21373ec5d9964c86cf
Reviewed-on: https://gerrit.instructure.com/24437
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-09-19 19:30:57 +00:00
Stanley Stuart 0209b5a4c4 quiz questions now soft-delete
Adds workflow state to QuizQuestion models.

Test plan:
  - Make a quiz, have a student take the quiz.
  - Set some regrade options on the quiz and republish the quiz.
  - Go back to the edit page for the quiz and delete a quiz question.
    You should not get a error when you do this.
  - Make sure the quiz question does not show up by refreshing the
    quiz's edit page.

Change-Id: If4bcb0ad28217a527080da9aa32ce6bf7921bfdb
Reviewed-on: https://gerrit.instructure.com/24111
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Stanley Stuart <stanley@instructure.com>
2013-09-18 20:15:46 +00:00
Jon Jensen 67c29b7660 group category create/edit dialogs, fixes CNVS-6659
feature parity with the old UI

also add account setting to enable the new UI

reorg some code so we can more easily rip out all the old stuff once we
are done

sass->scss since it's the new hotness

add reorder() method to CollectionView for when things change

test plan:
1. in the console, set the enable_manage_groups2 setting to true on your
   account
2. run delayed_jobs
3. go to the manage groups page
4. you should see the new groups UI
5. you should be able to add a new group set
6. you should be able to edit a group set
7. the tabs should be alphabetical (adding/updating a set should put it in
   the correct spot)
8. auto-creating/splitting groups should work when creating a set

Change-Id: I55f9e7785a0114954a3583257a78f71e78f47b5f
Reviewed-on: https://gerrit.instructure.com/22458
Reviewed-by: Mark Ericksen <marke@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-09-18 19:43:49 +00:00
James Williams c5fce200b0 don't submit imported/unzipped attachments to scribd
test plan:
* ensure scribd documents are rendered automatically
 when uploading single files to a course

* ensure scribd documents are not rendered automatically
when uploading a zip file full of documents to a course

* ensure scribd documents are not rendered automatically
when files are imported with a content migration package

* ensure scribd documents that were not rendered
automatically will be rendered on demand
(i.e., the first time they'll view with google docs
if available, or a "processing, try again" message
otherwise; later page loads should view the
document in scribd once it's done rendering)

fixes #CNVS-8078

Change-Id: Ibe821783e45dfa32b9bfdeb23b125237b45e9890
Reviewed-on: https://gerrit.instructure.com/24404
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-09-18 19:03:17 +00:00
Simon Williams 0f25871915 tweak tie-breaking logic for Accept-Language header
previously in the case of ties in the quality value we sorted by length (so en
beats en-US), and then alphabetically (so ar beats en).  this part of the spec
is somewhat ambiguous, but this ordering does not take into account the order
passed into the accept header.  so passing "en,ar" would have chosen 'ar'
because quality and length both tie, and 'ar' is first alphabetically.

to fix this we are incorporating the order of the types passed into the accept
header as one of the tie breaking criteria.

this fixes the bug with CutyCapt snapshots of canvas being rendered in arabic
because CutyCapt passes "en,*" as it's accept header.  up until recently, 'en'
happened to be alphabetically first in our list of supported languages, so
everything worked out.  but when we added support for arabic, a new
alphabetical winner emerged, exposing this bug.

fixes CNVS-3070

test plan:
- in an environment with CutyCapt enabled
- create a web submission assignment that allows url submissions
- submit a canvas url that has this fix applied (note that you can run this
  from anywhere, it's the url you submit that needs the fix)
- it should be in english, not arabic

Change-Id: I7cf6d9db02ec0e79ad425bc0479c4fc43942fa52
Reviewed-on: https://gerrit.instructure.com/24348
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Liz Abinante <labinante@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2013-09-17 21:56:36 +00:00
Brian Palmer 86464dc7a3 user request throttling
Define the cost of a request as (user cpu + time spent in db queries),
then store that using a leaky bucket algorithm in redis. The algorithm
is slightly modified from a normal leaky bucket, see the comments in the
code.

The parameters (maximum, hwm, outflow) are configurable Settings.
Because this code path is hit on every request, I've tried to keep the
added latency to a minimum.

Uses lua scripting in redis to avoid the latency of an extra round trip
(two round trips with lua, one at the beginning of the request and one
at the end, vs at least three without lua).

closes CNVS-7008

test plan:
* Given the default params, you're not going to ever hit the throttling
  limit without making multiple requests in parallel. Normally local dev
  environments won't process parallel requests, so you'll want to tweak
  the config params.
  * Setting.set('request_throttle.hwm', '2')
  * Setting.set('request_throttle.outflow', '0.1')
* Make canvas http requests as a logged in user, and verify that after a
  few requests in quick succession, you get a 403 response. After
  waiting a second for your bucket to fall back below the threshold, you
  can make requests again.
* Do the same using the api and sending your access token in the query
  string or http auth header.
* This should work correctly with a clustered redis as well.
* If possible it'd be good to test parallel requests as well. The code
  should handle this correctly and combine the cost of the parallel
  requests, rather than stomping on the values.

Change-Id: I1fdfd4e009d81bd6525bcf45a93437f4c395f129
Reviewed-on: https://gerrit.instructure.com/24256
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-09-17 15:09:49 +00:00
Jake Sorce b4264e7fa1 add ext param to generate file
default the param to csv
also support tab delimited parsing in report spec helper

refs PS-526

Change-Id: I962877d1937f1d88072861f456a29d2c31f2a3d4
Reviewed-on: https://gerrit.instructure.com/24330
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jake Sorce <jake@instructure.com>
QA-Review: Jake Sorce <jake@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
Tested-by: Jake Sorce <jake@instructure.com>
2013-09-16 23:47:12 +00:00
Derek DeVries c08bad102b fix regrading partially correct multiple answer questions and questions in groups
fixes CNVS-8125, CNVS-8073

test plan for cnvs-8125:
- create a quiz with multiple answers question (2 correct answers) make it
  3 points total
- have the student take the quiz and get 100%
- do a regrade, don't change the previous correct answers, just add another
  correct answer. Use the option that only gives points if student chose the
  correct answer (should be options #1 out of the 3) student should now get 2/3
- do another regrade and take off the correct answers that the student got and
  leave the other correct answer that the student did not get
- the scores should reflect the changes to the answers correctly

test plan for cnvs-8073:
- create a quiz question group worth 25 points
- make a question in the group
- have a student answer the question correctly, should show 25/25
- as a teacher change the answer with regrade option #1 (keep previous and current)
- save and regrade the quiz
- the student should continue to have 25/25 points

Change-Id: Ic083eff3df266559ccfd7fe6e0c39a4183d5723c
Reviewed-on: https://gerrit.instructure.com/24349
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-09-13 23:06:45 +00:00
Derek DeVries d1b64c6fb9 fix issue regrading questions added to a quiz after a submission has been made
fixes CNVS-8098

test plan:
- have a student take a quiz (unlimited attempt quiz)
- teacher goes back in and adds a question (does not do any regrading)
- student retakes the quiz with the new question
- teacher does a regrade on the new question
- log in as the student
- verify: question was not regraded

Change-Id: Icaeac389dc77aa0471b502da6dccd210932f6b41
Reviewed-on: https://gerrit.instructure.com/24325
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-09-13 04:00:45 +00:00
Derek DeVries bbc07d7272 make answer comments update to match the correct answer for regrade options
fixes CNVS-8010

test plan:
  - as a teacher create a quiz with both Right/Wrong answer comments
  - as a student take the quiz and get the answer correct
  - as a teacher regrade the quiz and change the answer so that the student's
    regraded answer is incorrect and choose option "Award points for both"
  - it should show the "Wrong answer comments" for student
  - perform the same test for regrade option 3 (full credit)

Change-Id: I5c7f374dbaf4396e32eb8c1958308fae4b424d4a
Reviewed-on: https://gerrit.instructure.com/24295
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-09-13 02:05:06 +00:00
Jacob Fugal 6c158f4dc8 avoid unnecessary sql join when possible
when looking up messageable users within a specific course or section,
we already know the relevant course's workflow_state in ruby-land, so we
don't need to join in the courses table just to check the workflow_state
and branch in the query.

test-plan:
  regression tests around conversation recipient searching and user
  search

Change-Id: I197276d68f4684539c9907941008bc46cc5fc44e
Reviewed-on: https://gerrit.instructure.com/24165
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-09-12 22:27:21 +00:00
Cody Cutrer d3f0b18684 validate nullness in the db on a bunch of columns
fixes CNVS-7414

Change-Id: I60978f66d88d916dc5736dbb975715172bd1e14b
Reviewed-on: https://gerrit.instructure.com/23141
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-09-12 22:20:39 +00:00
Cody Cutrer 5051b79c0e create folder shard-safely
fixes CNVS-8069

test plan:
 * have a user on one shard. use the API to upload a file to
   a specific folder for that user
 * arrange to have a user on another shard with the same local
   id (either by creating the user in script/console and assigning
   the id before saving, or just creating both users on a fresh
   shard each, so they both end up as id 1)
 * use the API to upload a file to the second user *with the same
   path*
 * it should not error out due to foreign key constraints

Change-Id: I06724e148df82d15629b4133a0a5c75bdf32caf7
Reviewed-on: https://gerrit.instructure.com/23991
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-09-12 20:19:51 +00:00
Cody Cutrer 7fbc099986 batch up due date cachers during user list
refs CNVS-8071

test plan:
 * create a course and a section with an SIS ID
 * create a an assignment, and override it's date for that section
 * enroll two users via UI into the course; one with no section
   (i.e. the default section), and one into the section with the override
 * confirm that the users show appropriate due dates for the assignment

Change-Id: I5e06f812dbe8afe08eebb8c8809699c8ef685746
Reviewed-on: https://gerrit.instructure.com/24257
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-09-12 20:08:44 +00:00
Cody Cutrer b8470a85e8 batch up due date cachers during sis imports
fixes CNVS-8071

test plan:
 * create a course and a section with an SIS ID
 * create a an assignment, and override it's date for that section
 * enroll two users via SIS into the course; one with no section
   (i.e. the default section), and one into the section with the override
 * confirm that the users show appropriate due dates for the assignment

Change-Id: I0e2b64d1d7095d370ba981b3b0f3ec4d1742f15b
Reviewed-on: https://gerrit.instructure.com/24254
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-09-12 20:08:32 +00:00
Mark Severson 6a4c53d2b8 add lolz translation generator
test plan:
 - run rake i18n:generate_lolz
 - run rake canvas:compile_assets
 - with translations enabled, change language to LOLZ
 - all translated strings should be LOLZ-ified

Change-Id: Id2d3823bc69b8c305d465c15e5d1f8a64431e79b
Reviewed-on: https://gerrit.instructure.com/24205
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-09-11 21:08:03 +00:00
Brian Palmer d252c2e9a5 i18n: add en-AU and en-GB
Also tweak the transifex import process to deal with the fact that they
use underscores and we use dashes

closes CNVS-8070

Change-Id: I1167cc90be7dc0a938781b8fd6741420a6ba826e
Reviewed-on: https://gerrit.instructure.com/24202
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-09-11 19:05:19 +00:00
Cody Cutrer a4bf708d33 batch up some massive updates at end of SIS import
fixes CNVS-7981

test plan:
 * run some SIS imports
 * they should succeed

Change-Id: Ia81981b04b3454d115ae607e9babed4c2548a906
Reviewed-on: https://gerrit.instructure.com/24092
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-09-10 17:35:52 +00:00
Bryan Madsen 367b4dd5ba lower js test count validation to 900
Change-Id: I994cd4077f57e54fad8adb55f17550f6232171cd
Reviewed-on: https://gerrit.instructure.com/24181
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2013-09-09 16:22:03 +00:00
Joel Hough a6ff296b6a in-page chat widget part 1
fixes CNVS-7889

adds a plugin which will render a partial whenever the chat widget
should be inserted. useful partial to come later

test plan
- install our chat LTI tool at an account level
- the plugin sends a message to the javascript console when the
 chat widget would appear
- with the plugin disabled, ensure that the message does not
 appear (check the course index, where it normally would)
- with the plugin enabled, ensure that the message does not
 appear when:
 - you are on gradebook 1 or 2
 - you are in speedgrader
 - you are taking a quiz
 - you are on a page without headers. these pages include:
  - unauthorized action page
  - the embedded submission on speedgrader
  - the 'Join This Course' modal dialog
 - you aren't logged in
- with the plugin enabled, ensure that the message appears when
 you are on any other course page
- ensure that enabling the plugin on an account does not affect
 a different account

Change-Id: I7c3fd9dd882b966160878ded0ca9194e53b11d21
Reviewed-on: https://gerrit.instructure.com/24127
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-09-06 23:19:02 +00:00
Shawn Meredith a2bc6f473b js:test pass fail determination tweak
Change-Id: I18389a1473f2909df6d8f03f7b4d4c4af9764020
Reviewed-on: https://gerrit.instructure.com/24140
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Product-Review: Shawn Meredith <shawn@instructure.com>
Tested-by: Shawn Meredith <shawn@instructure.com>
2013-09-06 20:26:27 +00:00
Derek DeVries 89e199451b edit assignments and multiple due dates in the new index page
fixes CNVS-7190, CNVS-7652

test plan

1. editing
- click edit from cog menu
- edit in dialog
- edits should display after dialog closes

2. variable due dates
- add a section to the course in the settings
- edit an assignment, and add multiple due dates
- "multiple due dates" with a tooltip should show up in the index page
- on the edit modal, the due date is disabled and shows dates in a hover tooltip

Change-Id: I0ada6bc94964f34e8f6327edd6c52c2201637791
Reviewed-on: https://gerrit.instructure.com/23550
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2013-09-06 18:16:39 +00:00
Duane Johnson 3ee943278b update API docs generated for swagger
- Explicitly describe path parameters (e.g. "id", "account_id") so
  that swagger will autogenerate the correct code.
- Use :resources which is already grouped, rather than :object, which
  is not.
- Guess type information from current sample @object models
- Accept @model in API docs as a better alternative to @object.
  @model descriptions use the JSON-schema draft 4 specification,
  which is what Swagger uses.

  See https://github.com/wordnik/swagger-core/wiki/Datatypes

- Add some swagger json generator specs
- Fix SubmissionsController's "Submission" object

Change-Id: I71befe1d2cea039fd996124e7de9cab2e639e191
Reviewed-on: https://gerrit.instructure.com/23831
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Duane Johnson <duane@instructure.com>
QA-Review: Duane Johnson <duane@instructure.com>
2013-09-05 19:55:40 +00:00
Ryan Florence b15c41d3f0 updated ember to 1.0.0
- added new ember application generator
- also Ember -> ember in AMD requires

Change-Id: I7914a2578161e4f8370fc05ed6596ed07347c897
Reviewed-on: https://gerrit.instructure.com/24038
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Tested-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Product-Review: Ryan Florence <ryanf@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
2013-09-05 16:46:33 +00:00
Mark Severson 2b0a891d80 remove hide_from_students from the new pages UI
test plan:
 - start with draft state disabled
 - for each step, exercise the api (as a teacher) to confirm the
   expected values
 1) create pages with different hide_from_students values
    a) as a teacher
       hidden pages should be visible; the hidden flag should persist
    b) as a student
       hidden pages should not be visible
 2) using the api, update published and hide_from_students
       (together and separately)
    a) the published value should not be affected
    b) the hide_from_students value should be updated when set

 3) enable draft state
    a) as a teacher
       previously hidden pages should be visible, but unpublished
    b) as a student
       previously hidden pages should not be visible
 4) edit a page
    a) ensure the "Hide from students" option is gone
 5) publishing pages should behave as expected
    a) published pages should be visible to students
    b) unpublished pages should not be visible to students
 6) using the api, update published and hide_from_students
       (together and separately)
    a) the hide_from_students value should not be affected
    b) the published value should be updated when set

 7) create new pages with different published states
    a) as a teacher
       unpublished pages should be visible, but unpublished
    b) as a student
       unpublished pages should not be visible
 8) disable draft state
    a) as a teacher
       previously unpublished pages should be marked hidden
    b) as a student
       previously unpublished pages should not be visible

fixes CNVS-7617

Change-Id: I395e0b2639543a64d9e2bc8d9377c78cf36f42d6
Reviewed-on: https://gerrit.instructure.com/23618
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-09-04 22:22:21 +00:00
Cameron Matheson b469af93cc make Assignment#group_students return distinct students
fixes CNVS-7823, CNVS-7847

Test plan:
  * enroll a student in multiple sections
  * make a group assignment
  * comment on the group assignment submission for the student with
    multiple sections
  * the student should receive one copy of the comment (not multiple)

Change-Id: I26f44ef054fdb136f180c949d0676fc0168827a8
Reviewed-on: https://gerrit.instructure.com/23886
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-09-03 23:09:18 +00:00
Mark Severson 932bd3dc0e fix legacy wiki front page behavior
test plan:
 - in a course with no pages (new course is best)
 * manually update the course object:
   * set default_view to 'wiki'
 * manually update the course's wiki object:
   * set front_page_url to nil
   * set has_no_front_page to true
 * navigate to the course home page
 - there should not be an error on the page

fixes CNVS-7744

Change-Id: I047db32d2fa7a376be994a1314c0e55a0cadffde
Reviewed-on: https://gerrit.instructure.com/23751
QA-Review: Hannah Bottalla <hannah@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-09-03 19:27:02 +00:00
James Williams 93fb3b95d2 copy wiki front page setting
test plan:
- account-level draft state => disabled
  * create a course
  * set a custom wiki page as the home page
  * copy the course
  * the new course's home page should be the copied front page

  * copy the original course again
  * selectively omit copying the front page
  * the new course's home page should be an empty front page

- account-level draft state => enabled
  * create a course
  * set a custom wiki page as the home page
  * copy the course
  * the new course's home page should be the copied front page

  * copy the original course again
  * selectively omit copying the front page
  * the new course's home page should be the dashboard

fixes #CNVS-7774

Change-Id: If9987cad55f069a2803002de611ecb0d81b2ebc5
Reviewed-on: https://gerrit.instructure.com/23788
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-08-30 12:34:49 +00:00
Jacob Fugal f2a8d4fe6d replace to_json overrides with as_json overrides
refs CNVS-7597

given Object#to_json's default implementation, the old to_json
overrides follow from the new as_json overrides. and now we can also
call as_json and get the expected non-serialized data.

test-plan: N/A

Change-Id: Ia57562e0c73752a13023cad4ef6bae9435790bee
Reviewed-on: https://gerrit.instructure.com/23647
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-08-29 22:39:32 +00:00
Jacob Fugal 34f5a5c1f1 per-instance json serialization methods/excludes
refs CNVS-7597

allows streamlining some previously overridden to_json methods

test-plan: N/A

Change-Id: I401500d4fef301c8cdae455d4f71a130e2764108
Reviewed-on: https://gerrit.instructure.com/23645
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-08-29 22:39:17 +00:00
James Williams 201a45b740 fix intermittent parallel spec failures
closes #CNVS-7720

Change-Id: Ied1d01de4c9b3e993a943860a3e6789f5d92821c
Reviewed-on: https://gerrit.instructure.com/23740
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2013-08-29 20:21:58 +00:00
Bracken Mosbacker 60650da3a0 correctly check for syllabus body flag on course copy
The import code was checking the wrong property

Test Plan:
 * do a selective course copy
 * the syllabus body should copy

closes CNVS-7410

Change-Id: I70f858383f635b8ebe46287f3c94153ebe7eb00f
Reviewed-on: https://gerrit.instructure.com/23852
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-08-29 17:50:21 +00:00