Commit Graph

699 Commits

Author SHA1 Message Date
Brad Horrocks f79db65e82 Copy of Announcement to Sender, notify announcement replies
Creates a new notification preference for announcements created by
you. Now you can see what you've sent, and how it looks in specific
communication channels. This new notification preference will also
send notifications when someone responds to the announcement.

Fixes CNVS-13745
Fixes CNVS-2135

Test Plan:

- Set "Announcement Created By You" preference
- Create an Announcement
- Check /users/[:user_id]/messages for "Announcement Created By You"
- As another user comment on the announcement
- Check /users/[:user_id]/messages for "Announcement Reply"

Change-Id: Ibb16f0dc3ba34d98f749c40d1df1eb12430aecca
Reviewed-on: https://gerrit.instructure.com/40636
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2014-09-11 02:04:34 +00:00
Michael Nomitch cae40b6418 DA - get only unique entries from sql view
fixes CNVS-15063

test plan:
  - in course with DA
  - as a student submit multiple times to a selrel'd assignment
  - go to grade summary page and ensure there aren't dupes
  - in a course without DA, everything still works

Change-Id: I7bd24b71bc8661f9747200579e7c11ade4fac1bf
Reviewed-on: https://gerrit.instructure.com/39894
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-09-10 20:49:44 +00:00
Rob Orton 487ef9e8fc add gist index to pseudonyms to improve user search
refs CNVS-15212

test plan
 - rake db:migrate should succeed
 - user search should work and be faster

Change-Id: I8af5a1928e315a8ec68ea7b2b580a28d961c4147
Reviewed-on: https://gerrit.instructure.com/40690
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-09-09 21:14:04 +00:00
Nathan Mills 63945c4d35 add tool setting service
fixes PLAT-608 PLAT-613 PLAT-615 PLAT-616 PLAT-620

test-plan
*spec should pass

Change-Id: Idf2a7d89973231a070a8d368bd60554e3501cdf6
Reviewed-on: https://gerrit.instructure.com/40227
Reviewed-by: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
QA-Review: Nathan Mills <nathanm@instructure.com>
2014-09-08 16:58:00 +00:00
Ethan Vizitei 537d9ff033 Make substring searches for courses more performant
fixes #CNVS-12711

Using three seperate trigram searches
when looking for courses by a name match
is taking more time than we'd like.
This builds an index for all 3 relevant
columns together and reworks the scope
that references them to build a search
clause that takes advantage of that index.

TEST PLAN:
 - no behavior changes, just performance improvements
 - regression test /users/x/manageable_courses api
     endpoint with a name parameter as that's what
     makes the primary use of this query.

Change-Id: Ia645da66f0df1a4cec9298f7fa941fa51de815f4
Reviewed-on: https://gerrit.instructure.com/40507
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2014-09-05 21:21:00 +00:00
Cody Cutrer d589c9e7ec fix migrations that don't send later, even if prod
(i.e. new shards)

Change-Id: I2c66bcdc087229eb827cb4b91a2734723fdefbe9
Reviewed-on: https://gerrit.instructure.com/40578
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-09-04 22:10:27 +00:00
Ryan Shaw 5ab6d5beb5 Make sure no one has the new styles feature enabled
Since the work we are doing here is still very much
WIP, this makes sure no one has the new styles feature
flag turned on

this is a different approach than previous patchsets
since, because of caching or whatever, it was not
working correctly on test portals.

this just renames the feature so if anything was cached
for the previous feature, it won't matter.

and finally, just to clean up, we clear out the db
of any people that had set the old, now meaningless,
feature flag of 'new_styles'

fixes: CNVS-13571 CNVS-14903

test plan:
a) enable the feature flag before checking out the
   patch set
b) check out the patch set and run migrations
c) verify that the feature is no longer set and
   is hidden from non-site-admins

Change-Id: I6230064fe965c80128b047786c393043292114d5
Reviewed-on: https://gerrit.instructure.com/36225
Reviewed-by: Colleen Palmer <colleen@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-08-25 16:01:34 +00:00
Brad Horrocks 279fa22ddb Fixes Profile avatar on thumbnail no longer showing correct image
Thumbnails will now have namespace column which will be populated with
its attachments namespace on save. Old thumbnails will have null
namespace and should behave as they used to. New thumbnails will work
like boss.

Fixes CNV-12380

Test Plan
=========

Prerequisites
-------------

- S3 storage
- **Sharding**
	- multiple users with the same ID on different shards
	- profile photos on all the users with the same fileID

Details
-------

Before the fix the last uploaded avatar will be the *thumbnail* for
all user avatars that collide with each other.
After the code is updated all avatars will be blank.
After `bundle exec rake db:migrate` avatars should display correctly.

Change-Id: Iec533086308da352f317cda60b404327b14516e3
Reviewed-on: https://gerrit.instructure.com/39108
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2014-08-22 22:17:51 +00:00
Nathan Mills 0a7d44b815 create tool_setting and tool_link models
fixes PLAT-600

test-plan:
specs pass

Change-Id: Ic7168bb5cca194b16b3c7f92ea51584ba9e747e7
Reviewed-on: https://gerrit.instructure.com/39714
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
QA-Review: Nathan Mills <nathanm@instructure.com>
2014-08-21 18:35:07 +00:00
Cody Cutrer b1dca446f1 fix duplicate notification policies
* use a join, not an include, when looking for channels by frequency
 * make the index more specific and unique

Change-Id: Ie8b83144e5155241ff22e40519584ffe5314541b
Reviewed-on: https://gerrit.instructure.com/39442
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>
2014-08-19 16:59:42 +00:00
Cody Cutrer 6706a69c81 drop notification_policies.broadcast
it's never used

NotificationPolicy#preference also becomes obsolete, because NOT NULL
and FK ensure that #communication_channel can never be nil; it's
also never used

Change-Id: I0669d3b89964ee6f6d4c6a62e348e276bb7ef315
Reviewed-on: https://gerrit.instructure.com/39446
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-08-18 19:27:05 +00:00
James Williams d25d9e23bc fix importing module items with missing content
fixes an issue that arose with rails 3, where
module items that were not set with content (and thus
shouldn't have been saved) were being autosaved and
breaking the entire modules page

test plan:
* import the package(s) referenced in the ticket
* the modules page should still be functional

fixes #CNVS-14777

Change-Id: I82fe287a4db9492489461e971911a0f7c15fbcb0
Reviewed-on: https://gerrit.instructure.com/39404
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-08-18 18:12:35 +00:00
Nick Cloward fbc53265e4 add redirect config to account authorization
fixes: CNVS-9194

This adds a configuration to CAS and SAML which will redirect to when an
unknown user is authorized from CAS or SAML but we do not have a
pseudonym for them in canvas yet.  Instead of logging them out of CAS or
SAML it will redirect them to a custom url.  By default if no url is
configured it will redirect to the login page or cas login page.

Test Plan:

CAS:
  - Setup a User on the CAS server that can login.
  - Make sure the user is not in Canvas and wont be matched up to any
    other Canvas pseudonyms.
  - Log in to CAS and Canvas.
  - Canvas should redirect to cas_login_url.
  - Configure the Canvas CAS setting unknown user url to redirect to
    a custom url.
  - Log in to CAS and Canvas
  - Canvas should redirect to the custom url specified.
  - The user should not be logged out of CAS.

SAML:
  - Setup a User on the SAML server that can login.
  - Make sure the user is not in Canvas and wont be matched up to any
    other Canvas pseudonyms.
  - Log in to SAML and Canvas.
  - Canvas should redirect to login_url and provide a flash message
    stating that the user could not be found.
  - Configure the Canvas SAML settings Unknown User Url to redirect
    to a custom url.
  - Log in to SAML and Canvas
  - Canvas should redirect to the custom url specified.
  - The user should not be logged out of SAML.

Change-Id: I29a78f8ec60c94caecf63547584d8ae804ffc9de
Reviewed-on: https://gerrit.instructure.com/38472
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-08-14 15:12:41 +00:00
Cody Cutrer d33066ea27 more indexes supporting foreign keys
Change-Id: I43026dd7b489dcc87f6629f47a2a52e7b44f6c96
Reviewed-on: https://gerrit.instructure.com/39035
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-08-13 14:49:03 +00:00
Cody Cutrer 4f4ffd1ea9 only clear cache for default shard
so that we don't accidentally clear it for each new shard

Change-Id: I93f760e72646ae0231a8d6659ea3b5370ecbac10
Reviewed-on: https://gerrit.instructure.com/38913
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-08-12 18:13:25 +00:00
James Williams 75d21f8f84 migrate has_X context_external_tool columns to separate table
currently every extension type has its own boolean db column
while this isn't strictly a problem, it is a little sad, and
given the fact that we will be adding more extension types soon,
it's probably better to take care of this now

also i'm refactoring some of the methods in context_external_tool

test plan:
* external tool regressions

refs #CNVS-13815

Change-Id: I6caf7b0e3d0de054906e3530f085fbfa9e8e499f
Reviewed-on: https://gerrit.instructure.com/38923
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-08-12 12:13:42 +00:00
Brad Humphrey 817f5429b4 change tool proxy root_account to context
also, clean up ims-lti usage with pluralized lti methods

test plan:
  - registrations should still work
  - registrations without resource handlers
    and using a default message handler should still work

fixes PLAT-566 PLAT-567

Change-Id: Icd9feca44ba9f5600d89a4943b0b93b34aeb78a5
Reviewed-on: https://gerrit.instructure.com/38182
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: Brad Humphrey <brad@instructure.com>
2014-08-07 19:57:40 -06:00
James Williams 81558f728c remove rails 2 support
closes #CNVS-14261

Change-Id: I1b0e8a4438ab659ecd1ac8462bc3559d810989b3
Reviewed-on: https://gerrit.instructure.com/38744
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>
2014-08-06 18:16:19 +00:00
Nick Cloward 8a06da0ca1 store last batch for data fixup
refs: CNVS-13987

Added a way to store the last batch that was ran.  Seperated out
the batch processor and the actual cleaner methods.  This will
allow us to add it to event stream to fix records as they are
queried if we choose.  This also moved the temporary mapping and last
batch tables to the migration.  g/38429 removes the tables.

Test Plan:
  - Same as g/37956 and g/37605
  - Migration should not fail if mapping table already exists.
  - With a grade change try deleting the submission then running the
    fixup.

Change-Id: Ibce843c22b72885f7e2510d85b482c39f513996b
Reviewed-on: https://gerrit.instructure.com/38407
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-07-30 21:59:41 +00:00
Jayce Higgins f3f8b0c428 Adds peer review notification for assigning peer reviewers
Fixes: CNVS-3771

Adds a peer review notification to go out after
a peer reviewer is added to the discussion. This
also resolves the issue with a notification not
being sent if a rubric is not attached.

Test-Plan:
1.) Run bundle exec rake db:migrate in the console
	before doing anything else -- (This sets up your
	db by using notification_types.yml to populate
	notification types in the DB.)
2.) Create a graded discussion with at least 2
     students
3.) Make sure both students have everything
     in their notifications set to ASAP.
4.) Edit the assignment settings and select the
     'Require Peer Reviews' - Choose to manually
     select peer reviewers.
5.) Navigate to discussions as an admin
6.) Select the cog and go to peer reviews.
7.) Assign a peer reviewer and verify that the
     notification was sent out.

Change-Id: I78212cb8043de0fcf809a9ffa56ffca327ffcacc
Reviewed-on: https://gerrit.instructure.com/36646
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2014-07-25 19:56:57 +00:00
Nick Cloward dec7a2231e data fixup needs to support Cassandra 1.1
refs: CNVS-13987

Test Plan:

  Same as g/37605 but under Cassandra 1.1
  Lower the batch size and make sure it has the same results.

Change-Id: Id35b7a2690fd33e1769d27836deb374630f27fd3
Reviewed-on: https://gerrit.instructure.com/37956
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-07-24 18:01:25 +00:00
Cameron Sutter 79f45f569d DA - quiz edit page
fixes CNVS-9766

test plan:
 * turn on the Differentiated Assignments feature flag
 * from the quiz edit page
  - add a due date for some of the sections, but not all
  - save (update quiz)
  > the only_visible_to_overrides flag on the quiz should be true
  > edit the quiz again and there should not be an
    empty due date row for 'Everyone else'
  - add a due date for all the sections
  - update the quiz
  > the only_visible_to_overrides flag should not be there
  - edit the quiz so that there are only due dates
    for some sections but not all
 * on the normal quiz show page and
 * on the new Quiz Statistics show page
  > there should not be a row in the due date area
    for 'Everyone else'
 - turn off the DA flag and make sure the quiz show page works
   with the 'New Quiz Stats page' flag and without it
 - make sure the edit page works with the DA flag off as well

Change-Id: Ifb090a195ff3283d963df12ae7a9eb503f32ee86
Reviewed-on: https://gerrit.instructure.com/34085
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2014-07-23 14:41:24 +00:00
Nick Cloward 2bc1395790 audit log uuid data fixup
refs: CNVS-13987

Creates new records for audit log data that has been overritten.  Since
we cannot all of the actual event data they are created as a corrupted
record

Test Plan:
  - Clear Audit logs (Not manditory but easier to see data)
  - Generate Bad Audit data for each test case.
    * Supplied script should generate the bad data.
    * Refer to test case to ensure data is created correctly.
  - Pull Commit and run migrations.
  - Check Case 1
    * The original id record should still exist with a record in
      courses_by_course.
    * Before the fix only one course change record will exst.  After the
      after the fix a second tombstone record with a record type of
      corrupted should exist with related index records in
      courses_by_course.
    * Key column in each index should match the id/bucket format.
    * ordered_id in each should match timestamp/first eight of id.
 - Check Case 2
    * After the fix pick a tombstone record and ensure that it as an
      index record in each of the index tables: authentications_by_pseudonym,
      authentications_by_user, authentications_by_account.
    * Ensure cross bucket event indexes create a tombstone and match in
      other indexes as well.  Id should be unique in the index tables
      and stream table.

- Code to generate test cases:

target_course = Course.find(...)
target_user = User.find(...)
target_pseudonym = target_user.pseudonyms.first

event = Auditors::Course.record_created(target_course, target_user,
source: :manual)
record = Auditors::Course::Record.generate(target_course, target_user,
event.event_type, event.event_data, source: :manual)
record.attributes['id'] = event.id
record.attributes['created_at'] = Time.now + 1.day
Auditors::Course::Stream.insert(record)

event = Auditors::Authentication.record(target_pseudonym, 'login')
record = Auditors::Authentication::Record.generate(target_pseudonym,
event.event_type)
record.attributes['id'] = event.id
record.attributes['created_at'] = Time.now + 100.days
Auditors::Authentication::Stream.insert(record)

Change-Id: I888da1758282d0e3f2d19a4438c1a866a6f54125
Reviewed-on: https://gerrit.instructure.com/37605
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-07-18 21:44:46 +00:00
Nathan Mills a91d9c09d0 add lti2 models and registration endpoints
fixes PLAT-522 PLAT-429 PLAT-545 PLAT-540 PLAT-498

test-plan
you can register an lti2 tool

Change-Id: If045b694213e1019f8a595b63a7e33ea4ac28e64
Reviewed-on: https://gerrit.instructure.com/37095
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
2014-07-18 16:42:10 +00:00
Cody Cutrer 45bf5773f3 fix migrations for mysql
fixes CNVS-13306
fixes gh-453

MySQL refuses to change columns that have a foreign key on them

Test plan
- Run the polling migrations on MySQL
- They should migrate the database correctly.

Change-Id: Ib781c5237c0973b254043096e536ac094dd809cf
Reviewed-on: https://gerrit.instructure.com/35511
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>
2014-07-17 20:38:10 +00:00
Michael Nomitch a60802d00e DA - sql view and shared methods
fixes CNVS-13649

test plan:
  - go to a few pages and make sure no errors occur
    - GB2
    - assignment index
    - student grades page
  - do same with and without DA on

Change-Id: I72f303cf54c36420a57dfbd23635f319f9827bd0
Reviewed-on: https://gerrit.instructure.com/36675
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
2014-07-15 18:03:57 +00:00
Ahmad Amireh ab0c410b49 Quizzes - Lock down results after first view
Adds an option to Quiz that prevents the students from seeing their
results more than once after their submission.

Closes CNVS-13877

CHANGES
-------

  - New option in quiz settings:
    "Let Student See Their Responses" => "Only Once After Each Attempt"
  - Teacher can always see the student's results
  - Moderate dialog allows teacher to manually reset the result-locking
    flag, allowing the student one more glimpse
  - The flag is reset whenever a new attempt is taken

TEST PLAN
---- ----

  - create a quiz
  - toggle the new option: "Let Student See Their Responses" then "Only
    Once After Each Attempt"

Turn off Ember/quiz stats:

  - take the quiz by a student, turn it in:
    - verify that you see your results
    - reload the page
      - verify that you no longer see the results
  - take the quiz again:
    - verify you see the results once, then not
  - go to the moderate page as the teacher
    - open the moderate dialog for that student
      - check the new option "Let the student see the results one more
        time"
      - click Save
        - reload the page as the student, verify that you see the
          results

Turn on Ember/quiz stats:

  - repeat the process

Other things to test:

  - verify the new field "has_seen_results" is visible in the
    submissions API and is documented
  - verify the new field "one_time_results" is visible in the quizzes
    API and is documented properly
  - verify that the new option has no effect if the Quiz option is not
    set
  - verify that you can always see the student's results as a teacher
    (the setting should not affect teachers)

Change-Id: I6eb4909f777e038acf6afc9ef2823352f5ea78be
Reviewed-on: https://gerrit.instructure.com/37544
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-07-15 09:47:56 +00:00
Cody Cutrer 9b1e8c7350 more fk indexes
also fix an old migration that should have ran on all shards

Change-Id: Ib4305c4f1b84ba0cfd525d0f552cfc21d365dc24
Reviewed-on: https://gerrit.instructure.com/37492
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-07-14 21:06:23 +00:00
Jacob Fugal d9c6e2a0cd clarify Slug vs. UUID and fix event stream
refs CNVS-13987

what was called CanvasUuid was *not* generating UUIDs. it was generating
slugs. by default, its generate method only creates 4 character slugs.
these should obviously not be used as UUIDs. the misnomer already caused
a bug in EventStream where it used these slugs as UUIDs, causing
collisions. to fix:

 (1) rename canvas_uuid gem to canvas_slug, and rename it's primary
     class CanvasUuid to CanvasSlug
 (2) create new canvas_uuid gem, with class CanvasUUID, extracted from
     lib/uuid_singleton for actual UUID generation
 (3) fix event stream use CanvasUUID, rather than following the rename
     of CanvasUuid to CanvasSlug

test-plan:
 - have cassandra set up for audit logs
 - create an audit log entry (e.g. change a grade)
 - look at the generated audit log entry's id field; it should be a UUID
   value, not a 4 character slug

Change-Id: I19758fff4433cd6cb2e21219217dced19ee05c5a
Reviewed-on: https://gerrit.instructure.com/37506
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-07-11 16:58:42 +00:00
Jeremy Stanley 3fa2e9c3db give content_exports polymorphic context
test plan:
* content export regressions

closes #CNVS-13468

Change-Id: I44dcf077967d4273c0ae9056074b03853d66a5dc
Reviewed-on: https://gerrit.instructure.com/35745
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-07-09 16:34:39 +00:00
Cameron Matheson ed5b8ae452 get rid of weird before_quiz_submission_types attr
Test plan: specs pass

Change-Id: Ibfcaf313345277daa2a1f2f50741b7e3131fc9ec
Reviewed-on: https://gerrit.instructure.com/37365
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
QA-Review: Cameron Matheson <cameron@instructure.com>
2014-07-08 17:58:06 +00:00
James Williams 17d5bd42a6 fix db:migrate in non-production environment
Change-Id: Ibb4465348162219b4f1da6f1a842234a7cecd78e
Reviewed-on: https://gerrit.instructure.com/37316
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-07-07 14:46:45 +00:00
Rob Orton fe8e121ee3 move deleted enrollments when cross listing sections
fixes CNVS-13828

test plan
 - prior to checking out patch set
 - enroll a user in a section
 - delete the enrollment
 - cross list the section
 - attempt to add user to sections new course
 - it should fail
 - checkout patch set and run migration
 - attempt to add user to sections new course
 - it should succeed

 - enroll a user in a section
 - delete the enrollment
 - cross list the section
 - attempt to add user to sections new course
 - it should work (it will restore the old enrollment)

 - enroll a user in a cross listed section
 - delete the enrollment
 - uncross list the section
 - attempt to add the user to the sections current course
 - it should work (it will restore the old enrollment)

Change-Id: Ib397f96b0761d87bf6f9fb11ffc978012f0f5b39
Reviewed-on: https://gerrit.instructure.com/37036
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-07-02 18:45:04 +00:00
Michael Ziwisky d3d356f89a fix some migration rollbacks
Change-Id: Icd0faea42d6eae75604f9fc0f51df77072fc37a2
Reviewed-on: https://gerrit.instructure.com/36814
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
2014-06-25 01:04:48 +00:00
Jon Willesen 9b960aae30 add integration type to context external tools
Fixes RD-78

Test Plan:
 - specs pass

Change-Id: I4a53cdd71784ce9e2988cbfe9b6df7e7347a9d25
Reviewed-on: https://gerrit.instructure.com/34501
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
QA-Review: Jon Willesen <jonw@instructure.com>
2014-06-24 16:07:59 +00:00
Jon Willesen f19389f8a9 Add course settings sub navigation lti extension
fixes RD-76

test plan:
 - as a teacher, navigate to a course settings page. the right
   sidebar should look normal.
 - modify an lti app's xml to include the
   course_settings_sub_navigation extension
 - configure an lti app via modified xml.
 - navigate to a course settings page, where you should see a
   button for the configured tool at the top of the right
   sidebar.
 - clicking on the button should launch the tool.

Change-Id: Iec9e3337437295865bab66a499fe8fc096ad0ba5
Reviewed-on: https://gerrit.instructure.com/36471
Reviewed-by: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2014-06-24 13:39:17 +00:00
Jeremy Stanley 3279012b9f fix incorrect published states for quizzes and assignments
test plan:
 0. BEFORE APPLYING THIS CHANGESET, reproduce the original bug:
   a) Have a course with draft state enabled
   b) Create a new module in the course, and do not publish it yet
   c) Add a new assignment to the course via the modules page
   d) Publish the module. This should publish the assignment.
      (refresh the modules page if you don't see that happen.)
   e) As a student, look for the assignment in the Assignments
      index page and the Syllabus page. You don't see it there.
      Because the modules page didn't publish it correctly.
 1. Apply the changeset and run migrations.
 2. (If production) wait for the datafix job to complete.
    It should complete almost immediately unless your job
    server is backed up. Look for the following in your log:
    DataFixup::FixIncorrectPublishedStatesOnQuizzesAndAssignments
 3. The assignment created in 0e should now be visible to
    students in the Assignments page and the Syllabus page.
 4. Repeat steps 0a-0e. This time, the published assignment
    should be visible to students in the assignments index
    and syllabus page right away.

fixes CNVS-13604

Change-Id: I657c90deb115a6d047abb81cbdabe014fd74778f
Reviewed-on: https://gerrit.instructure.com/36511
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-06-20 17:28:39 +00:00
Jon Willesen 56aee2cfc1 add concurrently to recent add_index migration
Change-Id: If3cd851f83315a7bc7484fbd9948aebcd356eb2a
Reviewed-on: https://gerrit.instructure.com/36518
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 17:02:24 +00:00
Brian Palmer 1b6bb95425 don't try to drop cassandra column in 1.2.x
test plan: run migrations in cassandra 1.2.x, and you shouldn't get an
error. migrations in 1.1 and 2.0 should still drop the
page_views.contributed column.

Change-Id: I18d0fc52c8a9f6e86e3f4907a0bf2e9a7aaee283
Reviewed-on: https://gerrit.instructure.com/36528
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2014-06-17 17:25:43 +00:00
Cody Cutrer 195172f1c9 delete delayed messages before deleting cc in migration
also do notification policies in bulk for sanity

Change-Id: If32f06c073f8eb86d424b1287b3423ba212e2b43
Reviewed-on: https://gerrit.instructure.com/36472
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>
2014-06-16 18:51:49 +00:00
Ethan Vizitei a0c96d6a41 Add reporting name for learning outcomes
fixes CNVS-13242

This adds a special field to learning outcomes
to use for friendly reporting in case the outcome's
actual name is quite complex or cryptic (like common core
standard outcomes).

TEST PLAN:
- login as an instructor
- create or edit an outcome and validate that you can add a "friendly"
  name and that it persists
- use that outcome for an assignment and let a student complete it
- navigate to the student mastery report for that student
- verify that by hovering over that outcome name on the student mastery
report you can see both the real title and the friendly name

Change-Id: I89d1a5de590666ddf6cbc82617e4475d1f7a5226
Reviewed-on: https://gerrit.instructure.com/35919
Reviewed-by: Drew Bowman <dbowman@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-06-11 17:25:33 +00:00
Josh Simpson 53920a96ce add explicit poll choice ordering and poll_session deletion
fixes CNVS-13521,CNVS-13489
This commit adds 3 things.  One is a fix for deleting a poll_session when
there are poll_submissions created already for the poll_session. The
second is the addition of a new attribute on poll_choices called
'position'.
The 'position' attribute specifies the order a poll choice should be
returned in. The third is the visibility of poll sessions to students:
as long as a student is enrolled in the course (and course section, if
it exists on the poll session) associated with the poll session, they
can access it, whether or not it's open or closed.

Test plans
1. Deleting a poll session
As a teacher
- Create a poll and related poll session
- Open the poll session for submissions
As a student
- Create a submission for the newly created poll session
As a teacher
- You should be able to delete the poll session

2. Position ordering attribute
As a teacher
- Create a poll
- Create poll choices, passing along the 'position' attribute to specify
  ordering (try to mix these up, e.g. create a poll choice with a
  position
  of 2, then a poll choice with an position of 4, then a poll choice with
  an position of 3, then a poll choice with an position of 1)
- Retrieve the poll choices for the poll with the poll choices index
  endpoint
- The poll should be returned in the order they were specified using the
  'position' attribute

3. Poll session visibility to students
As a teacher
- Create a poll
- Create an associated poll session with a valid course
As a student enrolled in the given course
- You should be able to view the poll session whether or not it's open
  or closed.
As a student not enrolled in the given course
- You should not be able to view the poll session, whether or not it's
  open or closed.

Change-Id: Ifabd64540d843c83f3a22fb6668c4fcac8f728b0
Reviewed-on: https://gerrit.instructure.com/36087
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-06-11 00:48:16 +00:00
Josh Simpson 608b0896e2 improve polling performance
fixes CNVS-13440
this commit addresses bad polling performance, particularly in
poll_sessions. It also removes a foreign key constraint on the
poll_sessions poll_id, that would introduce sharding issues.

Test plan
- Test the following attributes on particular models to insure that
  they're still correct:
  - Poll#total_results should accurately return the aggregate results for all of
    the poll_sessions that belong to the poll
  - PollSession#results should accurately return the results of all poll
    submissions submitted for the particular poll session

Change-Id: Ic0d4aaeb77c735fa4ba6c5f73dfbf84d8e6ac615
Reviewed-on: https://gerrit.instructure.com/35860
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-06-10 19:53:31 +00:00
Brian Palmer c2dbb83883 protect against previously-run switchman migration
Change-Id: I8ef069aa61132d1d5772b3814f478d041dfd08a8
Reviewed-on: https://gerrit.instructure.com/36002
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeff Belser <jbelser@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2014-06-10 16:38:56 +00:00
Joel Hough 4ec0d04bb9 live assessments api
fixes CNVS-12916

test plan
- as a teacher in a course, use the api to create a live
 assessment aligned with an outcome (see the api docs for how the
 endpoint works)
- create results for some students
- ensure that the results and the assessment can be read back using
 the index endpoints
- ensure that the assessment shows up in the web ui at
 /course/:course_id/outcomes/users/:student_id (click 'Show All
 Artifacts')

- try to create an assessment using the same key as an existing
 assessment
- ensure that the existing assessment is returned (check the id)

- fetch results specifying a user id to filter by
- ensure that only results for that user are returned

Change-Id: I2d09691f772658aea3ccdd36cff2df5835b1f2cd
Reviewed-on: https://gerrit.instructure.com/35092
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Derrick Hathaway <derrick@instructure.com>
2014-06-10 14:53:40 +00:00
Jon Willesen 3c65211658 add course_home_sub_navigation extension to external tools
this puts lti app links on the right side bar of the course
home page.

fixes RAN-53, RAN-55

test plan:
 - modify an lti app's xml to include the
   course_home_sub_navigation extension
 - configure an lti app via modified xml
 - navigate to a course home page, where you should see a button
   for the configured tool on the right sidebar.
 - clicking on the button should launch the tool.
 - configure another tool the same way, but include a
   "visibility" property in new extension with a value of
   "admins"
 - view the course home page as a teacher. you should be able
   to tee the newly configured tool, in addition to the
   previously configured tool.
 - view the course home page as a student. you should only see
   the first tool you configured, and not see the tool with the
   limited visibility property.

Change-Id: Ibe50c649f6d5f6806a87f0c8e8402f1209b9ed40
Reviewed-on: https://gerrit.instructure.com/35161
Reviewed-by: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2014-06-09 23:30:43 +00:00
Brian Palmer ce945a721b migration lint for instance vs class migration methods
self.up works in rails2 and rails3, but up only works in rails3+

also tag the switchman migrations as RAILS3 only, now that they actually
run in rails2

Change-Id: I768c8e657e86de6504a40444d127e2d875ce6934
Reviewed-on: https://gerrit.instructure.com/35390
Tested-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2014-06-05 15:55:55 +00:00
Jeremy Stanley b8310e49f5 track attachments through overwrite+rename/move via replacement_attachment_id
test plan:
 1. upload a file to a folder in a course
 2. link to the file from course content (such as a wiki page
    or assignment body)
 3. overwrite the file with another file of the same name
 4. rename the file
 5. view the course content and ensure the file link still works
 6. repeat steps 1-5, replacing step 4 by "move the file to another folder"

fixes CNVS-12359

Change-Id: I11832c307f286920174ba4731af2e88490497f92
Reviewed-on: https://gerrit.instructure.com/35677
Reviewed-by: James Williams  <jamesw@instructure.com>
Reviewed-by: Mark Severson <markse@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-06-02 17:11:51 +00:00
Ethan Vizitei 39a35ab09e Use source user as "FROM" for emails
This gives certain user-triggered events
a "look" as though they came directly from
that user (the FROM and REPLY-TO headers
have the name of the source user).

This also introduces "letter_opener" into the
dev environment.  If you use "letter_opener"
as your send method for dev emails, it will
open all emails in a browser tab. Very useful.

closes: CNVS-11837

TEST PLAN:

Validate each of the following notifications
looks like it's "from" the source user:

- Submitting an assignment
- Resubmitting an assignment
- Posting to a discussion
- sending a conversation message
- posting a comment on a submission

Change-Id: I0e04aa9aa5bf31a590e69507e04b86b637247acf
Conflicts:
	app/models/message.rb
Reviewed-on: https://gerrit.instructure.com/35362
Reviewed-by: Drew Bowman <dbowman@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-05-31 01:02:14 +00:00
Brandon Broschinsky de263055ce save context_id on lti launch
fixes: PS-1538

**test plan
configure and launch lti tool, upon lti tool launch the
lti_context_id for user should be set, and if course launch
the lti_context_id on course object, if account launch, then
lti_context_id on account.  Once these are set, api calls to the
corresponding object can be made using the syntax lti_context_id:id

Change-Id: Icdf02e4f99691be417c024adb2a2751ba2aa9335
Reviewed-on: https://gerrit.instructure.com/35380
Reviewed-by: Brad Humphrey <brad@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Adam Phillipps <adam@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2014-05-30 22:26:52 +00:00