spec: fix group_with_user helper

Change-Id: I2063ca167f9ed39bdf070495f892d7c82f5247be
Reviewed-on: https://gerrit.instructure.com/11458
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
allow 'self' in delete group membership api

in case you don't have easy access to your group membership id, you can just
pass self to delete your group membership (leave the group).

test plan:
- as a user who is a member of a group (which you can leave)
- with the api, send a delete to /api/v1/groups/x/memberships/self
- make sure you are no longer a member of the group

Change-Id: I2d17a8e0247748f8a04362b66d2b3fcd503f8dd9
Reviewed-on: https://gerrit.instructure.com/11488
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
adds zip support to account reports

spec on report

test plan
 * current reports should continue to work

Change-Id: Ia0959e58c2f3e1fb8415cfe554ba4b41ed79fb8e
Reviewed-on: https://gerrit.instructure.com/11089
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
comma-delimited number js lib

Adds commas for large numbers.

test plan:
- make sure it properly adds commas for large numbers
- make sure it doesn't add commas for small numbers

Change-Id: I286c0ec8884116b39b1c864e047661dca95021e6
Reviewed-on: https://gerrit.instructure.com/11349
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
refactor single thread non selenium commit

use parallel_exclude module more

Change-Id: Ic03fabc1ee9d5de2eb3fb151e9a083c7c29f55e6
Reviewed-on: https://gerrit.instructure.com/11492
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
fix media comments for discussions with tons of videos

if you called $().mediaCommentThumbnail() with an
empty set it would break it so it won't make mediaCommentThumbails
any more for anything else.

Change-Id: I1a8868439563df7655c07d1aedfada37ad4db857
fixes: #8874
Reviewed-on: https://gerrit.instructure.com/11522
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
don't error out trying to get a kaltura thumbnail when the MediaObject doesn't exist

MediaObjects are not guaranteed to be around, so we should only make using it
a best effort for loading a thumbnail.

test plan:
 * on a wiki page in a course, record a video using the kaltura widget
 * in the rails console, look up the MediaObject you just created
   (look in the source of the wiki page you just created, extract the
   0_blahblah thing, then do MediaObject.by_media_id('0_blahblah').first)
 * destroy that MediaObject: mo.destroy
 * verify that you can hit: http://canvas/media_objects/0_blahblah/thumbnail
   and don't get a page error

Change-Id: I67e823d39f8aaefdbf2f0f0dc53f10217691468d
Reviewed-on: https://gerrit.instructure.com/11067
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
avoid the sub-transaction (savepoint) when skipping page view updates

Change-Id: Ie80910dfbcc1a44a3db0adeb527896975c706a8c
Reviewed-on: https://gerrit.instructure.com/11511
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
auto follow/unfollow groups based on membership

when a user joins a group, they should automatically be following the group,
which will cascade to follow collections and allow them to show up in the
stream.  when a user leaves a group, the should automatically stop following
the group.

test plan:
- join a group that has collections with items
- make sure you are following the group collections
- make sure those items end up in your stream

Change-Id: If615a607505452a7688563cc1ebb2d4be999241f
Reviewed-on: https://gerrit.instructure.com/11489
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
pin the guard gem to 1.0.3

The new 1.1.x series throws a ton of warnings

Change-Id: Icae6554dc192241678a08d279c8c9967cd762603
Reviewed-on: https://gerrit.instructure.com/11508
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
sanitize parameters to kaltura thumbnail url generator

Change-Id: I756f9f5b761a3db84edd0b95e964e047d997fe45
Reviewed-on: https://gerrit.instructure.com/11526
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
remove the psql delayed jobs popping function

The performance impact of calling the function in psql 9.x outweighs the
benefits. We may re-introduce this optimization later without the
database function call overhead.

test plan: validate that delayed jobs still work on postgresql, and
don't attempt to call the pop_from_delayed_jobs function.

Change-Id: Ic9d06d87c7481b277feff058b34ee3e06277f316
Reviewed-on: https://gerrit.instructure.com/11147
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
spec: add account admin term specs

Change-Id: I6be833b5034ba6144a87ddce2e79e5e4cab895ed
tested:
  * validate default term
  * edit default term
  * validate error on delete if term contains courses
  * add a new term
  * delete a term
  * false add a term
Reviewed-on: https://gerrit.instructure.com/11505
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
spec: account admin statistics specs

Change-Id: If99131a2ae6bb5c0d60721056269de4cc3ad7b30
tested:
  * validate recently created course display
  * validate recently started course display
  * valite no info in list display
  * validate link works in display list
  * validate recently logged-in courses display
Reviewed-on: https://gerrit.instructure.com/11491
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
sort announcements by posted_at not created_at

fixes #8994

test plan:
  1. as a teacher create an announcement that
     has posting delayed for a couple minutes,
     also create an announcement that does not
     have delayed posting
  2. as a student log in and go to the announcements
     page, refresh the page at or after the time the
     delayed announcement is supposed to be posted at
  3. notice the most recently posted announcement is
     listed first

Change-Id: I3dcdfcc27915bf72398177f11c245143befdd64b
Reviewed-on: https://gerrit.instructure.com/11544
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
fix manually unlocking quizzes; fixes #8830

if a quiz has a lock date in the past, but we manually
override the lock for a user via the "Moderate Quiz" UI,
don't force the quiz to end at the lock date

(it seems a regression from g/10690 broke this feature)

test plan:
 * have a quiz whose lock date is in the past
 * as a teacher, press the Moderate Quiz button and, for a
   student, check "Manually unlock this quiz for the next
   attempt".
 * as that student, try to take the quiz.  Make sure it lets
   you do it, and does not immediately end with a score of 0.

Change-Id: Ic6591e627134ef8a7a1879d84385db4fcb970445
Reviewed-on: https://gerrit.instructure.com/11559
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
make a separate i18n_tools gem group

This way the i18n:generate rake task can be run from production
environments as well

test plan: run rake i18n:generate, it should still output the new yml
file as before.

Change-Id: I17104686e5c7de3bacbfae9d164a9709182e2499
Reviewed-on: https://gerrit.instructure.com/11557
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
patch active_record for CVE-2012-2695

See http://seclists.org/oss-sec/2012/q2/504

test plan: Should be covered by unit tests.

Change-Id: I96b32f6e1056e26c9ca343b317492bcb5504a45a
Reviewed-on: https://gerrit.instructure.com/11568
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>