Commit Graph

331 Commits

Author SHA1 Message Date
Cody Cutrer 469b6b674a resend course invitations async
fixes CNVS-4580

and don't load all the enrollments at once, either.

test plan:
 * (in production mode)
 * invite some people to a course
 * stop delayed jobs
 * click the re-send invitations link in the course settings
 * the users should not see the invitations again yet (in /messages)
 * start jobs
 * the invited users should see the invitations again now

Change-Id: Id2a7396df9cfe1a0f559a9780c5df0d8b7b0fcb2
Reviewed-on: https://gerrit.instructure.com/18509
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-14 17:38:39 -06:00
Brian Palmer 77ca8ac013 remove deprecated rails constant usage
basically convert RAILS_ROOT -> Rails.root , RAILS_ENV -> Rails.env ,
RAILS_DEFAULT_LOGGER -> Rails.logger

This is necessary for rails 3

Change-Id: I138e1aa217fa8fb186d23ac09b04031c1e2b665e
Reviewed-on: https://gerrit.instructure.com/18412
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-11 12:14:08 -06:00
Jon Jensen cd6d2de848 remove birthdate from UI, fixes CNVS-4191
test plan:
1. go to /register
2. you should not be prompted to enter a birthdate in any of the flows
3. the forms should work
4. go to your (user) settings
5. you should not see your birthdate nor be able to enter one
6. the form should work
7. go to the self enrollment page for a course as a new user
8. you should not be prompted to enter a birthdate
9. the form should work

Change-Id: I9bf92d27e208696b2aed74b4a6396d434494679c
Reviewed-on: https://gerrit.instructure.com/18143
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
2013-02-28 14:23:38 -07:00
Cody Cutrer 56e317e4ab use mysql2 gem for mysql
closes CNVS-4199

Change-Id: I81a14efca365a61ff9e5d29892ec95ace64aabb3
Reviewed-on: https://gerrit.instructure.com/18089
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-02-27 14:10:37 -07:00
Jeremy Stanley d2b18c1479 add undelete option to course batch update api
fixes CNVS-4056

test plan:
 - delete some courses via the UI or API
 - use the course batch update API with event=undelete to bring
   them back

note: while you can undelete a course via its sis id, this only
works if the course was _deleted_ via sis.  if you delete a course
via the UI or API, its sis ID is cleared.  this is by design:
https://gerrit.instructure.com/#/c/3520/

Change-Id: I402dd1e0bdfc6ae639e1781f16ae5e629ca9f87a
Reviewed-on: https://gerrit.instructure.com/18062
Reviewed-by: Mark Severson <markse@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-02-26 11:50:43 -07:00
Joe Tanner ea667d3a8f do not allow GB1 when course enrollments are > 250
closes #CNVS-4173

test plan:
- in rails console run:
  Setting.set('gb1_max', '0')
- start your rails server
- go to the gradebook for any course
- it should redirect to courses/*/gradebook2
  and the button to go back to gb1 should not be present

Change-Id: I5e08490f173898927f80496239d176ca0c92168b
Reviewed-on: https://gerrit.instructure.com/18068
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
2013-02-26 10:57:47 -07:00
Mark Severson 91ed24f410 use the account time zone when copying a course
because the time zone being used in delayed jobs is UTC, no
adjustments were being made for daylight saving time

test plan:
  * find a course with assignments before daylight saving time
  * copy the course
    * make sure adjust dates is checked
    * adjust the dates to after daylight saving time starts
  * ensure that the copied assignments have the same time of
    day as the original assignments (specifically the hour)

  * extra credit: copy from during daylight saving time to
    after daylight saving time ends

fixes #CNVS-1418

Change-Id: I753decc646fe63abf9e7af029f04b7494a18394a
Reviewed-on: https://gerrit.instructure.com/17910
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-02-25 12:49:03 -07:00
Joe Tanner a356370b01 Revert "do not allow GB1 when course enrollments are > 250"
This reverts commit a2e775cd87213179b2b97ddba07fe607d0c988e7.

refs #CNVS-3926, reverted because this should have only
affected GB and not other parts of canvas that use the
large_roster setting.

Change-Id: I72cd57f7177ff982e73beec489b1a892b6fa2e02
Reviewed-on: https://gerrit.instructure.com/17984
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Joe Tanner <joe@instructure.com>
2013-02-22 16:41:24 -07:00
Joe Tanner 4ccd7e54e7 do not allow GB1 when course enrollments are > 250
closes #CNVS-3926

test plan:
- open app/models/course.rb and change LARGE_ROSTER_THRESHOLD from 250 to 0
- go to the gradebook for any course
- gradebook 1 should not be an option

Change-Id: I0c1cc13f6347c3f47be4c6e6825b01890e1b56ad
Reviewed-on: https://gerrit.instructure.com/17869
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
2013-02-20 16:06:52 -07:00
Jacob Fugal c106826889 MessageableUser refactor with sharding
Separates, streamlines, and makes shard-aware all use cases of
User#messageable_users *other* than searching (call site in
SearchController#matching_participants).

Produces three new methods that take the bulk of that responsibility:

 * User#load_messageable_users -- given a set of users, filter out the
   ones that aren't messageable, and load any common contexts for those
   that are.

 * User#load_messageable_user -- as User#load_messageable_users, but for
   just one user.

 * User#messageable_users_in_context -- given a context (a course,
   section, or group), return the list of messageable users in that
   context.

refs CNVS-2519

remaining on CNVS-2519 is to tackle the search application of
User#messageable_user. mostly there, but reconciling pagination
with ranking by number of shared contexts is proving problematic, so I'm
going to separate that into another commit.

meanwhile, I've renamed User#messageable_users to
User#deprecated_search_messageable_users to discourage any accidental
new uses and left it otherwise untouched. searching for users on the
same shard should be unaffected. You can still locate messageable users
on other shards to insert into conversations by browsing the shared
contexts.

test-plan:
 * create user A in shard X
 * create user B in shard Y
 * for situations where A could message B if on the same shard:
   - setup the situation where the common tie is on shard X (e.g. course
     on shard X and both A and B in it). run exercises below
   - setup the situation where the common tie is on shard Y. run
     exercises.
   - if appropriate, setup the situation where the common tie is on
     shard Z. run exercises.
 * for each setup described above, login as A:
   - A should see the "message this user" button on B's profile
   - if the common tie is a course, section, or group, A should see B
     under that context when the context is selected in the recipient
     browser
   - if a conversation exists involving both A and B, when A loads the
     conversation they should see B tagged with the common contexts
 * regression test searching for messageable users from the same shard

Change-Id: Ibba5551f8afc2435fd14a2e827a400bf95eae76a
Reviewed-on: https://gerrit.instructure.com/17569
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2013-02-19 09:31:24 -07:00
Ryan Florence a9def60507 show gradebook2 for large_roster courses always
closes CNVS-3093

test plan:
1. visit a course grade book and click the button
  to go back to the old grade book
2. in script/console do:
      c = Course.find(<course_id>)
      c.large_roster = true
      c.save!
3. visit the course grade book page again
   - you should be sent to gradebook 2
   - there should be no button to go back to
     the old grade book

Change-Id: Ica16c57851597b571dcb8c06ed6621f9a2364666
Reviewed-on: https://gerrit.instructure.com/17626
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
2013-02-18 13:58:58 -07:00
Bracken Mosbacker aab362efca allow modules to be unpublished
Modules can now be unpublished, which means that students
can't see them. An unpublished module doesn't affect module
progressions. So a module dependant on an unpublished
module won't be locked to a student.

fixed existing bug with adding prerequisites to a new module

Test Plan:
 * Create unpublished modules
   * They should be visible to teachers but not students
 * Create a module that has an unpublished module as a prerequisite
   * Students should be able to access that published module
	 * If you now publish the unpublished one, the other module should be locked
 * Visiting an assignment/page/discussion that is in an unpublished module should
   give a message saying you can't see the item
 * As a teacher, if you're on the last item in a module (like a wiki page), the
   next item link that points to the next module should have "(draft)" on it
	 if the next module is unpublished
 * Getting a module in the api should now have the workflow_state
 * After a course copy the modules should be in the same state
 * Create a new module and add prerequisites. They should be added.

closes CNVS-3589

Change-Id: I7e9045148b391f996f0b00b7209341e7f0efe1d2
Reviewed-on: https://gerrit.instructure.com/17481
QA-Review: Adam Phillipps <adam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2013-02-15 19:10:30 -07:00
Mark Ericksen 2eaba178c2 disable speedgrader in courses with large_roster flag.
fixes CNVS-3111

test plan:
  * enable the 'large_roster' flag on a course and verify
    that, in that course, links to the speedgrader are
    hidden in the following places:
    - graded discussion topic gear menu;
    - graded discussion entry gear menu
    - quiz show page (right side bar);
    - assignment show page (right side bar);
    - gradebook1 assignment header dropdown;
    - gradebook1 grade cell popup;
    - gradebook2 assignment header dropdown;
    - gradebook2 grade cell popup;
  * also verify that attempting to navigate to the
    speedgrader directly via /courses/:id/gradebook path
    displays a message that the speedgrader is disabled
    for that course.

Change-Id: Iab82bd7281208f6e2d3745bb3184c90068090535
Reviewed-on: https://gerrit.instructure.com/17710
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Tested-by: Eric Berry <ericb@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
2013-02-15 16:38:45 -07:00
Jacob Fugal 679578aef8 use correct shard in Course#enrollment_allows
when checking if a user has an enrollment in a course that allows a
permission, check for the enrollments on the course's shard

test-plan:
 * create user A on shard X
 * create course B on shard Y
 * enroll user A in course B
 * in course B's account, have a permission that depends on course
   enrollment that should be true for user A's enrollment
 * exercise that permission in course B as user A

Change-Id: I143ecebd25da15fc59c94c7119a664633d4fdb7c
Reviewed-on: https://gerrit.instructure.com/17565
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-02-15 10:48:09 -07:00
Cameron Matheson 0b9e0d2f5e gradebook_to_csv: order assignments like gb2
refs CNVS-3606

this commit also removes the unused assignment_id option

Test plan:
  download some gradebook csv, make sure the column order is the same as
  gb2

Change-Id: I8dde6122805498a4513126bf288f93713b745c58
Reviewed-on: https://gerrit.instructure.com/17620
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
2013-02-15 10:34:25 -07:00
Jon Willesen 0ebaa016a8 add a batch_update method to conversations api
The batch update runs in a background job and updates a
Progress record while it runs. Based on the recently added
course controller's batch_update method.

fixes CNVS-2962

test plan:
 - read and check the api documentation for the conversations
   batch_update call
 - create some conversations for a user using the GUI
 - use the new api call to perform batch updates on that user's
   conversations
 - refresh the user's inbox and verify the conversations were
   updated properly.

Change-Id: I185bb5402675b6f0475efed21a525c5d4d8a39cb
Reviewed-on: https://gerrit.instructure.com/17556
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
2013-02-14 09:36:36 -07:00
Ryan Florence 57fb1e1d90 disable uploading scores in large_roster courses
closes CNVS-3091

test plan:
1. visit gradebook2
   - note the ability to upload scores
2. set large_roster to true for a course in
   script/console
3. visit gradebook2 again
   - note the option to upload scores is gone

Change-Id: I1995cbf878cd6898eee1167d0e80f25ef21261b6
Reviewed-on: https://gerrit.instructure.com/17649
QA-Review: Cam Theriault <cam@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-02-13 22:20:14 -07:00
Jon Jensen 62ab539d01 add course and account level large_roster settings, fixes #CNVS-3773
there is no ui for this (yet)

test plan: N/A

Change-Id: Ifed7192dc23b7e92681bd03bc68ad16ace509205
Reviewed-on: https://gerrit.instructure.com/17614
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2013-02-12 15:54:41 -07:00
Zach Pendleton b823acd214 optionally lock all course announcements.
fixes CNVS-3116

add course setting to default all its announcements to
'locked.' this setting is managed from the course settings
page.

test plan:
  * edit a course from its settings page and check the
    'Disable comments on announcements' checkbox;
  * create a new announcement in the course and verify
    that it is automatically locked;
  * uncheck the 'Disable comments on announcements'
    checkbox, create an announcement, and verify that it is
    unlocked.

Change-Id: If535abbbb0849284c8a6dfc2e6a6d42861796777
Reviewed-on: https://gerrit.instructure.com/17436
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Tested-by: Zach Pendleton <zachp@instructure.com>
2013-02-11 16:55:32 -07:00
Cameron Matheson 906a59c8f5 make gradebook.csv less slow
fixes CNVS-3606

Test plan:
  * download some gradebook csv in a large class
  * experience euphoria and surprise as your gradebook csv is quickly
    delivered

Change-Id: I44e5fe14d73993d669eb6600072d6e2d125ad3cc
Reviewed-on: https://gerrit.instructure.com/17593
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
2013-02-11 16:44:16 -07:00
Cody Cutrer db0bf46471 clean up course account associations
closes CNVS-3417

test plan:
 * after the migrations are run, ensure that every section has at
   least one entry in CourseAccountAssociations in the database
 * smoke test SIS imports

Change-Id: I261cad633788efbf4b0c64db34436ef695856fee
Reviewed-on: https://gerrit.instructure.com/17256
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2013-02-08 16:33:25 -07:00
Jacob Fugal e9ee3dff3b invalidate observee's caches when newly observed
when creating a new observer enrollment, touch the observee's updated_at
as was as the observer's, to invalidate caches.

Change-Id: I699211115d7256c849086b23796acbdf2f5828c1
Reviewed-on: https://gerrit.instructure.com/17566
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-02-08 16:31:03 -07:00
Jon Jensen 7fe105b278 course setting to prevent students from editing/deleting own posts
fixes CNVS-3178

test plan:
1. as a student, create a discussion topic and a reply
2. as a teacher, uncheck "Let students edit or delete their own discussion
   posts" on the course settings page.
3. as the student, confirm you cannot edit or delete the topic or reply
   that you created
4. as a teacher, recheck the box and save
5. on the discussion index page, confirm the setting is checked in the menu
6. disable it via the menu
7. repeat step 3

Change-Id: Ib7d6ba3604370241de1145aac8e23d35f78591c4
Reviewed-on: https://gerrit.instructure.com/17535
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
2013-02-08 16:11:23 -07:00
Jon Jensen a1cef3e359 clean up Course#settings a bit, don't show hide_final_grades to students
refactor so that adding settings is less painful, and accessors are
automatic. change code to use accessors everywhere, and ensure settings
are handled by course import/export. also fix filter_attributes_for_user
call so that it correctly excludes hide_final_grades in api responses for
students

test plan:
1. toggle course settings (hide_final_grade / hide_distribution_graphs /
   allow_student_discussion_topics)
2. they should work as advertised

Change-Id: I152e2236099b1bc1a42730babef12ac9cc2f9733
Reviewed-on: https://gerrit.instructure.com/17534
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2013-02-08 16:11:00 -07:00
Cody Cutrer 00f3bb7994 change sections' root_account_id when the course changes
test plan:
 * move a course to a different root account
 * check the database - the section's root_account_id should have
   changed as well

Change-Id: I75647cc2c920af1b3f5e28ca8df30d32afa704a1
Reviewed-on: https://gerrit.instructure.com/17406
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-02-04 13:21:45 -07:00
Jon Jensen f9e4b4f4ed context profiles, refs CNVS-2650
add Profile model which can be used by context-y things, and a basic
CourseProfile model

test plan: N/A, see https://gerrit.instructure.com/17020

Change-Id: I68f4a5a4f0913167e7e25e7bc231b5bf8394c335
Reviewed-on: https://gerrit.instructure.com/17019
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-02-01 17:57:07 -07:00
Cody Cutrer 996a457bdc make assignments_needing_x shard safe
fixes CNVS-2200

normalize ignores out of the users.preferences column into
its own table. makes it more performant, and shard safe

test plan:
 * add a user as a teacher in courses on two different shards
 * set up an assignment needing grading (i.e. have a student
   submit an assignment that requires grading) in both courses
 * the assignment should show up on the teacher's dashboard
   regardless of which shard he's on
 * ignore the assignment on your dashboard on one shard
 * reload - it should stay gone
 * it should also be gone on the other shard
 * have another student submit to that assignment
 * it should come back on both shards for the teacher
 * ignore it, permanently this time
 * have another student submit to that assignment
 * it should still be gone on both shards

Change-Id: I6646410273c6be05d4b21b29b6ab76feb8e65d0f
Reviewed-on: https://gerrit.instructure.com/17295
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-02-01 17:08:41 -07:00
Cody Cutrer 36c447d66b process user account associations for multi-shard users
fixes CNVS-1338

basically, just process associations for the current shard, unless
we're explicitly calling update_account_associations on just the user
(since all the other triggers will only affect associations within
 the same shard)

test plan:
 * enroll an existing site admin user from the default shard in to a
   course on another shard
 * the user should immediately show up in the course's account's user
   list
 * remove the user from the course
 * the user should immediately disappear from the course's account's
   user list
 * note the associations a user has
  (u.user_account_associations.with_each_shard)
 * delete them all (u.user_account_associations.with_each_shard { |s|
     s.delete_all })
 * call u.update_account_associations
 * make sure they all get recreated

Change-Id: I794363d1703fb2d46cd27b67b1216fedef4deaae
Reviewed-on: https://gerrit.instructure.com/17155
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-02-01 14:30:39 -07:00
Jeremy Stanley 7098c2b65d fix error in updating API progress completion percentage
refs #CNVS-561

test plan:
 - use the Progress API to check the status of a batch course
   update in progress (this is hard, because it will probably
   happen quickly)
 - the completion value should update periodically from 0 to 100
   regardless of how many courses are being processed

there were two bugs here:
 1. the actual value returned was going from 0 to 1
 2. except on ruby 1.8.7, where it was actually counting the total
    number of objects

Change-Id: I5603869c6858b659682b23a9bfdeed4e922b58ca
Reviewed-on: https://gerrit.instructure.com/17314
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
2013-02-01 08:40:08 -07:00
Joe Tanner db4f24cb2f show an error message when visiting a disabled self-enroll link
closes #CNVS-2464

test plan:
- turn self-enroll on for a course (course settings, more options)
- copy the secret URL
- turn self-enroll off
- go to the secret URL
- it should say enrollment is closed and not a 404 page

Change-Id: Ibd3f1c36f3c444dad48d4f492756d1db320475d8
Reviewed-on: https://gerrit.instructure.com/17226
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
2013-01-31 09:30:01 -07:00
Simon Williams 6b2185cf36 remove course.allow_student_assignment_edits
this was a course setting which allowed students to edit assignment
descriptions only.  unfortunately, it didn't work, because the form validation
code assumed a title input field would be present and tried to require that it
was there.

closes CNVS-3267

test plan:
- make sure the setting is not availble in course settings
- make sure students cannot edit assignments
- make sure teachers can still edit assignments

Change-Id: Iebeaa00f357a59bff8462ecde79c57d68c04320f
Reviewed-on: https://gerrit.instructure.com/17056
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
2013-01-31 09:20:58 -07:00
Zach Pendleton 771439fbbd shard Course#section_visibilities_for.
fixes CNVS-3375, CNVS-3426, CNVS-3436

previously, a user with enrollments in two shards could not
access some pages (e.g. conversations and profiles) because
they attempted to load enrollments across both shards. this
commit fixes the issue by changing to the appropriate shard
while querying enrollments.

test plan:
  * create a user with courses in multiple shards;
  * visit the conversations and profile pages and verify
    that they display as expected and no error message
    is displayed.

Change-Id: Iee98e2f19b1c454557d36c30d87eea9751f4557f
Reviewed-on: https://gerrit.instructure.com/17258
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-01-30 16:25:17 -07:00
Jeremy Stanley bb005dda58 course batch update api
also adds a new Progress class and API endpoint for
managing new background jobs.

fixes #CNVS-561

test plan:
 * refer to the API documentation for Courses
   and Progress
 * use the Update Courses endpoint to offer, conclude,
   and delete multiple courses in a batch
 * use the Query Progress endpoint to check the
   status of a batch
 * make sure offering already published courses
   succeeds, and also concluding already concluded
   courses

Change-Id: I49d89c1f373f4999b6201574b43a20c53ef28b70
Reviewed-on: https://gerrit.instructure.com/16844
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2013-01-29 14:06:03 -07:00
Ryan Florence e6df3032f6 added allow_student_discussion_topics to settings
test plan:
1. Go to course settings
2. click edit settings
3. click more options
4. check/uncheck the "Let students create
   discussion topics" checkbox
   - the setting should work

Change-Id: Icf096c3098f700234887d6a39a1c2f4d9c55de49
Reviewed-on: https://gerrit.instructure.com/16981
QA-Review: Cam Theriault <cam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
2013-01-21 15:56:13 -07:00
James Williams b900f55d0e gracefully handle invalid files on course copy
add a warning to the content migration instead of error out
when encountering a problem copying a file in the course
copy process.

test plan:
* try to copy a course that has an invalid file
(note: this might be difficult if not impossible to
set up through the UI... the easiest way
seems to be to run the following in the console:
  Attachment.update_all({:filename => nil},
  {:id => (-INSERT ATTACHMENT ID HERE-)})

fixes #CNVS-2169

Change-Id: Ie3cd11998f4a81ce8d79a756a8a65a31ec19bad3
Reviewed-on: https://gerrit.instructure.com/16705
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2013-01-17 09:04:56 -07:00
Jon Jensen a1d2f65790 don't let users message the whole course if they can't send_messages
fixes #CNVS-2611

also fix broken account user permission check (an account user could view
all users in a course, regardless of permissions). simplify logic in
enrollment_visibility_level_for

test plan:
1. as a student, confirm you can message the whole course
2. under account permissions, revoke "Send messages to course members"
   from students
3. as a student, confirm you can only message admins in the course

Change-Id: I29d73c68b8d93c54616a515c699818025b4bb839
Reviewed-on: https://gerrit.instructure.com/16581
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
2013-01-16 11:06:23 -07:00
Ryan Florence fa3d291cd7 add allow_student_discussion_topics course setting
test plan:

1. log in as a student and go to:
   /courses/:id/discussion_topics/
   - the “start a discussion” button should work
2. open script/console
3. Find a course and change the setting, i.e.:
   c = Course.find(1)
   c.allow_student_discussion_topics = false
   c.save!
4. Log in as a student and go to:
   /courses/:id/discussion_topics/
   - The “start a discussion” button should not
     display

UI coming in a different commit

closes #CNVS-2613

Change-Id: I162b0356f1e23bee2bdb89f7797976bc3bab192d
Reviewed-on: https://gerrit.instructure.com/16674
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
2013-01-11 15:47:21 -07:00
Jeremy Stanley d9c450e582 users tab: don't increment the count with duplicate enrollments
test plan:
 - have a user with a login enrolled in a course
 - in the users tab, try to add that user again, in the same role,
   using the user's login id
  - you should see an "already existed" message, and the count
    above the role should not change
 - the above should still work if this user is preceded by more
   than 16 other users in the enrollment list (that is, we should
   still recognize the user as already enrolled even if they're
   not loaded in the paginated list; please do a refresh before
   enrolling the test student to make sure the buffer students
   aren't loaded)

fixes #CNVS-2767
fixes #CNVS-2770

Change-Id: I2ee56b48ac7dc382cb352c4e99d02e86480aec95
Reviewed-on: https://gerrit.instructure.com/16720
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-01-11 10:33:16 -07:00
Ryan Florence cde076eafd show all users not assigned to group in unassigned
fixes #CNVS-2619

test plan:
1. create an account level group
2. put somebody in the group
3. remove them from the group
4. refresh the page
   - the user should be in the unassigned area

if a user had previously belonged to a group, they
were no longer included in unassigned since the
query didn't check the workflow state

Change-Id: Iaca501c4fc35847759f56a925707618571943bf6
Reviewed-on: https://gerrit.instructure.com/16638
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Ryan Florence <ryanf@instructure.com>
2013-01-09 15:47:33 -07:00
Cody Cutrer 1e339db4c5 add support for applying role overrides to just self or just descendants
* wrap RoleOverride#permission_for with enabled_for? that also takes a
   context of where the permission is being applied, and recalculates its
   enabled-ness relative to that context; use that for checking account
   admin and enrollment permissions
 * refactor User#can_masquerade to properly check for descendant
   permissions

test plan:
 * create a custom role in site admin. give it permission to
   manage permissions
 * in script/console, find that override and set apply_to_self=false
 * add a user to that role, and login as that user
 * the user should not be able to change permissions in site admin
 * the user should be able to change permissions in the default
   account
 * add another role in site admin. give it permission to manage
   permissions
 * in script/console, find the override and set apply_to_self=true,
   apply_to_descendants=false
 * add another user to that role, and login as that user
 * the user should be able to change permissions in site admin
 * the user should not be able to change permissions in the default
   account
 * the first user should not be able to masquerade as the second user
   and vice versa
 * an Account Admin should be able to masquerade as either user
 * create a custom role in the default account, give it permission
   to manage permissions, and add a user to that role
 * the first user should be able to masquerade as the new user;
   the second user should not be able to masquerade as the new user

 * general regression tests on permissions and masquerading

Change-Id: I20a1183b7dfec419634a92cda498f245187060ef
Reviewed-on: https://gerrit.instructure.com/15896
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2013-01-08 11:01:13 -07:00
Stanley Stuart d30084e9c2 update assignments api to handle frozen assignments
Allows several new fields in the Assignments API to both update existing
assignments and set attributes on freshly created assignments.

test plan:
  - run through the api trying each field in the generated
    documentation.
  - Make sure you can create assignments with every field, and update
    assignments with every field available in the documentation. The
    specs do this so they should pass as well.

closes #CNVS-2190

Change-Id: I0d67e379777b5a313f45289f23852122b1e61a37
Reviewed-on: https://gerrit.instructure.com/16114
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2013-01-04 17:01:05 -07:00
James Williams 94fd914e4a don't send notifications to students for locked/hidden files
notifications will no longer be sent to students if:
 * the file's folder is locked (and thus inaccessible
 to students), or
 * the files tab has been hidden on the navigation
 and is thus inaccessible by students

test plan:
 * as a student, set file notification to ASAP
 * as an admin, create a folder and lock it
 * add a file
 * confirm that the student account did not receive
 an email notification

 * repeat the above, but instead of locking the file,
 hide the file navigation tab in the course settings

closes #CNVS-1688

Change-Id: Ic4398f2dadca0892d7e0643ec5e9b3eba6991dbd
Reviewed-on: https://gerrit.instructure.com/16243
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-01-02 15:47:53 -07:00
Jacob Fugal 5756417887 restrict length of tmpfile filename
an excessively long course short_name or assignment title could cause a
filename over the 256 character limit.

fixes #CNVS-2365

test-plan:
 - create a course with a 250+ character course code (aka short name)
 - create an assignment in that course
 - create a submission for that assignment
 - go to the assignment page and click "Download Submissions"
 - zipfile should successfully create and download
 - repeat with short course code but 250+ character assignment title

Change-Id: Idcf0bdc303e8b467fc29196c52081f2070344811
Reviewed-on: https://gerrit.instructure.com/16362
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <ethan@12spokes.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-01-02 14:41:39 -07:00
Jeremy Stanley af737b8672 look at role name when reusing enrollments; fixes #CNVS-2431
test plan:
 * enroll a user as a plain Student
 * enroll the same user in a custom student role
 * the plain Student enrollment should not disappear

Change-Id: I7f7a1ce96a1a5f971a7226756d25b063d6f88a87
Reviewed-on: https://gerrit.instructure.com/16363
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2012-12-28 15:23:15 -07:00
Cameron Matheson 105a4ae0a9 don't ignore muted assignments in gradebook csv
closes #CNVS-2397

Test plan:
  - set up a course with assignments
  - mute some assignments
  - set grades for students
  - make sure the gradebook csv totals and the gradebooks match
  - the student's grade page (when masquerading) should *not* match
    (it should ignore muted assignments)

Change-Id: Iebe15c5d108dcfa899bd501cc6dd45ceb688fa25
Reviewed-on: https://gerrit.instructure.com/16197
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Tested-by: Simon Williams <simon@instructure.com>
2012-12-26 10:11:50 -07:00
Jon Jensen 03502069b7 only count self enrollments toward limit, refs #CNVS-1120
don't count manually created student enrollments toward the cap

test plan:
1. set an enrollment limit on a new course (e.g. max 1)
2. as a teacher, add several students
3. confirm that additional students can still self enroll up to the limit
   (the students added in step 2 don't count)

Change-Id: I93309181f3a5021d6cf51b8c02ba899f017cd32e
Reviewed-on: https://gerrit.instructure.com/16308
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2012-12-23 15:59:31 -07:00
Simon Williams 34bf7cb4af add course setting to disable student distribution graphs entirely
there are various concerns about the distribution graphs available on the
student grades page revealing too much about other students scores.  give
teachers the option to remove these for all students in their course.

fixes #CNVS-1063

test plan:
- as a teacher, grade > 5 students for an assignment
- as a student, verify that you can see the box and whisker plot of the grade
  distribution on your grades page.
- as a teacher, go to course settings > more options > and check "hide
  distribution graphs"
- as a student, verify that you cannot see the graph anymore.

Change-Id: Ieab4137e52b616a394a3de0ee313cfd0a0abcc0d
Reviewed-on: https://gerrit.instructure.com/16191
Reviewed-by: Stanley Stuart <stanley+gerrit@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
2012-12-21 12:45:15 -07:00
Mark Severson 6fab11cc82 changed Student View to create a default section (if necessary)
fixes #CNVS-2300

test plan:
 * using a course that has no sections
 * click 'Student View'
   - the Student View should show correctly (not error)

Change-Id: I2dbfab8775d51a4a0cf4aae22de9f7207da848c3
Reviewed-on: https://gerrit.instructure.com/16223
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2012-12-20 13:46:17 -07:00
Jon Jensen 92c4bfdd37 self enrollment caps, refs #CNVS-1120
add support for self enrollment caps to limit the size of a particular
course. there is no UI for setting caps (yet)

test plan:
1. run specs
2. follow test plan for https://gerrit.instructure.com/15819

Change-Id: Ibf0a8f04f0c2efa820d0850cef26dfae20849246
Reviewed-on: https://gerrit.instructure.com/16021
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
2012-12-19 12:29:58 -07:00
Jon Jensen f74ebd096b self enrollment refactor to facilitate CN integration
fixes #CNVS-1119, potentially supersedes
https://gerrit.instructure.com/14501 with a little work.

simpler flow that is more consistent with FFT signup. whether you click
the "join course" button (popup) or go to the join url, the workflow is
the same:

1. if you are authenticated, you just click the enroll button.
2. if you are not authenticated, you can either:
   1. enter your (canvas/ldap) credentials and submit to join the course.
   2. register and join the course (single form). you will then be
      dropped on the course dashboard in the pre_registered state just
      like a /register signup (you have to follow the link in your email
      to set a password).

note that if open registration is turned off, option 2.2 is not available.

other items of interest:

* fix CSRF vulnerabilities where you can enroll authenticated users in
  open courses, or un-enroll them if you know their enrollment's UUID
* move to shorter course-id-less route (w/ join code)
* reuse UserController#create
* handy openAsDialog behavior and embedded view mode
* better json support in PseudonymSessionsController#create
* extract markdown helper from mt
* show "you need to confirm your email" popup when you land on the course
  page the first time (already showed on dashboard)

test plan:
1. test the authenticated/unauthenticated scenarios above, for both the
   popup and join pages
2. regression test of /registration forms

Change-Id: I0d8351695356d437bdbba72cb66c23ed268b0d1a
Reviewed-on: https://gerrit.instructure.com/15902
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2012-12-19 12:29:47 -07:00