Commit Graph

95 Commits

Author SHA1 Message Date
James Williams d473cb3514 prevent large group conversation creation
test plan:
* right now, the setting defaults to 100, but it
 may be easier to test with a smaller maximum.
 you can do that by setting in the console

  Setting.set("max_group_conversation_size", X)

* when trying to send a message with more than X
 recipients, it should automatically check and disable
 the "Send individual messages" checkbox

refs #CNVS-15747

Change-Id: I1158ded58b60114fa801498594cc84a360bfcf8c
Reviewed-on: https://gerrit.instructure.com/52970
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-04-29 16:11:32 +00:00
James Williams d50fffb713 include updated_at in Conversation#preload_users_and_context_codes
without updated_at, it's possible to fetch stale
conversation_context_codes, which ends up causing
the wrong tags to be added (because it tries to infer them)

test plan:
* create a course with two students
* as one student, send a message from that student to the other,
 selecting the course from the drop-down
* create another course with the same two students
* send another message, this time using the other course
 in the drop-down
* view the sent messages, filtering by course
* should show each message in the right filter

closes #CNVS-18315

Change-Id: Ia0418489c2ce632bde36bcb899844f86c892b3c6
Reviewed-on: https://gerrit.instructure.com/49516
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-03-03 13:49:59 +00:00
Cody Cutrer dacf060160 no more dynamic finders
fixes CNVS-15126

Change-Id: I48b99ff69942463df6d6c355fe6f8a2fc679e69a
Reviewed-on: https://gerrit.instructure.com/41969
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-10-03 16:22:49 +00:00
Cody Cutrer 1f8028f163 don't use preload_associations
it's a shim of the rails 2 variety, and breaks in rails 4 in the
common case because the options became a scope

Change-Id: I712a8fed35ee0a9747a13c1495f7d51b8dac6823
Reviewed-on: https://gerrit.instructure.com/41716
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-09-30 18:04:00 +00:00
Brad Horrocks 06dc725a50 CC author on conversation create
Now it is possible to set a notification preference to receive
notifications when you create a conversation.

Fixes: CNVS-13744

Test plan:

Set conversation created notification preference
go to inbox
create a new message and send it
go to /messages to verify there is a notification for the new conversation

note: you will have to have a verified channel to see the new message

Change-Id: I662f2eb62806183871adcce39602d639dbbfc0a3
Reviewed-on: https://gerrit.instructure.com/40873
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2014-09-26 22:23:00 +00:00
Cody Cutrer 102fdfc849 no more dynamic finders (models)
refs CNVS-15126

Change-Id: I2996e0e262c41274c34d0ea3bfde757074416b8c
Reviewed-on: https://gerrit.instructure.com/40973
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-09-24 20:51:48 +00:00
Joel Hough e190910cfe fix cross-shard conversations
cross-shard conversations caused a error when configured to access a
master/slave database setup

test plan:
 * with two users, in separate shards
 * send a message from one user to the other
 * the second user should receive the message successfully

fixes CNVS-15084

Change-Id: If4bde0bf966d44cb94fa1fd23f09190b6fc1e88e
Reviewed-on: https://gerrit.instructure.com/41075
Reviewed-by: Mark Severson <markse@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-09-17 23:10:56 +00: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
Joel Hough 2f8880d2e2 Revert "conversations: fix last_authored_message_at"
fixes CNVS-14333

This reverts commit 4e83960eb4.

Change-Id: I4631088293abc5f2bcb281d60165f9710c7b6111
Reviewed-on: https://gerrit.instructure.com/38622
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-08-02 00:28:48 +00:00
Braden Anderson 07cd3ca25c conversations: clear unread_conversations_count cache
test plan:
  * open Canvas as a user with unread conversations
  * POST to /api/v1/conversations/mark_all_as_read
  * refresh the page
  * verify that your unread conversations badge is gone
  * verify that receiving new conversations also
      immediately updates the badge

Change-Id: Ib0b629ba84a59af102810a415d5955f7a2f4e46a
Reviewed-on: https://gerrit.instructure.com/36698
Product-Review: Braden Anderson <braden@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2014-06-25 03:19:23 +00:00
Braden Anderson f2d4d287f0 conversations: update unread count only for recipients
fixes CNVS-13639

test plan:
  * as user A, send a message to B and C
  * as user B, mark the conversation as read
  * as user C, reply privately to A
  * as user B, verify that your unread message count does not change

Change-Id: I9fbf9b7bfea507d51a95231568ec33211ddd14da
Reviewed-on: https://gerrit.instructure.com/36519
Reviewed-by: Drew Bowman <dbowman@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
2014-06-17 16:50:00 +00:00
Braden Anderson 4e83960eb4 conversations: fix last_authored_message_at
fixes CNVS-13598

test plan:
  * open your browser's network log
  * reply to a conversation
  * verify that in the response, last_authored_message_at
      matches the current time

Change-Id: I22db516bbe61fd341329fb4f6d3dd8c556edf0b2
Reviewed-on: https://gerrit.instructure.com/36326
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Drew Bowman <dbowman@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
2014-06-13 21:26:58 +00:00
Braden Anderson ee1db6929c conversations: only mark conversations unread for participants
fixes CNVS-11312

test plan:
  * start a conversation from user A to B and C
  * as user B, mark the conversation as read
  * as user A, send a reply only to user C
  * as user B, verify that the conversation is still read

Change-Id: I7051eb39acd711ad10344e9e17700a0987a72b22
Reviewed-on: https://gerrit.instructure.com/36172
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Drew Bowman <dbowman@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-06-11 17:25:01 +00:00
Braden Anderson ce508523b6 conversations: mark as read when replying by email
fixes CNVS-13245

test plan:
  * set up reply by email
  * start a conversation with a user receiving conversation emails
  * reply by email as the recipient
  * open conversations as the recipient
  * verify that the conversation is marked as read

Change-Id: Ic52639abea1cc8d9e0214453e9a1dc1c1b4c6906
Reviewed-on: https://gerrit.instructure.com/35319
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-05-30 17:57:21 +00:00
Braden Anderson 45d19f3003 validate types on polymorphic associations
fixes ALYT-26

test plan:
	* regression test

Change-Id: Ie93e89b842e354f1f76d75f3492145b86c79a035
Reviewed-on: https://gerrit.instructure.com/34560
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-05-28 17:05:34 +00:00
Cody Cutrer 6329af6525 fix deadlock between stream items and conversations touching users
fixes CNVS-12621

test plan:
 * start a conversation between two users
 * reply to the conversation as one user
 * as the other user, refresh the dashboard; confirm the unread messages
   count went up

Change-Id: Ia9c58b9ce03b3a1befd5cfdb64774c4a73bedce9
Reviewed-on: https://gerrit.instructure.com/34734
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-05-20 20:10:56 +00:00
Joel Hough 38c0bfd032 remove old conversations and conversation submission comments
fixes CNVS-12330, CNVS-9234, CNVS-8099

before you check out
- configure a user to use old conversations

test plan
- ensure that everyone get new conversations, always, even if
 they explicitly told us that they really like old conversations
 better

- as a student with an existing conversation with a teacher,
 make an assignment submission and a submission comment
- as the teacher, ensure that your unread message count did not
 increase because of the submission comment

Change-Id: If5ae7143abbc5cf5e035f5ed9ea2e5728f70cd45
Reviewed-on: https://gerrit.instructure.com/34343
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2014-05-12 23:38:34 +00:00
Anthus Williams 828981e72c define exportable attributes/associations on models
instead of passing an :exportable option to
ActiveRecord::Associations, simply define a constant
on the class containing exportable associations and
attributes. This is due to :exportable breaking
ActiveRecord, and we can't simply monkey-patch in
config/initializers because models are included in
migrations before the initializers are run

Change-Id: I11f1a6b4570c397d8e01010c517bc6efdac7afca
Reviewed-on: https://gerrit.instructure.com/33235
Reviewed-by: Braden Anderson <banderson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-05-06 23:54:24 +00:00
Nick Cloward 4748aba483 extract canvas sort gem
fixes: CNVS-11890

Test Plan:

Canvas Should not be broken, test requests that use the SortLast and SortFirst
class.  One is account settings.  Make sure its sorted correctly.  Another is
submissions_controller show method and make sure the visible rubric assesments
are sorted correctly.

Change-Id: I75a61475a928e069d6566fcc51305a6c442ec5a0
Reviewed-on: https://gerrit.instructure.com/32014
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2014-04-04 14:53:09 +00:00
Raphael Weiner 5704e9247d Remove duplicate code for finding uniq array elements.
Change-Id: Ib574f903a52b27d0075029f2afb7845c58d61dba
fixes: CNVS-11932
Reviewed-on: https://gerrit.instructure.com/32153
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
2014-03-31 16:21:35 +00:00
Braden Anderson 415697a198 conversations: always give copies of messages to authors
fixes CNVS-11517

test plan:
  * create a conversation with a course context in new conversations
  * reply to the conversation by email
  * verify that the new message is visible both to the email author
      and the author of the previous message

Change-Id: I78496d31fb82b773007c22d4478d62061cb9efef
Reviewed-on: https://gerrit.instructure.com/31101
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-03-04 18:37:32 +00:00
James Williams ceb9e8d048 fix conversation delete_for_all for rails 3
Change-Id: I81540efad41bd6e8d5e128106797980090d334f5
Reviewed-on: https://gerrit.instructure.com/30879
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-02-26 20:43:47 +00:00
Jacob Fugal a2c3dc44fc rename skip_callback->suspend_callbacks
refs CNVS-9522

in rails3 ActiveRecord::Base.skip_callback is a real thing that doesn't
do what this does. because of load order, ours happens, but it would be
nice to leave the other available.

to simplify the switch, both suspend_callback and suspend_callbacks are
kept as renames, but suspend_callback should not be used, preferring
suspend_callbacks. suspend_callback will go away in the near future.

skip_callback is temporarily added back in as an alias to
suspend_callback to allow time for fixing a plugin that uses
skip_callback. it will be removed as soon as that plugin is updated.

Change-Id: Iaefd16dde3b6ce575780cb8f721dc826258eef4e
Reviewed-on: https://gerrit.instructure.com/29808
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2014-02-11 23:14:41 +00:00
James Williams 88dcdc266c fixes for conversations and sharding for rails 3
Change-Id: I86bde6da2cc006e92c00113dccb95f100c2dadee
Reviewed-on: https://gerrit.instructure.com/29393
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-02-04 15:08:06 +00:00
James Williams d62cc68c00 fix conversation add_message for rails 3
Change-Id: Ie07511d14005f26bc794e74e4f6a3d1f46544c47
Reviewed-on: https://gerrit.instructure.com/28343
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-01-10 18:49:27 +00:00
Jacob Fugal a5d8bb8041 limit fake_arel caveats to rails2
refs CNVS-4704

fake_arel gets us most of the way to rails3's arel, but with some
caveats. the workarounds (mostly) work in both, but it'll be nice to not
have them crufting around when we're on rails3. so only use the
workarounds in CANVAS_RAILS2 branches.

Change-Id: Ia1f5cfa6b10f83cdb8d9a6e397b12401d180118d
Reviewed-on: https://gerrit.instructure.com/26331
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-11-19 19:46:30 +00:00
Jon Willesen 3ed0a8eca6 add account context to admin "contextless" conversations
fixes CNVS-9128

test plan:
 - create a new conversation as an account admin to a user that
   does not share a course with the admin.
 - in the console, check that the context of the new
   conversation is the root account associated with the domain
   you used to create the conversation.
 - verify that the recipient can reply to the conversation.
 - create a new conversation as a sub-account admin.
 - check that the context of the new conversation is the root
   account associated with the domain you used to created the
   conversation.
 - create a new conversation with a course context.
 - check that the context of the new conversation is the
   selected course.
 - make sure conversations in general display the right context
   in the new conversations reply dialog when replying to both
   old conversations and new conversations.

Change-Id: I905c80c3d0f092a1bb249e0e604be4698e9be3c7
Reviewed-on: https://gerrit.instructure.com/25804
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2013-10-31 22:00:08 +00:00
Jon Willesen 63a36cf7b9 conversation notifications should only go to message recipients
before, notifications that included the message body were going
to all conversation participants, regardless of whether they
were receiving that particular message. now, conversation
message notifications should only go to the message recipients.

fixes CNVS-8945

test plan:
 - create a conversation among multiple users.
 - send a message to only a subset of those users
 - check that users that received the message get a notification
 - check that users participanting in the conversation but were
   not included in the message do not receive a notification.
 - check the same thing for stream items ("recent activity" on
   the users' home page).

Change-Id: I5d3b4202936366dc95be505ac340a5e01c4f94f9
Reviewed-on: https://gerrit.instructure.com/25522
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2013-10-25 00:12:29 +00:00
Cody Cutrer d935ab98b1 deprecate Setting.get_cached
now that we have SIGHUP, we were changing everything to it anyway,
so just let caching in-proc be the default

Change-Id: Id1b44722522ac9693b17695da7107c99a359d5ac
Reviewed-on: https://gerrit.instructure.com/25020
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>
2013-10-10 00:42:52 +00:00
Cody Cutrer 1561f83a64 add helper for NULLS FIRST/LAST
generates sane SQL for postgresql, which natively supports that,
and the correct workaround for others.

cause I can never remember the workaround in the first place, and
it's very confusing to read existing instances

Change-Id: I75dda687c057888a02a8d99a9b26c4674383006f
Reviewed-on: https://gerrit.instructure.com/24870
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>
2013-10-02 21:38:12 +00:00
Cody Cutrer 419877ff9d clean up sorting all over
* use sort_by instead of sort where possible to avoid repeating yourself
 * use new SortFirst/SortLast sentinels to avoid strange magical constants
 * fix a few places of complicated logic for tiered sorting to just use
   an array

Change-Id: I184ef0b4e31fa18294c9beb32770101d383bbea1
Reviewed-on: https://gerrit.instructure.com/24867
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>
2013-10-02 21:38:08 +00:00
Cody Cutrer 266a89e7db use unicode sorting for ruby and db stuff
fixes CNVS-7199, CNVS-4414

abstract some ICU stuff out to Canvas::ICU, and add some missing
functionality in FFI-ICU

test plan:
 * create a bunch of groups in the same category, named 1-10.
   10 should sort after 9, not 1
 * repeat for creating and publishing quizzes *with the same due date*.
   go to the quiz index, and 10 should sort after 9, not 1

Change-Id: I323eb12dfb5bd23dbcbb3b543fa1b90a72f4341b
Reviewed-on: https://gerrit.instructure.com/24732
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>
2013-10-02 21:38:03 +00:00
Braden Anderson 79bb5e1c14 conversations: constrain subject length
test plan:
  * verify that the API docs for "Create a conversation" document that
      the maximum subject length is 255 characters
  * post a conversation to the API with a subject longer than 255 chars
  * verify that you get a model validation error
  * open new conversations
  * compose a message
  * try to enter more than 255 characters in the subject field
  * verify that your input is constrained

Change-Id: Ibf569c8b7aa17677a5968859b57b0e0c3c373603
Reviewed-on: https://gerrit.instructure.com/23521
QA-Review: Cam Theriault <cam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2013-09-30 20:52:47 +00:00
Jacob Fugal 20deb08ad6 run messageable user queries on the slave
test-plan:
 - all regression tests around messageable users work as before
 - queries should go to slave instead of master db

Change-Id: I272f11d02ef58ed1f120fb01601d595cd45431c9
Reviewed-on: https://gerrit.instructure.com/23459
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-08-28 20:37:23 +00:00
Joel Hough 0348f84d8e add included messages and recipients to add_message endpoint
fixes CNVS-7676

test plan
- use the add_message endpoint to add a message, including
 recipients that weren't in the conversation and some included
 messages
- ensure that the new recipients are added to the conversation
 and can see the new message as well as the included messages
- add a message that excludes some recipients who are already
 conversation participants
- ensure that the excluded participants cannot see the new message

Change-Id: Id4f1ed741514c16cdafd81609d82e5c66aae85ac
Reviewed-on: https://gerrit.instructure.com/23627
Reviewed-by: Jon Willesen <jonw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-08-23 19:45:55 +00:00
Jon Willesen 6f814dd13e add_recipients should exclude messages this user has not seen
with new conversations, not every conversation participant will
see every message. when a user adds a participant to a
conversation in the old interface, the new participant should
only see the messages that the user adding them has seen.

whether a user has seen a message is determined by whether they
have a conversation message participant, which were recently
changed to be soft deleted instead of hard deleted.

fixes CNVS-7653

test plan:
 - in the old interface, create a group conversation with at
   least 3 messages.
 - for one of the users, delete one of the messages using the
   old interface (this will be a soft delete).
 - hard delete another one of the messages using the console:
   u = User.find(<user id>)
   m = ConversationMessage.find(<message id>)
   c = u.conversations.where(conversation_id: <conversation id>)
   c.first.delete_messages(m)
 - refresh the old conversation interface. This user should only
   see one of the three messages now (one was soft deleted, and
   one was hard deleted).
 - using the old interface, add a new user to the group
   conversation.
 - switch to the new user's view of the conversation. they
   should see two messages in the conversation: the remaining
   message and the soft deleted message. the hard deleted
   message should not be visible.
 - otherwise, conversations should behave as they used to.

Change-Id: I5a8c9ff371c2b2877b08c1480261200e0d0b28a3
Reviewed-on: https://gerrit.instructure.com/23579
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2013-08-22 20:52:56 +00:00
Cody Cutrer 4d357e2bc2 optimize Conversation#add_message_to_participants
do a constant number of database queries instead of n^2 cache
lookups (which might miss and lead to several database queries
each)

test plan:
 * reply to a small conversation and a large conversation
 * it should work, and tags should continue to be calculated
   correctly

Change-Id: Iddf488106338b65a97fc4b1335d8ab5c43ed8ae9
Reviewed-on: https://gerrit.instructure.com/23466
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-08-20 22:07:49 +00:00
Joel Hough cbc34c0092 add conversation context to tags
refs CNVS-7354

test plan
- make a conversation with a context
- ensure that the context ends up in the conversation's tags
- make a conversation with a group as a context
- ensure that the group and the group's context end up in the
 conversation's tags

Change-Id: Ife13eb261fe6a6c7064b6045aed8232e097a015c
Reviewed-on: https://gerrit.instructure.com/23259
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-08-16 18:02:36 +00:00
Joel Hough 6ffaa6effc add context name to conversations api
fixes CNVS-7435

test plan
- have some conversations with contexts, some with tags, and some
 with neither
- get them with the index and show apis
- ensure the context name appears in the result. if the
 conversation had no context, the name should be a tag

Change-Id: I571be5ca7dc0ae89c79155d483934c0a8ec5a645
Reviewed-on: https://gerrit.instructure.com/23221
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-08-15 20:36:14 +00:00
Cody Cutrer 7d349a7e32 refactor bulk_insert to use AR::Base.transaction
fixes CNVS-7451

test plan:
 * basic regression test on conversations

Change-Id: Ie90bc36427294920188a4ca9b58bd6045d792768
Reviewed-on: https://gerrit.instructure.com/23265
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-08-14 18:57:08 +00:00
Jon Willesen a140664545 add soft delete to conversation_message_participants
In new conversations, the list of people able to see a
particular message will no longer be equiavalent to the
conversation_participants, so we need to preserve who was able
to see messages so we can display this information in the
interface.

fixes CNVS-7129

test plan:
 - regression test old conversations; there should be no
   behavioral changes there. Especially look at:
   - deleting messages and conversations
   - submission comments (deleting these messages and then
     adding another comment)
   - the internal "delete_for_all" api call (support uses this
     to remove naughty conversations)
 - when deleting messages/conversations, verify with the
   console that the conversation_message_participants are still
   present with a workflow_state that is "deleted".

Change-Id: If17c8f2982fd9187f5b7b5e5acb6ecb24c58d4df
Reviewed-on: https://gerrit.instructure.com/22853
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2013-08-08 16:00:51 +00:00
Joel Hough c792a23712 add context to conversations
fixes CNVS-7128

test plan
- create a new conversation from the api, specifying context_type
 and context_id
- create a batch private conversation from the api, specifying
 context_type and context_id
- ensure that the contexts for those conversations are set
 (no ui for that, check in the console)

Change-Id: I3268af61ffb2bd9f358ada2d8ca1ecfc7455fade
Reviewed-on: https://gerrit.instructure.com/22804
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-08-05 14:24:57 +00:00
Braden Anderson 87c5d3d394 conversations: conversation subjects
fixes CNVS-7131

test plan:
  * verify that the conversations API docs include subject
  * verify that you can create a new conversation through
      the API with a subject
  * verify that you can create a new conversation through
      the API with a subject to multiple recipients
  * verify that conversations API responses include subjects
  * open conversations beta interface
  * verify that the conversation list includes subjects
  * select a conversation
  * verify that the subject is displayed above the messages

Change-Id: Ib4f32dc8348d08c10db42ddbe2022565de88dd9d
Reviewed-on: https://gerrit.instructure.com/22754
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2013-08-02 22:24:08 +00:00
Joel Hough b66e32b6ba set conversation participants' root_account_ids more often
fixes CNVS-6834

now sets the root_account_ids on bulk_insert_participants
also sets all participants' root_account_ids on any added message,
 even if the conversation's root_account_ids haven't changed. this
 should help fix up conversation participants with bad data

test plan
- create a conversation using submission comments
- ensure the root_account_id is set on the conversation participants

Change-Id: Id8745cb415c8acdf24b30bb63663822bd471d570
Reviewed-on: https://gerrit.instructure.com/22622
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2013-08-02 20:55:44 +00:00
Brian Palmer 7a7486e44e fix deleting old conversations
fixes CNVS-7051

This was failing if the stream item had been deleted by the periodic
sweeper.

Change-Id: I3f90511af25838bc4c9ddae63a2475b31e075383
Reviewed-on: https://gerrit.instructure.com/22561
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-07-23 15:05:36 +00:00
Cody Cutrer 6a08e9058b use the birth shard so that the default shard can be changed
Change-Id: Ia7684c0b50df9d5fae4608b7e8e3d8d6dea291cc
Reviewed-on: https://gerrit.instructure.com/19748
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-05-07 15:44:17 +00:00
Zach Pendleton 8f5f5bbc7d update conversation tags when new courses exist.
fixes CNVS-620

test plan:
  * create a course with at least two enrollees (A and B);
  * as enrollee A, send a message to enrollee B;
  * conclude the course, create a new course, and enroll
    users A and B in it;
  * as enrollee A, send a message to enrollee B and verify
    that the message's tags update to include the new
    course.

Change-Id: I36332c84a9602aee31b2e2ee1e73b12e87462e38
Reviewed-on: https://gerrit.instructure.com/20221
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-05-03 21:25:50 +00:00
Cody Cutrer 45290c37a8 fix Converstation#delete_for_all to work for multi-shard conversations
fixes CNVS-4626

test plan:
 * create a conversation between users on two shards
 * use the delete_for_all api to delete it
 * it should not show up for either user anymore,
   either on the dashboard or in the inbox

Change-Id: Iad779febabbc80daeeaeebc49f2fbe23ab04a975
Reviewed-on: https://gerrit.instructure.com/19459
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-12 19:26:42 +00:00
Cody Cutrer d9111f5414 arel-ify models
closes CNVS-4707

Change-Id: I32c8ec5a53525f89cf232890eaac790fbc2b4744
Reviewed-on: https://gerrit.instructure.com/18745
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 18:42:38 +00:00
Eric Berry 6bae3b971d admin masquerading as user can view all messages
fixes CNVS-4223

test steps:
1. Send a message to a whole class
2. As an account level admin (not a siteadmin), masquerade as one of the
   users who received the message
3. Ensure that you can see the message
4. As a different user, send a message directly to the student.
5. Masquerade as the student again and notice that you can see the
   message.

Change-Id: I56e82edfd8900c3192ad9461f0844663ba05d6d4
Reviewed-on: https://gerrit.instructure.com/19014
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Eric Berry <ericb@instructure.com>
2013-03-29 22:50:31 +00:00