Commit Graph

68 Commits

Author SHA1 Message Date
Jeremy Stanley ef85123d31 allow observers to see replies after a linked student posts
test plan:
 - have some discussion topics that require students to post before
   reading other replies
 - have an observer linked to multiple students
 - ensure that the observer can view replies on a discussion topic
   after a linked student posts.  test a different student with
   each topic.  (this feature used to work for at most 1 linked
   student.)

fixes CNVS-36504

Change-Id: If8ac47038d64ef1d8c9ebfe4d71a60d6990383d2
Reviewed-on: https://gerrit.instructure.com/110743
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2017-05-05 17:54:46 +00:00
Landon Wilkins 241f6be120 da licença part 2
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: Ic8161ac858d70976f53f78e01572f3eb9bb61990
Reviewed-on: https://gerrit.instructure.com/110019
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
2017-04-27 21:09:03 +00:00
Cody Cutrer ce21af8ecf rails 5: find and fix lots of deprecation warnings [ci verbose]
refs CNVS-34843

Change-Id: Idd523c2a7c37325381d590f1ee70c406ace2a459
Reviewed-on: https://gerrit.instructure.com/105033
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-03-16 16:03:51 +00:00
Cody Cutrer 556f0b64bf rails 5: s/_filter/_action/g
fixes CNVS-34832

the arguments to these methods have not changed, just their names. and the
new methods became available in Rails 4, so we can start using them now

and prevent someone from doing old-style in the future

Change-Id: I61aa5512995dc8f25f3f7bd009a6cfa0a030e274
Reviewed-on: https://gerrit.instructure.com/101401
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2017-02-09 23:03:40 +00:00
James Williams 9810846ac7 resolve placeholders in discussion topic new entries json
test plan:
* the original problem will be difficult to reliably
 reproduce without disabling the delayed_jobs process
 given that this caused by a race condition (you need
 to refresh the discussion topic page before the job
 recompiling the materialized view finishes)
* embed an image in a discussion reply
* refresh the discussion topic page
* the image in the reply should work correctly
 (it shouldn't link to "placeholder.invalid")

closes #CNVS-34624

Change-Id: I84fffe4dab67a6cb06134c96f8225513aba1f93d
Reviewed-on: https://gerrit.instructure.com/100871
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2017-02-08 13:37:20 +00:00
Cameron Matheson 9a0a0315c8 add student context cards to discussions
refs FALCOR-8
closes FALCOR-37

Test plan:
  * make posts to a discussion topic as a variety of users
    (student/teacher/etc)
  * when clicking on the username for a student, the student's context
    card should be displayed (only when the feature_flag is turned on)
Change-Id: Ib793b984ac69c14f69222541a8e096fff983c824
Reviewed-on: https://gerrit.instructure.com/96632
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2016-12-09 23:54:09 +00:00
Ryan Shaw 9501380c34 remove all occurrences of use_new_styles? from ruby code
closes: CNVS-31371

test plan:

* do an lti launch, it should work
* check a couple pages in this list of changes,
  they should work

Change-Id: I8005162dd7e45711cc74204f47a76f9133870a6d
Reviewed-on: https://gerrit.instructure.com/89024
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
2016-09-12 15:31:07 +00:00
James Williams 5c6ab9b3c0 fix mobile overrides in materialized discussion view
test plan:
* add js/css to the mobile section of the theme editor
* create a discussion with replies
* it should not load the mobile js/css

* view the discussion topic through the API w/ token
* the "message" values should include stylesheet/javascript tags

closes #CNVS-30339

Change-Id: I4a41a8fa74f9ed3ec8200ac618e6f878e726b0e6
Reviewed-on: https://gerrit.instructure.com/85310
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Tested-by: Jenkins
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-08-30 17:23:53 +00:00
James Williams 61b1e0635f replace some EnrollmentDateBuilder#preload with preload_states
once all of the enrollment states have been calculated,
we probably won't need all the dates to know what our current
state is

Change-Id: I489c43d4daeea5c431f468cbcf920d34a878e2b1
Reviewed-on: https://gerrit.instructure.com/83878
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-08-01 13:59:54 +00:00
Alex Boyd e844fe5ddc Fix discussion speed improvements for nonenrolled participants
Change-Id: I9e266758044482efa310aaffb1c28f42b1eb5bbe
Reviewed-on: https://gerrit.instructure.com/84299
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins
2016-07-05 16:14:56 +00:00
Alex Boyd a3c10e9db6 Speed up discussion materialized view loading
Preload participant accounts to avoid an N+1, and shove the
participants' enrollments into a hash to avoid O(n^2)
performance correlating enrollments and participants. Each
of these was responsible for about a third of #view's time
spent rendering a discussion with ~2000 participants and
replies, so this'll now run in about 30% of the time it
used to.

Fixes CNVS-30215

Test plan N/A (make sure you can still view discussion replies)

Change-Id: I0bfde88a20e8146db2cfd38df57bfeb75eb85071
Reviewed-on: https://gerrit.instructure.com/83745
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Alex Boyd <aboyd@instructure.com>
2016-07-05 13:32:48 +00:00
Simon Williams 70d525fc6d extract stringify_ids to a gem
refs CNVS-29727

Methods to convert hash keys named 'id' or that end in '_id' from ints to
strings, to avoid javascript floating point errors in javascript when
receiving the JSON representation of that hash.

test plan:
- make sure that if you pass 'application/json+canvas-string-ids' as an
accept header that ids come back as strings from the api

Change-Id: I0a1629f88eb8a50babefb06b075105bf8307ef94
Reviewed-on: https://gerrit.instructure.com/81427
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Benjamin Christian Nelson <bcnelson@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2016-06-09 18:19:32 +00:00
Christian Prescott eaa52716da Add WikiPage assignment type
refs CYOE-67

Test Plan
0. `rake db:migrate` and compile assets. Enable the conditional release
   feature flag in course settings.
1. Create a published WikiPage, assignment-free. Ensure it is visible
   to errybody.
2. With the API, create an assignment with submission type 'wiki_page'.
   A new page will be created for the assignment.
```sh
curl "http://canvas.dev:3000/api/v1/courses/1/assignments" \
-H "Content-Type: application/json" -H "Authorization: Bearer <token>" \
-X POST -d '{"assignment": {"name": "Page Asg", "published":true, \
"submission_types":["wiki_page"]}}'
```
3. Ensure the assignment is assigned to "Everyone" and the page is
   visible to all.
4. Assign the assignment to a specific student or section. Ensure the
   page is visible only to the assigned set.
```sh
curl "http://canvas.dev:3000/api/v1/courses/1/assignments/13" \
-H "Content-Type: application/json" -H "Authorization: Bearer <token>" \
-X PUT -d '{"assignment": {"only_visible_to_overrides": true }}'
curl "http://canvas.dev:3000/api/v1/courses/1/assignments/13/overrides" \
-H "Content-Type: application/json" -H "Authorization: Bearer <token>" \
-X POST -d '{"assignment_override": {"student_ids":[126]}}'
```
5. Ensure the DA behavior also applies to WikiPage#show and update and edit.
6. Ensure API behavior matches docs for Assignment and Page endpoints.
7. Ensure no regressions in non-page assignments, with and without CR
   feature flag. Ensure no regressions in discussion topics and
   announcements, including assigned discussions.

Change-Id: Ie53c6ffa4e4533cedd54f10aee3ba0b8a27aa4d5
Reviewed-on: https://gerrit.instructure.com/75139
Reviewed-by: Matt Berns <mberns@instructure.com>
Tested-by: Jenkins
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Christian Prescott <cprescott@instructure.com>
2016-04-21 17:25:15 +00:00
Alex Boyd 7937e8452c Add avatars to discussion entry json
Fixes CNVS-28363

Test plan:
 - Make a user with an avatar
 - Make a discussion topic
 - As the user with an avatar, reply to the discussion topic
 - Hit /api/v1/courses/:course_id/discussion_topics/:topic_id/entries
 - Verify that the returned entry has a user key
 - Verify that the returned user has an avatar_image_url key
 - Verify that it's the user's avatar

Change-Id: Ied975ad2d78d5cac34a464af3068cde705739eb4
Reviewed-on: https://gerrit.instructure.com/75829
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Alex Boyd <aboyd@instructure.com>
2016-04-05 20:59:41 +00:00
James Williams 4748344dda show inactive enrollment status on discussion entries
test plan:
* create a discussion topic
* post to the topic as a student
* deactivate the student
* view the discussion topic as a teacher
* it should mark "inactive" by the student's name

closes #CNVS-27438

Change-Id: I06c355c3894c990225b2d984e84f26337ff2b252
Reviewed-on: https://gerrit.instructure.com/74630
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Allison Weiss <allison@instructure.com>
2016-03-23 19:46:59 +00:00
James Williams 0777cba946 remove differentiated assignments feature checks
test plan:
* basic regression test of assignment overrides

closes #CNVS-27549

Change-Id: Ie463848b3831087efb3f9ec762dca6264055ee76
Reviewed-on: https://gerrit.instructure.com/73139
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2016-03-07 18:44:46 +00:00
James Williams 6274d438c8 don't count student attachments in graded discussions for quota
test plan:
* create and publish a course with a graded discussion topic
* enroll a student in the course
* as the student, post a reply to the topic and attach a file
* it should not count toward the quota

closes #CNVS-27114

Change-Id: I6fb847a61a7a10a69dc035d5f5e1f15dda107a04
Reviewed-on: https://gerrit.instructure.com/71691
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Matt Goodwin <mattg@instructure.com>
2016-02-10 15:39:52 +00:00
James Williams 5881701e8c rails 4.2: api spec fixes
refs #CNVS-26056

Change-Id: I082e29c642b9150260f6571f0aa8ef397c6e2cca
Reviewed-on: https://gerrit.instructure.com/70593
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2016-01-21 16:14:03 +00:00
James Williams 0edfd27317 check with student quota for discussion entry attachments
test plan:
* create a student in a course
* enable "let students attach files in discussions"
 in the course settings

* upload a file into the course and then adjust the size of the
 course file quota so a new file cannot be uploaded

* create a discussion
* as a student, should still be able to attach files to the
 discussion as long as the student's own quota hasn't been
 exceeded (since that's where the files go anyway)

closes #CNVS-25366

Change-Id: I3a9bce73b1362a2c7e405f709c64856ace901d2b
Reviewed-on: https://gerrit.instructure.com/68794
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-12-21 19:59:16 +00:00
James Williams 5f9304f3e0 rails4: various api spec fixes
refs #CNVS-21596

Change-Id: Ib41c03782b1667d3876283fd99d8ccf7585e1fd6
Reviewed-on: https://gerrit.instructure.com/58651
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2015-07-21 15:44:32 +00:00
John Corrigan 769fbf17e1 don't manually trigger context_module_action on entry save
fixes CNVS-18588 (maybe)

In this method we save the entry twice (each time triggering a call to
`context_module_action_later`, then also called `context_module_action`
explicitly. I believe this could lead to a situation in which we are
creating and updating the submission associated with the entry twice in
quick succession, thereby updating the submitted_at date and triggering
the resubmit notification.

test plan:
- as a teacher, update your notificatino preferences to receive a
  message for assignment submissions ASAP.
- create a graded discussion topic.
- as a student, reply to the topic.
- as the teacher, look at your messages (/users/:user_id/messages), and
  observe that there is only a notification for the submission, not a
  re-submission.
- Also: regression testing around the creation of discussion entries.

NOTE: This is only an intermittently reproduceable bug that seems to rely
on background jobs running. See jira ticket for an environment in which
the issue was reproduceable with some consistency.

Change-Id: Ic33af0fa5d70f90f2d1ad1b1b1d7ea5cbc7e05dd
Reviewed-on: https://gerrit.instructure.com/56289
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-06-12 20:41:41 +00:00
Braden Anderson f5276f7a78 discussion entry liking
fixes CNVS-16277

test plan:
  * create a discussion topic
  * open edit page
  * change Allow liking, Only graders can like, Sort by likes
  * verify that changes persist

  * open topic show page
  * verify that like buttons are present if Allow liking is enabled
      and Only graders can like is disabled or the user can grade

  * click on a Like button
  * verify that the button is activated
  * refresh the page
  * verify that the rating persists
  * verify that the number of likes on each entry is displayed

  * enable Sort by likes
  * wait a minute for the topic's cache to rebuild
  * refresh the page
  * verify that entries are sorted by number of likes

Change-Id: I8e329899c8b81832bdf9132438537bcd7a32e258
Reviewed-on: https://gerrit.instructure.com/42786
Reviewed-by: Joel Hough <joel@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Tested-by: Jenkins
2015-04-25 03:10:48 +00:00
Benjamin Porter 4cb68ec577 Don't show announcement comments to non-students
When the user is not logged in, or is not enrolled in the course, don't
show student comments on announcements.

Fixes CNVS-19270

Test Plan:
    - Create an announcement in a *public* course as a teacher
    - As a student, leave a reply on the announcement
    - Verify that the reply shows up for students in the course, as well
      as the teacher and account admins
    - Log out, and verify that the comments are not visible to
      a non-user
    - Create an announcement in a non-public course and ensure that
      student and teacher and admin can all see them properly

Change-Id: Ide381f6271a1de66ac85f6c7b0e2a2557190991d
Reviewed-on: https://gerrit.instructure.com/50595
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
2015-03-31 23:28:18 +00:00
Jeremy Stanley c5037b1f38 store placeholder for host in materialized view
and then replace it with the request host when
serving the content from the API

test plan:
 - create one or more /etc/hosts file entries to point at
   your canvas instance with different names
 - reply to a discussion and include embedded images
   and attached files in the reply
 - view the discussion as a user pointing at a different
   hostname.  confirm that the attachments and embedded
   images work.
 - use the "Get the full topic" API endpoint to retrieve
   the topic and replies via the API. do this with more than
   one hostname. confirm that the URLs for the attached file
   and embedded images match the name of the host you
   are hitting the API with

fixes CNVS-17708
fixes CNVS-19125

Change-Id: I055235b3e785946e5999bf522ea4cad592f0f7f7
Reviewed-on: https://gerrit.instructure.com/50360
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2015-03-31 16:32:08 +00:00
Simon Williams f5b0885491 api: in discussion docs, locked means closed for comments
closes CNVS-7983

test plan:
- generate the api docs
- go to the discussion topic api doc page
- the 'locked' key should explain that it represents being closed for
  comments

Change-Id: I557ea9123b1551acd3d573cd8f8955cb112aa85f
Reviewed-on: https://gerrit.instructure.com/48405
Tested-by: Jenkins
Reviewed-by: Benjamin Porter <bporter@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-02-11 21:44:56 +00:00
James Williams e57003b645 require context read access for discussion topics
test plan:
* create a course with a discussion topic
* keep it unpublished but add a student
* as a student, should not be able to
 view the discussion topic through a direct link

closes #CNVS-6384

Change-Id: I0c0bc66e377d870de6c97555e25e82a8226264f4
Reviewed-on: https://gerrit.instructure.com/48278
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-02-06 21:32:20 +00:00
Michael Nomitch 4e791b941b DA - more refactoring
- cleans up assignment model
- eliminates unnecessary feature flag checks
- eliminates unnecessary teacher permission checks
- moves duplicated methods from assignment and quiz
  to new module

Change-Id: I8d1e8f99bf5c8f6a63bd670b432aeef7e8f0e86b
Reviewed-on: https://gerrit.instructure.com/41654
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-10-08 16:32:18 +00:00
Michael Nomitch 58c30e2078 DA - discussions
fixes CNVS-14093

test plan:
  - turn on DA, create a graded discussion only assigned
    to one group
  - as a teacher or a student with visibility
    - you can access the dicussion through the app or the api
    - students without visibility arent included in participants
  - as a student without visibility
    - the discussion index doesn't show the discussion
    - a direct link to the discussion will send you to the
      discussion index with a flash error
    - the API doesn't show the discussion
      (show page, entries page, or replies page)
    - cannot subscribe to the topic via the api
  - with DA off, the discussion shows up normally
  - a student in both sections has visibility

Change-Id: Icefef62695f73d38787d9af08ec26c595c2e4514
Reviewed-on: https://gerrit.instructure.com/39383
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-08-28 22:18:26 +00:00
Brian Palmer 57c34d3191 query the discussion topic materialized view from slave
test plan: load a discussion topic in the web UI. it should load as
before, and if the materialized view already existed, the logs should
show the SELECT for it only against the slave.

Change-Id: If397681f1ebb2502089ee94c24b0292b34ec8eb8
Reviewed-on: https://gerrit.instructure.com/39877
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-08-25 17:09:24 +00:00
Ben Young 7a6cd80a57 update API doc required params - 5
- Discussion topics
- Enrollment terms
- Enrollments
- External tools
- Favorites

Test plan:
- rake doc:api
- Verify the above doc pages for parameters accuracy

Refs SIS-403

Change-Id: I5a926cf36f0852c11356719f76b5b54bd25f96da
Reviewed-on: https://gerrit.instructure.com/38805
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Tyler Pickett <tpickett+gerrit@instructure.com>
Product-Review: Tyler Pickett <tpickett+gerrit@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
2014-08-18 16:41:06 +00:00
Braden Anderson 4fafdda484 discussions: separate group discussions from group assignments
fixes CNVS-4475

pre-checkout plan:
  * create a course
  * open people->groups
  * create a student group with multiple students
  * open discussions
  * create two topics
  * make one topic a group assignment

test plan:
  * open the topics you created
  * verify that a "group discussion" option replaced "group assignment"
  * verify that your group assignment is a group discussion
  * verify that your group discussion uses the same group set
  * verify that the old behavior of presenting child topics is retained
  * verify that your non-group topic is not a group discussion
  * verify that the "group discussion" flag cannot be changed for topics
      with replies

  * create a new discussion topic
  * verify that "group discussion" is available for ungraded topics
  * verify that changes to the field persist

  * create a new graded group discussion topic
  * post to one of the subtopics as a student in its group
  * open the gradebook as the teacher
  * verify that the student who posted has a submission but the other
      group members do not
  * verify that group members can be graded individually

Change-Id: Iada30628f0abdb7d7df4267d695553baf8b952d3
Reviewed-on: https://gerrit.instructure.com/33253
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-05-08 21:18:40 +00:00
Nick Cloward 398ac0996d create a page_view on a participation
fixes: CNVS-12029

This consolidates the use of log_asset_access so when this is set as
a participation and a page_view does not exist it will create one.
This will keep the asset user access in sync for participations so
analytics and the access reports are not off.

Test Plan:

Create a course with some quizes.  Take the quiz and view the quiz
to generate some activity for a student.

Open the Student Activity report along with analytics for the
student/course.

Make sure the numbers of participations match in each report.

Change-Id: If8b6e7d86e350d5b2a3dd15ca9236c14f52d300a
Reviewed-on: https://gerrit.instructure.com/32382
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-04-16 19:42:06 +00:00
Joel Hough e4530487eb returns shard aware participant ids from discussion view api
fixes CNVS-10549

test plan
- create a discussion topic
- reply to the topic with a user on another shard
- view the discussion as the original topic creator
- ensure that the reply shows the correct author

Change-Id: I5115f6fd3a21f6c8b986e7a9e0c95b5fe4be1587
Reviewed-on: https://gerrit.instructure.com/30080
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-02-14 22:32:05 +00:00
Cameron Matheson 3c434e8aff Remove unused collections stuff
This was a beta api that didn't work out.

Test plan:
  canvas should still work (sorry, this touches lots of stuff)

Change-Id: I31680b83f72f6d739ce74735ba40d7a760debb33
Reviewed-on: https://gerrit.instructure.com/29506
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-02-07 19:32:46 +00:00
Braden Anderson 4b2c6771bb discussions: use strings for IDs in ENV and materialized view
fixes CNVS-10341

test plan:
  * before applying this commit, if possible:
    * create a discussion
    * add a reply as a student
  * after applying this commit:
    * open the discussion as the student
    * verify that you can edit the reply you added before, but not
        those from other users
    * add a new reply
    * without refreshing, verify that you can edit your new reply
    * refresh the page
    * verify that you can still edit your reply

  * test basic canvas functionality (sorry)

Change-Id: Ifa654f7d853fd167d5bfbaee6184657209d58272
Reviewed-on: https://gerrit.instructure.com/28413
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-01-16 17:31:32 +00:00
Rob Orton fc80fa2b77 change api doc examples to be https instead of http
closes CNVS-3912

test plan
- api docs should be updated and display

Change-Id: Ie6d4c80b91e3e3c8cee4b6d2e93c000f1040fd35
Reviewed-on: https://gerrit.instructure.com/25657
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2013-10-25 18:32:42 +00:00
Jeremy Stanley 5ab1d2eaed put discussion entry attachments in user context
test plan:
 1. in course settings, allow students to attach files to
    discussion entries
 2. as a student, attach a file to a discussion entry
 3. as a teacher and as a different student in the course,
    ensure the file can be downloaded from the discussion
    page
 4. ensure attachments to discussion entries do not show up
    in the files tab
 5. copy the course and make sure the student attachments
    don't appear in the copy either

fixes CNVS-8907

Change-Id: I6df4293b00b774e264f47597b2058e2012f1142b
Reviewed-on: https://gerrit.instructure.com/25422
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-10-24 19:56:52 +00:00
Jacob Fugal b12791aa99 to_json unnecessary (and wrongish) in render :json
refs CNVS-7597

render :json => thing will call ActiveSupport::JSON.encode(thing) unless
thing is a String. ActiveSupport::JSON.encode(thing) just calls
thing.to_json but with some circular reference checking that we want. we
may also want enhance ActiveSupport::JSON.encode to do additional
processing, and calling to_json straight up would bypass that.

in the cases where we do need to do the structural transformation before
passing to render :json (e.g. because of need to pass arguments), use
as_json to do structural transformation only, vs. to_json that does
serialization of the as_json result.

adds a rake task to lint the controllers to enforce as_json over to_json
in render json calls.

test-plan: heavy regression testing; no end behavior should change
(except a pair of serialization bugs that got fixed)

Change-Id: I7a91a9fe0eca70456bc5bca233f0ed6b27a54aaf
Reviewed-on: https://gerrit.instructure.com/23650
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-10-02 18:05:22 +00:00
Zach Pendleton deb3e70abc always return discussion topic summary
fixes CNVS-6823

when a student who has not posted to a discussion topic
with the require_initial_post setting attempts to make an
api call to the show action, they can now see the topic
information instead of a "require_initial_post" message.

this commit only changes the behavior of the
discussion_topics_api_controller#show method. it does not
change the error behavior of the entries, view, and reply
to entry actions.

test plan:
  * create a discussion topic with require_inital_post set
    to true;
  * as a student in the topic's course, make a call to
    /api/v1/courses/:course_id/discussion_topics/:topic_id;
  * verify that topic information is returned.
  * verify that calls to the view and entries actions still
    return the string "require_inital_post" per the api
    documentation.

Change-Id: I816e7d1de57829e74ddf102a07856c3e65620aa8
Reviewed-on: https://gerrit.instructure.com/23541
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
2013-08-22 18:22:10 +00:00
Duane Johnson 4cd394fc76 API doc standardization - part 7
discussion, enrollment controllers

Change-Id: Icafd128b6bebcd84dc05a8eafec59ffc573a2aaa
Reviewed-on: https://gerrit.instructure.com/23300
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Duane Johnson <duane@instructure.com>
QA-Review: Duane Johnson <duane@instructure.com>
2013-08-16 14:49:33 +00:00
Mark Ericksen 5c8e70193c change user find approach for sharding concern
refs CNVS-6376

testing steps:
* discussion entry api call should work
  as expected (i.e. no behavior change,
  regression tests)

Change-Id: I5055b9337e805a586e8c90b1be27516777341951
Reviewed-on: https://gerrit.instructure.com/21665
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Mark Ericksen <marke@instructure.com>
2013-06-26 14:46:33 +00:00
Joel Hough 65986cfaac discussion topic subscription flag and api
fixes CNVS-6238

test plan
using the api:
- view a discussion topic as a user that did not author it
- ensure that subscribed: false

- view a discussion topic as the authoring user
- ensure that subscribed: true

- unsubscribe from a discussion topic that the user authored
- ensure that subscribed: false

- subscribe to a discussion topic
- ensure subscribed: true

- subscribe to a topic that requires an initial post with a user
 that hasn't posted yet
- ensure that it is an invalid request

- subscribe to a topic that requires an initial post with a user
 that has posted
- ensure subscribed: true

Change-Id: Ie76a046bb6e9b5253088c371ffdc4dc6ddf08231
Reviewed-on: https://gerrit.instructure.com/21402
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-06-14 21:40:50 +00:00
Jon Willesen a65f2acb7a add forced_read_state to DiscussionEntryParticipant and APIs
Don't automatically mark a discussion entry as read if the user
manually marks the entry as unread.

fixes CNVS-5705

test plan:
 - As one user, create a discussion with lots of posts.
 - As a different user, go to the discussion, see the entries
   are automatically marked as read. Don't scroll all the way
   to the bottom of the discussion so there are still some
   unread posts.
 - Click the gray circle to manually mark some of the read
   entries as unread.
 - Refresh the page. The manually marked entries should show
   as unread and should not be automatically marked as read.
 - Scroll down. Unread entries that were not manually marked as
   unread should still be automatically marked as read.

Change-Id: I963d1dea9fc961a28a0a5c488399d4e3964c8d10
Reviewed-on: https://gerrit.instructure.com/20414
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-05-10 21:45:23 +00:00
James Williams 25c606f890 clean attachment links in incoming user content through api
test plan:
* create an assignment, link an attachment
 in the description, and save
* open the assignment editor up again and save it
* delete the attachment and re-upload another
 file with the same name
* preview the assignment
* the link should take you to the updated
 attachment instead of failing

fixes #CNVS-5216

Change-Id: I7258d4ca35f6d34594bd32bd77e86c2e61262ea4
Reviewed-on: https://gerrit.instructure.com/19594
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-04-19 18:20:05 +00:00
Ethan Vizitei c8b1c36d6f refs #8395 expanded page views
force a page_view record when
submitting an assignment
and when updating an assignment
description

force a page_view when
starting a new discussion
or when replying to a discussion

force a page_view when updating
a wiki page and when joining
a conference and when starting
a collaboration

start tracking http methods for
page views

don't link through to urls
for page views if they aren't 'get'
methods

pull some of the page_view logging
down into the asset_user_access
object and simplify it so
that the application controller is
more readable and the scoring incrementing
is easier to understand

TEST PLAN:
  1) login as a student
  2) turn in an assignment submission
  3) take a quiz
  4) update an assignment description
  5) start a discussion and reply to it
  6) login as an admin and confirm through
     analytics and through the detailed
     page view listing that all these
     actions counted as participations
     (and that the ones that are not
      'get' methods can't be clicked through
      from the student accound details page)

Change-Id: I2dfe4df41e8b006e6a0c0d8a1f914ecd7fb62477
Reviewed-on: https://gerrit.instructure.com/15428
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-30 08:34:18 -07:00
Brian Palmer d380470304 fix api paginatations that were returning a path, not an absolute url
fixes #10693

Also added a test to api_call spec helper to catch these in the future.

test plan: for all available api endpoints that use pagination, the Link
header returned should use absolute urls (http://<canvas>/api/v1/...
rather than just /api/v1/...).

Change-Id: Ia53d32e6902430bd554d322461a36323d5f2d3c3
Reviewed-on: https://gerrit.instructure.com/14502
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-18 14:59:18 -06:00
Brian Palmer 06b10f6a34 return user display info for collection items
This standardizes the "user display" sub-object returned by the
discussions api, and returns that same data for each collection item.

test plan: make api calls to return collection items, verify the user
sub-object is present and contains the expected user data.

Change-Id: Ie5b1468816ffbf27a005044effbc49082bdf679b
Reviewed-on: https://gerrit.instructure.com/11276
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-06-07 14:31:55 -06:00
Zach Wily 37953343cd add a DiscussionTopic to CollectionItems in the API
To allow commenting on CollectionItems, we are goign to leverage
DiscussionTopics. The topic will not be created until the first comment is
made, and is accessed via the normal DiscussionTopic API (using a special
endpoint).

This also adds a new "flat" DiscussionTopic type, which doesn't support any
nesting of replies.

test plan:
 * Create a collection and an item in that collection (via console or API)
 * Using the API, query the discussion topic for that item via the API
 * Using the APi, add a comment to that discussion topic
 * Using the API, fetch the discussion again and see that your comment appears

Change-Id: Ie7cc27a7bc1d7960040632015971e59f084d7e6f
Reviewed-on: https://gerrit.instructure.com/10960
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-05-29 13:58:42 -06:00
Brian Palmer 7b1beec9ef api for getting a single discussion topic
This was a gaping hole in our current topic APIs

test plan: make a request for the list of topics, and then request one
of those individual topics and verify you get the same information back.

Change-Id: I3c9f2e6680b5bebe88f65ebaa876050acab605d2
Reviewed-on: https://gerrit.instructure.com/10783
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2012-05-17 11:28:43 -06:00
Brian Palmer 581fe4330d api documentation updates
* Allow linking to individual endpoints on the page.
* Give each endpoint a summary string, and list the summaries at the top
  of the page, with links to the endpoint details.
* Make an omnibus "all resources reference" page, which has been a
  common request. This only includes the endpoint details, not the
  summary descriptions of the resources.
* Syntax highlighting for JSON

test plan: visit /doc/api/index.html and see the changes (run rake
doc:api first if on a dev box)

Change-Id: Ib126805825d40770c36b3688668c62938348412d
Reviewed-on: https://gerrit.instructure.com/10516
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-05-04 11:19:51 -06:00