Commit Graph

127 Commits

Author SHA1 Message Date
Brian Palmer ac94da3bc4 api_user_content handling of inline media comments
fixes #7393

If it wasn't a kaltura media comment (youtube, etc) it would fail trying
to do a nil.gsub

test plan:
  * create an assignment and embed a youtube video in the description
  * submit the assignment, make a comment on the submission
  * go to conversations and view your submisison comment, verify there
    is no error

Change-Id: Ic5e36076d59da45776e8a5f279927bdb3ce2fb16
Reviewed-on: https://gerrit.instructure.com/8975
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-02-24 17:07:25 -07:00
Jon Jensen 80c90587d6 calendar and scheduler apis; refs #3395
Change-Id: I0bafb21630086ff2a99b8b881568bff51afabedc
Reviewed-on: https://gerrit.instructure.com/7823
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-01-06 12:35:27 -07:00
Zach Pendleton ad064500ad force download of attachments in conversations. fixes #6492
params[:download_frd] now accepted to force download of
even inline file types.

affects: files_controller
test plan:
  * attach html file to a conversation message;
  * click the link to the file and ensure that
    it is downloaded by the browser and not opened
    inline.

Change-Id: I57085e33c87512fc4f8b43bb6ceb7ff047ddcd59
Reviewed-on: https://gerrit.instructure.com/7473
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-12-16 09:10:19 -07:00
Zach Pendleton fb8d2a916a change api_per_page to a setting instead of hard-coded value.
affects: api
test plan:
  * run specs

Change-Id: I68044ef19fc778f81bb6d61e8d9c66e1cae7d98e
Reviewed-on: https://gerrit.instructure.com/7430
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-12-12 12:54:33 -07:00
Jacob Fugal 2a0b9d8889 don't break in a proc; fixes #6452
the block provided to UserContent::HtmlRewriter#set_handler is stored as
a proc for later execution. calling break in a proc raises a
LocalJumpError. use next instead.

test-plan:
  - Create a course, and enroll a student in that course.
  - Create an attachment in the course.
  - Lock the attachment (so the student can't view it).
  - Create an assignment in the course and Refer to the attachment in
    the assignment description.
  - As the student, grab the assignment through the API.
  - Should succeed and include the unmodified (and thus inaccessbile)
    attachment URL.

Change-Id: I9e649cb55b31853d62001c799162fa26bb90a712
Reviewed-on: https://gerrit.instructure.com/7164
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-11-28 16:12:12 -07:00
JT Olds 8dc786c883 api_find_all
testplan:
 * hit the API with a few different calls that use SIS ids (such as
   sis_user_id:whatever), and make sure calls still return the correct
   data. no calls currently use api_find_all, so nothing yet to test
   there.

Change-Id: I2804c29a18342254a94709bac93a1ffb9b0467b8
Reviewed-on: https://gerrit.instructure.com/7026
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: John Harrison <john@instructure.com>
2011-11-28 13:48:28 -07:00
Brian Palmer 1e56918179 translate user content in discussion topics api
fixes #6248

testplan: create a discussion topic/reply with user content linking to context
files and media comments. when you grab these through the API, the
content links should be properly translated to links that don't require
a logged-in user to view (and media comments should be translated to
html5 video tags).

Change-Id: I27bc5847a1540c9a77f155afa12b52e720755a4d
Reviewed-on: https://gerrit.instructure.com/6837
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: BJ Homer <bj@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-11-10 12:05:52 -07:00
Brian Palmer f38f8e30b4 scope api sis finds to the domain root account, fixes #6246
Finds by SIS ID in the API were all doing global searches, but SIS IDs
are only unique when scoped to a root account. This was causing the
wrong record to sometimes be found when the same sis id is used on
another root account, causing "status: unauthorized" errors.

testplan: create a second root account, and various SIS items in that
account like sub-accounts, courses, sections, users, etc. Doing API
calls against the default account domain should not find any of those
objects, and objects with the same SIS IDs in the default account should
always be found.

Change-Id: I33334426e5ffc4a9f1929234169b4eb8fa400cdb
Reviewed-on: https://gerrit.instructure.com/6821
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-11-09 12:37:32 -07:00
Brian Palmer e0eafa83eb use hard-coded table names for VALID_SIS_COLUMNS
This shaves about 0.8 seconds off canvas startup time in dev mode on my
MBP. Not a lot, but it's something.

Change-Id: I1e835e5a97a122b2f4a5c5dcd9d86d6a4c0369b0
Reviewed-on: https://gerrit.instructure.com/6472
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-26 09:25:19 -06:00
Cody Cutrer d2a5328993 drop Pseudonym#sis_source_id closes #5897
Change-Id: I81f2df5324ae7f9747f5d72ac1f8686932c815ff
Reviewed-on: https://gerrit.instructure.com/6093
Reviewed-by: JT Olds <jt@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-12 12:18:37 -06:00
Brian Palmer 9f0aa5f6e6 rewrite user content in the api for file links and media comments
file links get translated to direct file download links, and media
comments into embedded html video tags.

use this to add assignment description to the assignment json response.

closes #5739, closes #4742

Change-Id: Iccfc517014ed2777686c355a382ded290ae4d8b8
Reviewed-on: https://gerrit.instructure.com/6030
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-10-10 15:05:28 -06:00
Jon Jensen 4e884adfdf return attachment and media comment urls, closes #5850
Change-Id: I971a02d2055778120a0a5df0129f2b145da98843
Reviewed-on: https://gerrit.instructure.com/6045
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-10 12:26:00 -06:00
Brian Palmer d51b5d9a73 don't require a session to download attachments through the api
fixes #5737

There is one situation where a session is still desireable -- if the
attachment data includes links, for instance a html file attachment,
then a session will be needed to view the links from that file. The
limited safefiles session will still be created when downloading the
file, so apps can optionally use the session to support that
functionality.

Change-Id: I48558c4a3217ebea92118f8f08d1254041bd65e5
Reviewed-on: https://gerrit.instructure.com/5860
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-07 17:04:43 -06:00
Brian Palmer 718c3d01be support section ids in the submissions api, refs #5835
Change-Id: Ibbe8f3852e8674c963e735b3f0fe8982d5ad7244
Reviewed-on: https://gerrit.instructure.com/6014
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-06 13:41:06 -06:00
Brian Palmer 5cd5e648a6 optimizations for submissions for_students api, refs #5806
* fix a bug in Api.map_ids that was causing a worthless SELECT for each id given
 * pre-load all the assignments and manually set them on the
   submissions, to avoid those individual queries
 * if sis ids are given, resolve them to AR ids all in one query, rather
   than individually
 * allow excluding attachments and discussion_entries using the
   response_fields/exclude_response_fields functionality

Change-Id: Ib48016f8440959a08637385f0ccaa23d40e7adde
Reviewed-on: https://gerrit.instructure.com/5975
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2011-10-04 17:11:46 -06:00
Brian Palmer 829f7f79a7 api attachment_json improvements, fixes #5642
* correctly return attachments with Assigment contexts
 * filter out nil responses from attachment_json

Change-Id: I8c6df46d47ab817bc9d7771257aef9212471e392
Reviewed-on: https://gerrit.instructure.com/5681
Reviewed-by: BJ Homer <bj@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-16 14:15:59 -06:00
Brian Palmer b317f0d264 clean up user querying in the api, refs #4756, #4746
Finding users is a bit different, since the user's sis information is
actually stored on the pseudonym. Before, we were working around this in
the submissions api. I've generalized it to work everywhere that uses
the Api find functionality, and in the process fixed the page views api
so that it works with sis ids.

This is necessary as we add more user apis, like the upcoming
/users/:user_id profile API.

Also added the /users/self shortcut to query the various user apis for
the user accessing the api.

Also for consistency, deprecate users/activity_stream in favor of
users/self/activity_stream

Change-Id: Icb0776231070b838bb341893d12b1061b90c5d04
Reviewed-on: https://gerrit.instructure.com/5628
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-13 12:33:45 -06:00
Jon Jensen b4f518d5f1 conversations api, closes #4753
also streamlined conversations json and made it more consistent

Change-Id: I422d9eaf5e2e8d228c184302cb2e95d2755f50d4
Reviewed-on: https://gerrit.instructure.com/5399
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-13 09:28:57 -06:00
Brian Palmer 76f50e249e use json_opts in stream_json_array
Change-Id: Ic5f63807e2ed8b4a5a7319b6396c455b282da4ff
Reviewed-on: https://gerrit.instructure.com/5622
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-12 14:39:57 -06:00
Brian Palmer fb7732a8dc user page views api
Change-Id: I7a011cf924e2ce909b1d4ae4aca134e6c14168e8
Reviewed-on: https://gerrit.instructure.com/4986
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-09-06 16:18:59 -06:00
Brian Palmer 99d4540804 limit maximum per_page in api calls
Change-Id: Ia22e751b9430fd8f019bff7fcd406340c0532c2f
Reviewed-on: https://gerrit.instructure.com/5194
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-08-24 15:16:16 -06:00
Brian Palmer b4de1b0e37 account list/show apis, for account_users
Change-Id: I787d05965b6dc5cee461f1b3041418de89d5304f
Reviewed-on: https://gerrit.instructure.com/4964
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-08-23 15:51:46 -06:00
Brian Palmer a2e35e8e11 fix api support for sis ids in url with special chars, closes #5176
periods were being interpreted as the beginning of a file extension,
rather than part of the sis id. fixing this meant completely changing
our routing, unfortunately, since rails resourceful routing is very
oriented on numeric ids, with format extensions.

the .json extension is now optional for api requests, in api v2 we'll
drop it completely. there is the unfortunate edge case that a sis id
ending in ".json" can't be send through the v1 api -- except...

we also now support hex encoding sis ids in the api calls. this allows
arbitrary strings to be used. in theory this could just use uri
encoding, which is also "supported", but there are bugs in various
releases of apache and the rack/rails stack that make this impossible to
use with some characters, such as "." and "/".

the api documentation has been updated as well

Change-Id: Ifa4b529dffee0f30ef5384f94c64aa6e8f8f2542
Reviewed-on: https://gerrit.instructure.com/4940
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-08-04 16:25:21 -06:00
Bracken Mosbacker b3167f4640 start discussion topic api
refs #4752

Change-Id: I54712c27ef1c496c2c92f7805240ca91405b2858
Reviewed-on: https://gerrit.instructure.com/4797
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-07-28 12:05:18 -06:00
Brian Palmer 493a26d541 use more specific sis field names in api, and support both user sis ids
users have both a SIS user_id and login_id, return both in the API and
allow both as ids when specifying a user in API calls using the syntax
sis_user_id:someid and sis_login_id:someid

These columns in the db aren't well named, unfortunately, but we'll try
to at least be consistent in the API.

This is technically a breaking change for the API. We've decided to go
ahead with it, as this API functionality was only recently added.

Change-Id: I8eabe4226580aa3b1aec7e5b7082b045f786e605
Reviewed-on: https://gerrit.instructure.com/4556
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-07-07 15:44:25 -06:00
Brian Palmer 4ddce72a8e extend submissions for_student api for gradebook2
Change-Id: I32c9ae92495ebb3fecca52983a3b50dcd162b620
Reviewed-on: https://gerrit.instructure.com/4399
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
2011-06-28 16:15:41 -06:00
Brian Palmer ace397540a support sis ids in the canvas apis, closes #4386
Change-Id: I2ae2a447f3950d09257b9ff6498326ec89c8bed8
Reviewed-on: https://gerrit.instructure.com/3621
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-05-16 13:25:07 -06:00