Commit Graph

798 Commits

Author SHA1 Message Date
Cody Cutrer 626dddfddc show temporary invitations from all shards
test plan:
 * turn on cross-shard invitations in the console
   (Setting.set('cross_shard_invitations', '1'))
 * create a user with an email address in a shard (NOT
   a site admin)
 * in an unrelated shard with open registration on,
   as an admin invite that e-mail address to a course
 * log in as the original user on the first shard; the invitation
   should show up on your dashboard
 * accepting/rejecting that invitation is *not* yet supported

Change-Id: I3b0c9657fe0dd37a737af9f4253ea8ef8b2f2b91
Reviewed-on: https://gerrit.instructure.com/14903
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-11-12 09:24:29 -07:00
Joe Tanner 5e4d2787dd dashboard caching of recent_stream_items, closes #11396
Change-Id: Ib84785c76addc15734162560e6a9de352aa7618f
Reviewed-on: https://gerrit.instructure.com/14998
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-11 21:56:28 -07:00
Simon Williams dd62ef5805 new dashboard design
the new dashboard design categorizes recent activity into buckets that can be
expanded/collapsed, and inidividual messages can be dismissed.  the categories
are announcements, conversations, discussions and assignments.  this redesign
applies to the homepage dashboard, the group home page, and the course homepage
when "recent activity dashboard" is selected as the course home page type.o

the motiviation is that the dashboard should capture and present in one place
important information happening in all the user's courses or groups, and allow
for jumping into this information to see more details:

- announcements/discussions should show on the dashboard when they are created,
  or when there are root replies to recent announcements
- conversations should show on the dashboard when there is new activity
- assignments should show on the dashboard when they are created, or when
  changes are made at least a couple hours after being created

the presence of a dashboard item means there is activity for that item that may
be of interest to the user.  additionally, the dashboard items will show
read/unread state (excluding assignments) for items which the user has not yet
viewed.

additionally, global messages such as course inivitations, account level
announcements, and new user messages have been restyled, but will keep their
place above the recent activity widget on the dashboard.

test plan:
- visit many exising user's dashboards and make sure they are functional in the
  new style.
- visit canvas as a brand new user (no enrollments), a new user enrolled in
  a new course and make sure the dashboard is restyled and the messaging makes
  sense.
- make an account level announcement and make sure it shows up on user's
  dashboards.
- create all different types of conversations: single, group, bulk private,
  from submission comment, add user to convo, etc. and make sure the
  appropriate dashboard items appear and make sense
- create discussions and announcements, reply to them at the root level and at
  the sub entry level (sub entries will not make new dashboard items), test
  from both a read and unread user's perspective, making sure dashboard items are
  correct. (note that read/unread state will not be correct for existing items
  before this code is applied, but should be correct for future items moving
  forward)
- dismiss dashboard items and account announcements, make sure they stay
  dismissed.
- test creating assignments, waiting > 2 hours, and updating due dates or other
  assignment details. make sure items appear. note that unread state will not
  exist for assignment notifications.

closes #10783
refs #11038
refs #11039

Change-Id: I276a8cb1fae4c8a46425d0a368455e15a0c470c5
Reviewed-on: https://gerrit.instructure.com/14540
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-11 21:56:16 -07:00
Stanley Stuart 1a2779eb12 add varied due date functionality to the main assignments page
test plan:
  REFERENCE:
    * "Main Assignments Page": "localhost:3000/assignments", or click on
    "Assignments" in the menu bar near the top of the page.
    * "Right Side Bar": Go to the Main Assignments Page, it's on your
    right.
    * "Course Assignments Page": Hover over "Courses" in the menu bar
    * near the top of the page, click on the course you set up. Once
    that page loads, click on "Assignments" tab on the left hand side.
  STEPS:
    * https://gist.github.com/f12b3694016f3dcc979e

Change-Id: I9a5884ec1057f196ba5b731a2978c874141bec5b
Reviewed-on: https://gerrit.instructure.com/15006
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-11-09 23:21:44 -07:00
Cody Cutrer f31a99ba29 fix find_pseudonym_for_account for multiple shards
test plan:
 * run the specs

Change-Id: I3ecbebfa226b243c7a39d9ead0621c95583b0f84
Reviewed-on: https://gerrit.instructure.com/15119
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-08 11:07:32 -07:00
James Williams 598590d942 don't show "add user" for concluded courses
prevent active enrollments from being added for concluded courses
and causing authorization problems

(revision: took jeremy's advice and moved tests from
selenium to views)

(revision #2: took more of jeremy's advice and added checks
in controller and api, rather than just removing the button)

(also, I forgot to add files to the commit.. durr)

test plan:
 * Conclude a course
 * Try to add a user

closes #9691 #11552

Change-Id: Ibb267f5d714b43fa033d40dad93511e443b17790
Reviewed-on: https://gerrit.instructure.com/14865
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-08 09:59:39 -07:00
Sterling Cobb 3f4fe6d295 Make course syllabus optional when copying courses
fixes #9185

This adds a new version of export files and ensures
older exports will work. We are now using a
canvas_export.txt resource to identify if this is a
canvas cartridge or a common cartridge.

Test Plan
1. Copy a course
2. When copying, unselect copy all and course syllabus
3. The syllabus shouldn't be copied over.

Change-Id: I37c9aa12aabe453ef4481c6f39b7b33c97b130bb
Reviewed-on: https://gerrit.instructure.com/14971
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-11-08 09:29:50 -07:00
Cody Cutrer 92bce427ad fix pre-course-start invitations for ended courses fixes #11645
test plan:
 * invite a student to a course
 * change the enrollment term the course is in to be from
   "whenever" to <some date in the past>
 * log in as the user
 * you shouldn't get an error
 * the course should show up as a past course

Change-Id: Icd5c8dd96c637dfa6e1e66accd7e017807d0c55f
Reviewed-on: https://gerrit.instructure.com/15037
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-11-07 10:11:40 -07:00
Joel Hough 992df4a1f0 remove outcomes tab for non-users. fixes #11587
test plan:
- make a public course with a learning outcome
- view the course home page while not logged in as any user
- ensure outcomes tab is not present
- navigate to /courses/<course_id>/outcomes
- ensure the page does not load, while presenting a reasonable lack of permissions message
- log in as registered user that should be able to see outcomes
- ensure that the outcomes tab and page are still accessible

Change-Id: I17f974f6dc7c55332391cf6c87c4959d15a95273
Reviewed-on: https://gerrit.instructure.com/14962
Reviewed-by: Mark Ericksen <marke@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Marc LeGendre <marc@instructure.com>
2012-11-06 13:11:58 -07:00
Jacob Fugal 0e68e4b2be dump student links when deleting an adhoc override
test-plan:
  - create a student in a course
  - create an adhoc override for an assignment in that course with the
    student as part of the override's set
  - delete the override
  - attempt to create another adhoc override for the same assignment and
    student
  - should not fail validation

Change-Id: I708ef2a219e379d12b2ddbc30cb772d0403ad84d
Reviewed-on: https://gerrit.instructure.com/15044
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-06 09:30:11 -07:00
Cody Cutrer fbd33f6b9b hide dropped columns on existing records fixes #9365
Change-Id: I95f5fbfe2346815bc115cd3045a980b8c2873012
Reviewed-on: https://gerrit.instructure.com/14964
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-11-06 07:22:08 -07:00
Jeremy Stanley bbda06964d course filters in accounts api; fixes #11389
test plan:
 * See the API documentation for "List active courses in an account"
 * Exercise each of the parameters and verify the correct courses
   are returned

patch set 4: added new specs that test the scopes by themselves,
 and with other scopes layered on them; also, reorganized the
 api specs into separate tests

Change-Id: Ifef0018aad9fc03b44d7542a787ecefb3cf05c5e
Reviewed-on: https://gerrit.instructure.com/14924
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Sterling Cobb <sterling@instructure.com>
2012-11-05 16:47:00 -07:00
Jacob Fugal 117a7e1a7c VDD: overrides API
fixes #10831

test-plan:
  - list, fetch, create, update, delete overrides through the API
  - create overrides during assignment creation through the API
  - update overrides during assignment update through the API

Change-Id: Iab899f146ff4385b0abc6a842caca6803fa4e9f1
Reviewed-on: https://gerrit.instructure.com/14260
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-11-05 15:05:37 -07:00
Cody Cutrer dcd9b5bfee fix User#sis_pseudonym_for cross-shard
test plan:
 * create a pseudonym with an SIS id for a user on an account in a
   different shard
 * GET /api/v1/users/:user_id/profile for that user against the
   account's domain (easiest to just use self)
 * sis_login_id should be populated

Change-Id: Idd95b949c4180abc366071a110636d348aa24806
Reviewed-on: https://gerrit.instructure.com/14875
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-11-05 09:17:13 -07:00
Bracken Mosbacker 2780604b09 change concluding courses in ui/api to a soft conclusion
Instead of "hard concluding", or setting the workflow
state to 'concluded', courses will now set the end date
and be soft concluded.

This is to allow easier unconcluding in the future so that
all enrollments are still active.

Test Plan:
 * Publish a course
 * conclude the course
 * notice that the end_at date for the course is set to when you concluded it
 * notice that the "Users can only participate in the course between these dates" checkbox is checked

closes #11387 #11386

Change-Id: I568539723b7f0f4471761d742ff3a8bb821a7605
Reviewed-on: https://gerrit.instructure.com/14748
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
2012-11-05 08:45:08 -07:00
Jon Willesen e6bdc72538 discussion assignments should set the author for the discussion
The assignment model is responsible for creating the associated
discussion topic, so the controller needs to tell it which user
is creating the assignment.

Removed duplicate definition of assignment_valid_attributes
function that confused me while updating specs.

fixes #11411

test plan:
 - create a course with a teacher
 - login as the teacher and create a discussion assignment for
 the course
 - find the assignment's discussion topic and see the author is
properly set to the teacher

Change-Id: I234f356f0d034e5c2d37dd0de0c1475ecb9879ed
Reviewed-on: https://gerrit.instructure.com/14719
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Reviewed-by: Marc LeGendre <marc@instructure.com>
2012-11-01 15:32:00 -06:00
Simon Williams b9570a9d8e mark submission comments as unread for correct user
fixes #11539

- as a teacher, leave a comment on an already graded submission
- as a student you should get an indicator in the left nav and a blue dot
- after viewing the grades page, these should both clear
- repeat (should get another blue dot + indicator)

Change-Id: I6d980cae5246e58e225cb6ae531be6c2d7c78549
Reviewed-on: https://gerrit.instructure.com/14913
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-11-01 13:20:39 -06:00
Cody Cutrer 20c1112a7d include enrollments from all shards closes #6900
also change all_pseudonyms and accounts to use the new
HasManyAssociation#with_each_shard hawtness

test plan:
 * enroll the same user in courses in multiple shards
 * favorites don't work yet; be sure to reset them before
   continuing
 * courses from all shards should show up in your menu
 * courses from all shards should show up in your all courses
   page
 * when enrolled as a student in a course not on the user's shard,
   permissions should be correct (particularly, you should be able
   to participate as a student - turn in assignments)
 * enroll the user in groups from multiple shards
 * all groups should show up in home menu

Change-Id: I84fffa39ebf3dee093ecff145670a29296da29a1
Reviewed-on: https://gerrit.instructure.com/14722
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-11-01 11:47:07 -06:00
Jacob Fugal b68592b602 clarify/fix outcome API permissions
fixes #11504

Change-Id: If7c480bfac9b0339f9ce9f0ec6d5705dafbcb037
test-plan:
 - global outcomes should be visible to:
   - any logged in user
 - outcomes defined in an account should be visible to:
   - admins in subaccounts
   - enrollees in the account's courses
   - enrollees in the account's subaccounts' courses
 - outcomes defined in a course should be visible to:
   - any user that can view the course
 - global outcomes should not be visible without being logged in
 - managing outcomes should require the same permissions as before
Reviewed-on: https://gerrit.instructure.com/14910
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-11-01 11:44:59 -06:00
Dave Donahue 8570601c41 don't point directly to gradebook1 in speed grader
Fixes #10793

Test plan:
1. Go to the gradebook and verify the gradebook version you are on.
2. Go to an assignment and load up the speedgrader.
3. Click the 'Gradebook' link at the top of the page.
4. You should be on the same version of the gradebook as you were
   originally. Repeat steps 1-3 after switching to the other gradebook.
   Previously, you were always taken to gradebook 1.

Other notes:
* Adds a 'gradebook_url_for' helper that accepts a user, context, and
  assignment and constructs a URL based on the user's preference

Change-Id: I596202d448c61046efae1e13ab8c9e87c3f7768b
Reviewed-on: https://gerrit.instructure.com/14666
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-11-01 10:36:47 -06:00
Brian Palmer 4363cb5a9b refactor cassandra page view history helper into PaginatedCollection
This functionality can be useful other places where we want a
willpaginate-compatible collection as well.

test plan: cassandra page view history at /users/X should work same as
before.

Change-Id: I0f57ce57efa56d518195f2fce90074ab0b42c1e5
Reviewed-on: https://gerrit.instructure.com/14861
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-11-01 10:33:01 -06:00
Dave Donahue 4078bd20ed fix shuffling of answers on fill in multiple blank questions
Fixes #10375

Test plan:
1. Create a quiz, add a 'fill in multiple blanks' question with a few blanks,
   and check 'shuffle answers.'
2. Save and preview the quiz, and fill in the right answers.
3. The answers in the input boxes should appear in the same order as you
   filled them in. Before this fix, they were appearing in random order
   and did not match up with the order in which you typed them.

Change-Id: I5668f3c32a5f6f0253457566a3b05ea073e00294
Reviewed-on: https://gerrit.instructure.com/14670
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Amber Taniuchi <amber@instructure.com>
2012-11-01 07:04:37 -06:00
Brian Palmer 27a83f69ae migrator for page views db -> cassandra
This is meant to be a one-time run, when setting up a new cassandra
cluster for page views and you want to migrate all your current page
views sitting in your db to that cluster.

test plan: generate some db page views, then switch configuration to
cassandra page views. run rake db:migrate_pageviews_to_cassandra and the
existing db page views should now be in cassandra, including showing up
in the user's page view history.

Change-Id: Ib1b1aa4277c306c1c651e9ca587d3654ab0d00d3
Reviewed-on: https://gerrit.instructure.com/14687
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-10-31 17:10:46 -06:00
Jacob Fugal a75f34148e VDD: use most lenient due_at/lock_at/unlock_at
instead of "most specific"

Change-Id: I0b585de78dfb8ed7597e326610856aec331ed9f6
test-plan:
 - create an assignment with a section override and an adhoc override,
   and a student to which both overrides apply
 - set the assignment's due_at and the section override's due_at, then
   set the adhoc override's due_at to be later than both the section
   override's and the assignment's; the value of
   assignment.overridden_for(student).due_at should be that of the adhoc
   override
 - set the section override's due_at later than the adhoc override's;
   the overridden due_at should be that of the section override
 - set the adhoc override's due_at to be nil (but still overridden); the
   overridden due_at should be nil
 - set the adhoc override's due_at back later than the section
   override's and set the assignment's due_at to nil; the overridden
   due_at should be the adhoc override's
 - overridden all_day and overridden all_day_date should track with the
   overridden due_at
 - repeat for unlock_at and lock_at, but expect the *earliest* date for
   unlock_at, rather than the latest
Reviewed-on: https://gerrit.instructure.com/14853
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley+gerrit@instructure.com>
2012-10-31 15:16:49 -06:00
Jacob Fugal 4a236e32bd change tracking of active teachers/students/users
...in the CountReport to only users with a pseudonym that's been
accessed in the last 30 days. fixes #11381

Change-Id: Ic4c10b1bd49bc9f10e5d4ef20a7ea2bd78ab27b9
Reviewed-on: https://gerrit.instructure.com/14780
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-29 12:20:36 -06:00
Cody Cutrer a6420c966b proactively clear cache when changing plugin settings
test plan:
 * enable a cache store (redis, memcached)
 * change a plugin setting that's easily visible (like enabling
   twitter shows up in your profile, or enabled account reports
   shows up in account settings)
 * the change should take affect immediately, instead of five
   minutes later

Change-Id: I5968266c274defbd81f863f03acb6d5b5dc5a102
Reviewed-on: https://gerrit.instructure.com/14798
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-10-29 12:11:31 -06:00
Jeremy Stanley fe56193ec8 remove half-baked assignment reminders feature
we're doing work and consuming storage keeping track of reminder
information that nobody is consuming.

should we decide to implement assignment reminders in the future,
reverting this commit would be an excellent start; then a
delayed_job that periodically called remind! on each result of
AssignmentReminder.needs_sending would get us most of the
way there.

Change-Id: I2b110cab79d53229b30c9fef64aac646b719a700
Reviewed-on: https://gerrit.instructure.com/14569
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-10-29 11:20:34 -06:00
Zach Pendleton 94908ef8b8 don't display announcements tab on public courses.
fixes #11266

because a user can't see course announcements without being
logged in, don't display the announcements tab in the course
navigation unless there is a current user.

test plan:
  * create a public course with an announcement;
  * without being logged in, navigate to the course and verify
    that the announcements tab is missing from the course
    navigation;
  * verify that the course tab still appears for logged in
    users.

Change-Id: I319f1f022d7cdbf54772b0e99bcb59cae74d1a42
Reviewed-on: https://gerrit.instructure.com/14618
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
2012-10-26 09:09:10 -06:00
Cody Cutrer a9a79ffa70 fix a few cross-shard collection item stuffs
* don't use set_shard_override, just set shard= directly
 * when creating follows, run the transaction, the search, and
   the create all on the same shard
 * when searching for upvotes, root on the user, not the
   collection item

Change-Id: I5ae3f29e5f48f92c02d3a0c0e04765956d8eb892
Reviewed-on: https://gerrit.instructure.com/14648
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-25 19:05:58 -06:00
Simon Williams f984b9b26b remove announcement/discussion badges from left nav
closes #11452

they were confusing because they represented "never before seen",
but there was no way to filter for them on the discussion/announcement index
page.  grades badges still exist though.

test plan:
- make sure new discussions/announcement don't make badges for other course
  users in the left nav.
- make sure grade badges still work correctly.

Change-Id: I04a3c8d4a0c246be1660201b7e9f7f73c5065ffa
Reviewed-on: https://gerrit.instructure.com/14708
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
2012-10-25 17:04:17 -06:00
Jacob Fugal 52cd995f1b Merge branch 'dev/learning_outcome_refactor'
simple keep-both merge in config/routes.rb

Conflicts:
	config/routes.rb

Change-Id: If4180b9c360f32786acce2a8ad6251437318db21
2012-10-25 15:12:10 -06:00
Joe Tanner 27edbc1e8b Nested outcomes UI, closes #9158
test plan for course, account, and sub-account
outcomes page:
- using the 'New' buttons in the toolbar
  create, edit, and delete a bunch of outcomes
  and groups and nested groups
- when editing an outcome, insert, edit, and delete the criterion ratings
- find dialog
  - inside any top level standard group
  - select an individual outcome or a group to import
  - after importing, the outcome or group should show up in the
    seleced group of the main window and show it's details on the right
  - account standards
    - the account groups (the first level under 'Account Standards') should
      not be importable
- pagination
  - add 20-30 outcomes and groups to a group
  - groups should load first and then the outcomes
  - a 'Loading more results' item should be displayed when fetching
    more pages
- test out the 'Back' button

Change-Id: Iba1bb0533fb962ac6d206179c82c388f5fee1d84
Reviewed-on: https://gerrit.instructure.com/13086
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2012-10-25 11:03:21 -06:00
Ethan Vizitei 84efe7ce1e [#5773] Ruby 1.9.3 spec fixes
[#5773] correctly evaluate the custom_fields_string

My impression is that order is not enforced in the
hash being used to build the fields string, as 
this was failing in 1.8.7 for me (but not in 
1.9.3), because the string being checked was
"b=456\na=123" while the string being returned
from the custom_fields_string method was 
"a=123\nb=456".  Testing with a regex instead
confirms the content is there without relying on
any particular order. [EDIT: Per Brian P, decided
to sort the params instead to enforce order]

[#5773] fix admin_settings_tab_spec for ruby 1.9.3

String's "each" method was being used, which is 
gone in 1.9.  Fixed by performing a guard clause 
in the check_box_verifier in the spec file to 
conditionally take a string argument and convert 
it to an array.  Also converted the rest of the 
method to assume an array value for that argument.

[#5773] fix collaborations selenium spec for 1.9.3

This is an instance of using the "each" method 
of the string class which is no longer present in 
1.9 in one of the helper methods in this spec.  
Erected a guard clause to check for Array-ness 
and to replace the argument with an 
array if necessary.

[#5773] fix courses show view

There was a spot in this view where it was 
interpolating "self.id" into an html attribute
rather than "@instance_model.id".  This sort
of worked in ruby 1.8, where it would interpolate
the object id of the view instance.  In 1.9,
that id becomes "object_id", which is what
one would have to change the code to in order
to preserve the current behavior.  
However, it seems more correct to simply pull the
correct id of the contextual model object instead
(which is what I did).

[#5773] fix teacher_wiki_and_tiny_images spec

This is an instance of using a string as an 
enumerable; adding a guard clause to
lib/sticky_sis_fields.rb to transform the string
argument into an array fixes it

[#5773] fix selenium/student_submissions_spec.rb

This is an issue with SSLCommon's use of 
net/https.  In older ruby versions there are 2 
parameters returned (the response, and the body).  
Now only the response is returned, 
so the response object has to be asked for the 
body explicitly. This fix was made in 
spec/selenium/helpers/files_common.rb

Change-Id: I66a25ebbc1d8e5af7b7117375210172d287a77c7
Reviewed-on: https://gerrit.instructure.com/14641
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-10-25 09:34:28 -06:00
Cody Cutrer b3dd53d72c cache site admin permission lookups if it's the only one being queried
it's a common query, so reduce db dependency if possible

test plan:
 * as a site admin, ensure you still have access to everything
 * as a non-site admin, ensure you don't have access to any courses
   or accounts that you shouldn't (even without links to them)

Change-Id: I56fb5063b16fe6a3ddc96bdf66586a9e48a79850
Reviewed-on: https://gerrit.instructure.com/13757
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-25 08:51:49 -06:00
Brian Palmer 005e42a757 cassandra store for page views
Adds a new back-end store for page_views, using a Cassandra cluster. All
the current page view queries are supported, many using denormalized
views on the data.

test plan:

first, canvas instances that are currently using AR page views
should function as before.

by Setting.set('enable_page_views', 'cassandra') and restarting, you will
switch to cassandra page views. a script to migrate the AR page views to
Cassandra is coming. all page view functionality should work as before.
note that the format of the pagination headers in the
/api/v1/users/X/page_views endpoint has changed.

Change-Id: I2d1feb4d83b06a0c852e49508e85e8dce87507b4
Reviewed-on: https://gerrit.instructure.com/14258
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-24 17:23:56 -06:00
Jacob Fugal 2fc15ae69c Merge branch 'master' into dev/learning_outcome_refactor
simple keep-both resolutions for app/models/submission.rb and
config/routes.rb. spec/integration/learning_outcome_group_spec.rb stays
removed.

fixed path->url in outcome group api pagination to match master's new
rules.

Conflicts:
	app/models/submission.rb
	config/routes.rb
	spec/integration/learning_outcome_group_spec.rb

Change-Id: I8dd31e1d3764970a8f683aef362f0cca06abe90e
2012-10-24 13:56:33 -06:00
Cody Cutrer c506b1a7de cross-shard user merging
test plan:
 * merge a user in one shard into a user in another shard
 * email addresses should come over (try pairs of users with
   different combinations of duplicate e-mail addresses and
   workflow states)
 * being an admin should come over
 * enrollments and pseudonyms also should come over, but aren't
   visible in the UI yet
 * user_services (twitter, facebook, linkedin, etc. on the profile)
   should come over
 * conversations and perma-observerness does *not* work yet
 * three users, all from different shards, together, and confirm
   the above again (especially being an admin, since that's what's
   visible in the UI)

Change-Id: I2b2cac62a18663e22faf72ebaae8123f703146c6
Reviewed-on: https://gerrit.instructure.com/14182
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-10-24 13:22:11 -06:00
Mark Ericksen ac9182cf56 Fix deleted admin enrollments enabling student to see discussion topics without a post. Fixes #11192
Fixed the DiscussionTopic#user_ids_who_have_posted_and_admins method to only
look at active admin enrollments. Was picking up the TA's deleted admin enrollment.

Testing Steps:
===========
* Create a course as a teacher and add a TA
* Create a Discussion Topic that requires a user to post before
   seeing other user's responses.
* As a student, add a response
* Verify that the TA can see the other student's response
   without having created a post themselves.
* Remove the TA's enrollment in the course and
   add the TA as a Student.
* As the TA-turned-student, visit the discussion
  and verify that you cannot see the replies
  without first making a post.

Change-Id: I35ed1a6b05128e8e3636574df3779449a5ee3c69
Reviewed-on: https://gerrit.instructure.com/14617
Reviewed-by: Joel Hough <joel@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Reviewed-by: Marc LeGendre <marc@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-23 14:58:02 -06:00
Ethan Vizitei 19cddc7047 [#5773] multiple ruby 1.9 spec fixes
Fix 'translation missing' helper spec
Fix intermittent timeout issue on 1.8.7
Send ZipFile::CREATE rather than true for 1.9 compatibility

Solve 2 more specs for 1.9.3 in the "lib/cc"
(the main problem here was that both files
used require strategies that assumed 1.8 style
load path configuration.  Wrapping them with
'expand_path' makes them able to find the helper.
Also, in the cc_helper, a spec was passing
in a string that needed to be specified as
UTF-8 in order to not confuse nokogiri.)

Fixed google doc id access
(in 1.8.7 the Atom::SimpleExtensions::ValueProxy
representing a document's ID was being to_s'd as
a single value.  In 1.9.3, it was including Array
braces around the value, causing the URL for
editing to be malformed.  Updating the
GoogleDocEntry class to pull the "first"
value from the ValueProxy allowed it to function
correctly (and is backwards compatible to 1.8))

Fix multiple helper requirement issues
Fix spec string encoding for incoming message processor spec
Fix the counts_report_spec for 1.9
Fix ruby 1.9 errors when testing text_helper.rb

Fix the splat handling for the notification 
policy data fixer

Change-Id: Ib70291442eaf2855565db6e451570c0a7670c6ed
Reviewed-on: https://gerrit.instructure.com/14517
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-10-23 10:14:24 -06:00
Joel Hough 7b93ba46f0 add api for listing visible navigation tabs
test plan:
- fetch tab list using some command like:
curl -H 'Authorization: Bearer <token>' \
 https://<canvas>/api/v1/courses/<course_id>/tabs\?include\="external"
- ensure that the returned list corresponds to the left-hand tab list on the
  web interface

fixes #10891

Change-Id: If3371472b58f849a9736ab6747f69551178e99a4
Reviewed-on: https://gerrit.instructure.com/14615
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-10-23 10:13:20 -06:00
Jacob Fugal be6093f9cd VDD: Assignment#due_dates_for(user), et al.
a convenience method to get all due dates applicable to and/or visible
to a specific user for an assignment. new named scopes on
AssignmentOverride to facilitate it, and minor bug fixes

Change-Id: I7f400fd13b7903b362e9ca0e6991f1d287f5f783
Reviewed-on: https://gerrit.instructure.com/14581
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-10-23 09:06:30 -06:00
Jacob Fugal de1676cd4b rename user_(is|has_been)_teacher to instructor
also, make the implementations of those and user_(is|has_been)_student
consistent, and fix a bad cache key.

test-plan:
 - everything but the cache key is just a refactor
 - create and then delete a student enrollment in a course so that
   user_is_student? and user_has_been_student? should be different
 - enable caching
 - call user_is_student?; should be false
 - call user_has_been_student?; should be true

Change-Id: Ia9458605273741ef3971d8701fe3cff56453f9b4
Reviewed-on: https://gerrit.instructure.com/14580
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-10-23 09:06:16 -06:00
Jacob Fugal 7aaf63db52 VDD: Assignment#overrides_visible_to(user)
scopes the assignment's overrides to just those that the user can see.
intended for use with admin users (e.g. teachers or tas) not students,
since a student technically can see other students and thus this scope
will let them see the other students' adhoc overrides, which is not
desired. but this should never need to be called in the context of a
student.

test-plan:
 - architectural, run specs

Change-Id: I4e1515c263870a13f073af1b39cb19d223b41ab9
Reviewed-on: https://gerrit.instructure.com/14486
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-22 09:32:58 -06:00
Joel Hough d4e63a270b spec: fix sub-second precision bug in assignment_spec
Change-Id: I1c49cc205bae79c62e8fe9067fc704f7f33fd373
Reviewed-on: https://gerrit.instructure.com/14535
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-18 15:15:16 -06:00
Brian Palmer a4317b20db store and query hashed access tokens
refs #8943

This is phase 1. Once this is rolled out and the migrations have
finished, we can implement phase 2, which is dropping the token field so
that plaintext tokens are no longer stored in the database.

There should no longer be any code that reads the token attribute, it's
kept in the database purely to help with the transition.

test plan: before the postdeploy migration runs, access tokens should
still work. after it runs, access tokens should still work.
newly-created access tokens should work as expected. expired access
tokens should still error. For now, the plain-text token field should
still be populated for new tokens.

Change-Id: Icb1b4fdc8e2627ba6540d96d23eb28d874020acb
Reviewed-on: https://gerrit.instructure.com/14491
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-18 13:03:53 -06:00
Jacob Fugal 9441925122 VDD: efficient application of assignment overrides
refs #10831

test-plan:
 - create a course, student, and assignment
 - create an assignment override that applies to the student
 - the return value of assignment.overridden_for(student) should act
   just like assignment, but with the overridden values in place
 - the overridden assignment should not be able to be saved
 - create multiple assignment overrides that apply to the student
   (adhoc, group, sections, etc.)
 - the overrides should be applied in the correct order
 - overrides that don't affect a field should let lower priority
   overrides affect it
 - create an override and then delete it (without changing the
   assignment version in between)
 - the override should not apply
 - create an override, then bump the assignment version, then delete the
   override
 - the override should apply to the old version of the assignment but
   not the new one
 - bump the assignment version, then create an override
 - the override should apply to the new version of the assignment but
   not the old one

Change-Id: Ib632903640cb8aeae5bbc8959c244f6923690f29
Reviewed-on: https://gerrit.instructure.com/14135
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-10-17 12:47:50 -06:00
Jacob Fugal 6fc0e64581 VDD: assignment override data structures
refs #10831

test-plan:
  - run specs. this is all infrastructure, no real separate test plan.

Change-Id: Ic67f574b7e4cbffd114f6ed34d306a393a6bd93c
Reviewed-on: https://gerrit.instructure.com/14117
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-10-17 12:47:37 -06:00
Cody Cutrer 1f923fdf03 be tolerant of slightly different format of PG error messages
test plan:
 * run active_record_base_spec.rb on different postgres installs

Change-Id: I294353a729d19ebfb522446d5fd1c5a121b8a911
Reviewed-on: https://gerrit.instructure.com/14477
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-17 10:38:20 -06:00
Jon Willesen a9d1a9ea60 move infer_defaults to before_validation so validation passes
this will allow an existing invalid assessment question name to
be updated instead of continually failing validation

fixes #11230

test plan:
 - create a question bank with a question that has a name longer than 255 characters (see #11230)
 - edit the question and modify its name so it is shorter than 255 characters
 - save the question; it should save successfully now

Change-Id: I9342d5aeb0541947196e132481d77c83b0ba750c
Reviewed-on: https://gerrit.instructure.com/14419
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-10-17 09:58:10 -06:00
Jon Jensen 52f04579ba fix bulk private message attachment regression, fixes #11277
ensure that the attachment associations get created for each bulk private
message. previously we would explicitly create each message, and thus tell
it which attachments it should have. now we create a single message (the
root one) and do the other ones in a delayed job. since we were just
cloning the root message, the associations were not being copied

fortunately, we have all the data, so we can restore any associations that
should have gotten created

test plan:
1. send a bulk private message to a bunch of people, specifying one or
   more attachments
2. ensure that the attachment appears in each created/updated conversation
   (for both sender and recipient)

Change-Id: I1a72b3ef0a047a413b84e780811b84b298c6ec57
Reviewed-on: https://gerrit.instructure.com/14474
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-10-17 09:35:35 -06:00