Commit Graph

152 Commits

Author SHA1 Message Date
Steven Burnett 453fe29205 add twitter configuration for notification_service
fixes CNVS-26201

Test-Plan:
- Run a message through canvas with twitter configured
- Notice you recieve a direct message through twitter

Change-Id: I7cd31bb2caf285a2bfadad44c248e6617da2f92e
Reviewed-on: https://gerrit.instructure.com/70893
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
Tested-by: Jenkins
Reviewed-by: Alex Boyd <aboyd@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2016-02-09 20:29:07 +00:00
Steven Burnett ba3340bf41 add notification_service sns integration
fixes CNVS-25944

Test Plan:
- Register an Arn with your local canvas through console
- enqueue a message to be delivered from canvas
- notice the push notification on your phone

Change-Id: I1ac80f9ca74953b27d58a95d3f382bf43ad242a1
Reviewed-on: https://gerrit.instructure.com/70425
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
Tested-by: Jenkins
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
Product-Review: Steven Burnett <sburnett@instructure.com>
2016-02-05 02:55:36 +00:00
Ethan Vizitei 1c37ae997b handle message delivery without user
fixes CNVS-26792

there was a regression with the integration of notification service
where a line assumes presence of the user, this adds a guard clause
to allow those messages to deliver.

TEST PLAN:
 1) file a ticket with the ticketing system with no user logged in
 2) no NoMethodError should be thrown during dispatch

Change-Id: Ia3cb322dd533a414c9bba1cb51dc51d8f90cbf7b
Reviewed-on: https://gerrit.instructure.com/70976
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2016-01-27 18:28:28 +00:00
Jonathan Featherstone 0db9ae3260 Add notification failure processor
Using the new notification_service allows us to provide more specific
failure feedback to canvas.  When we enqueue a message to the
notification service, we pass along the canvas global message id.  If
the message fails to send, we enqueue a failure message to a
"notification_failure" sqs queue, and reference the global message id.
This allows us to write failure information off to the canvas message
object and put it into an error state.

Test Plan:
  * Start local fake_sqs environment

If using docker
`$ docker pull feathj/fake-sqs`
`$ docker run -it -p 9494:9494 -e VIRTUAL_HOST=sqs.docker feathj/fake-sqs`

If running native
`$ gem install fake_sqs`
`$ fake_sqs`

  * Create `<canvas>/config/notification_failures.yml` file and place
    the following in it:

If using docker
```
development:
  use_ssl: false
  sqs_endpoint: sqs.docker
  sqs_port: 9494
  access_key_id: access key id
  secret_access_key: secret access key
```

If running native
```
development:
  use_ssl: false
  sqs_endpoint: localhost
  sqs_port: 4568
  access_key_id: access key id
  secret_access_key: secret access key
```

  * Create a canvas message to put in error state
    * Login to canvas
    * Create new conversation message
    * Open rails console and confirm that message.state is not
      "transmission_error", also take note of message id
  * Start canvas jobs, from canvas-lms directory:
`$ bundle exec script/delayed_job run`

  * Manually enqueue failure message to fake_sqs
```
require 'yaml'
require 'aws-sdk'
require 'aws-sdk-core'
require 'aws-sdk-resources'
require 'aws-sdk-v1'

client = AWS::SQS::Client.new(
  use_ssl: false,
  sqs_endpoint: '<YOUR_SQS_HOST>',
  sqs_port: <YOUR_SQS_PORT>,
  access_key_id: 'access key id',
  secret_access_key: 'secret access key'
)
client.create_queue(queue_name: 'notification-service-failures') rescue
nil
queue_url = client
  .list_queues[:queue_urls]
  .reject { |queue| /dead/i.match(queue) }
  .detect { |queue| /notification-service-failures/.match(queue) }

puts queue_url
puts client.send_message(queue_url: queue_url, message_body: {
  'global_id' => <YOUR_MESSAGE_ID>,
  'error' => 'the message failed to send amigo'
}.to_json)
```
  * Verify that message is state is set to "transmission_error" and the
    transmission_errors field has your error message

closes CNVS-26442

Change-Id: Ic379142727d4e186ae3032241caca1b1e4c5e074
Reviewed-on: https://gerrit.instructure.com/70447
Reviewed-by: Christina Wuest <cwuest@instructure.com>
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Jonathan Featherstone <jfeatherstone@instructure.com>
2016-01-22 19:23:55 +00:00
Steven Burnett e7b4a339b3 fix error handling with notifications sqs queue
fixes CNVS-25481

Test-Plan:
- change the sqs queue in a way to cause a failure.  Notice
  message object reports as such and error is logged

Change-Id: I5ac0b9ac720b41546aa605e835b3badcfbbd17fa
Reviewed-on: https://gerrit.instructure.com/70262
Reviewed-by: Alex Boyd <aboyd@instructure.com>
Tested-by: Jenkins
Product-Review: Gentry Beckmann <gbeckmann@instructure.com>
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
2016-01-18 23:41:01 +00:00
Cody Cutrer 43c561d2d3 rip out more polymorphic shims
Change-Id: Ie93eb06d746aa2f6968b0e29e1d22dfb2242c12f
Reviewed-on: https://gerrit.instructure.com/69683
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2016-01-11 17:40:03 +00:00
Rob Orton 1ab5012f0b validate message data to prevent db errors
fixes CNVS-21253

test plan
 - specs should pass

Change-Id: Ie35bf34ed1f954404b86ca7048e8631b23965d67
Reviewed-on: https://gerrit.instructure.com/69156
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2015-12-18 23:48:05 +00:00
Simon Williams 922b188051 improve wording around links in plain text message templates
prefer wording like "clicking this link: %{link}" over "clicking the
link below" or "clicking the following link"

fixes CNVS-24646

test plan:
- verify that the following notifications work when delivered as plain
  text (not html) email:
    added_to_conversation
    announcement_reply
    conversation_created
    conversation_message
    group_membership_accepted
    group_membership_rejected
    new_context_group_membership
    new_context_group_membership_invitation
    new_discussion_entry
    new_student_organized_group
    peer_review_invitation
    submission_comment
    submission_comment_for_teacher
- also verify that peer_review_invivataion works when delivered as an
  sms or in a summary email (again plain text)

Change-Id: I6d36f797de3a3162fa27a4ce3f7cc423a85e3ff7
Reviewed-on: https://gerrit.instructure.com/66079
Tested-by: Jenkins
QA-Review: Adrian Russell <arussell@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Product-Review: Allison Weiss <allison@instructure.com>
2015-12-18 20:28:30 +00:00
Andrew Butterfield 372b823b73 Default to root account time zone if user time zone is nil
fixes CNVS-22991

Test plan:
* Follow steps to reproduce in ticket
* Ensure that when a user has a nil time zone the notification time
  defaults to the root accounts time zone

Change-Id: I6a0bf368939fbed08542045233778cb8bcdf3109
Reviewed-on: https://gerrit.instructure.com/67864
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins
QA-Review: Adrian Russell <arussell@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2015-12-02 22:09:49 +00:00
Steven Burnett 526523d32d add feature flag and config for notification service
fixes CNVS-24729

Test Plan:
- start canvas
- turn on feature flag at course level
- run `bundle exec script/delayed_job run` to start delayed jobs
- generate any notification
- notice it is processed by the service

Change-Id: I6b4258128c7ce815ec3dcd1fec5aca8771fb75ee
Reviewed-on: https://gerrit.instructure.com/67614
Reviewed-by: Jonathan Featherstone <jfeatherstone@instructure.com>
QA-Review: Gentry Beckmann <gbeckmann@instructure.com>
Tested-by: Jenkins
Product-Review: Steven Burnett <sburnett@instructure.com>
2015-12-01 20:14:24 +00:00
Alex Boyd 17fd70a35f Try to send messages from the recipient's country
Fixes CNVS-24733

Test plan:
 - Set up config/twilio.yml
 - Ensure that your Twilio account owns phone numbers in the U.S.
   and phone numbers in at least one other country
 - Enable both the "International SMS" and "International SMS -
   Send from Recipient's Country" feature flags on the account
   you'll be working with
 - Add a phone number in the U.S. to your profile
 - Cause a notification to be sent to this phone number
 - Ensure that the text message you receive is from one of the
   U.S. phone numbers
 - Add a phone number in a country in which your Twilio account
   owns outbound phone numbers to your profile
 - Cause a notification to be sent to this phone number
 - Ensure that the text message you receive is from one of the
   phone numbers in this country
 - Add a phone number in a country in which your Twilio account
   does not own any outbound numbers
 - Cause a notification to be sent to this phone number
 - Ensure that the text message you receive is from one of the
   U.S. phone numbers
 - Disable the "International SMS - Send from Recipient's
   Country" feature flag
 - Repeat the above steps, but ensure that all text messages to
   all phone numbers are sent from a U.S. phone number

Change-Id: I65b4a7c2e201f8afc5e6068ad80a3b4f9ce8710c
Reviewed-on: https://gerrit.instructure.com/66320
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Tested-by: Jenkins
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Allison Weiss <allison@instructure.com>
2015-11-13 18:16:34 +00:00
Jeremy Stanley 9aff943389 use course nicknames in notifications
test plan:
 - set up multiple users in a course
 - give some of these users different nicknames for the course
 - set up and confirm communication channels for these users
 - do things that cause notification messages to be dispatched
   to the users
 - ensure each user sees the correct course name in his/her
   notification messages

closes CNVS-24168

Change-Id: Ic49c888ae86b40ba42004e3c2dbc205e49480b79
Reviewed-on: https://gerrit.instructure.com/65544
Reviewed-by: Clay Diffrient <cdiffrient@instructure.com>
Tested-by: Jenkins
QA-Review: Ryan Allen <rallen@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2015-10-27 20:04:25 +00:00
Brandon Broschinsky 3822474b96 update email notification for peer review to be anonymous
*Test Plan
Create an assignment with anonymous peer reviews enabled
create two students
set one student up as a peer reviewer of other
as first student submit assignment
as student two peer review assignment
make sure peer review notifications show anonymous

Change-Id: If1a474192504a26ca09f4086514900809bdb6d81
fixes: PFS-2581
Reviewed-on: https://gerrit.instructure.com/62432
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Product-Review: Allison Weiss <allison@instructure.com>
2015-09-14 21:19:20 +00:00
Alex Boyd 0fc41e8d5a Send messages via Twilio
Fixes CNVS-21548, CNVS-20625, CNVS-21580

Test plan:
 - Copy config/twilio.yml.example to config/twilio.yml
 - Configure config/twilio.yml with credentials from a Twilio
   account
 - Create a user
 - Enable the international_sms feature flag for the account
   of the user you created
 - Create a communication channel from a Rails console, using
   a phone number with which you can test. Assuming
   1-801-555-0100 as the phone number, and assuming that the
   id of the user that you created is 42, you can do that with:
     User.find(42).communication_channels.create!(
       path_type: 'sms', path: '+18015550100')
 - As a site admin, confirm the user's communication channel
 - Cause a notification to be sent to the user
 - Ensure that you receive a text message
 - Multiple outbound numbers (will need a paid Twilio account
   to test):
   - Configure config/twilio.yml with credentials from a
     Twilio account that has multiple outbound phone numbers
   - Create multiple users and add new phone numbers for each
     using the above steps, and confirm them
   - Cause notifications to be generated for each user and
     ensure that they come from different phone numbers
     - You may need to test several phone numbers before a
       notification is sent from a different number
   - Cause more notifications to be sent and ensure that each
     phone number receives notifications from the same
     outbound phone number every time

Change-Id: I103c93a8096acaaabd29530b0a0b5c43bc05c26b
Reviewed-on: https://gerrit.instructure.com/59901
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Heath Hales <hhales@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2015-09-14 15:46:23 +00:00
James Williams 600165e7b2 rails4: deprecate Relation#all in favor of Relation#to_a
refs #CNVS-21596

Change-Id: I5dedaab90a2abe6bf288ff30401c9b31629b45b2
Reviewed-on: https://gerrit.instructure.com/59220
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-24 21:28:14 +00:00
Matthew Wheeler b0b783149c Change Messages table url column to text
Fixes CNVS-21253

Test plan:
Tests pass (manual QA is N/A)

Change-Id: Iba5634b948e5857682cf574bf93160893f107461
Reviewed-on: https://gerrit.instructure.com/58351
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Reviewed-by: Joel Hough <joel@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Matthew Wheeler <mwheeler@instructure.com>
2015-07-14 16:38:50 +00:00
James Williams ab7954f593 rails4: fix message processing
refs #CNVS-21596

Change-Id: I224152dc5bbb676474c8bbca4abb8cd5988f63c8
Reviewed-on: https://gerrit.instructure.com/57983
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-13 15:22:47 +00:00
Ethan Vizitei e85ae442d2 pick sis pseudonym reliably
closes CNVS-15282

Previously for users that have multiple pseudonyms,
the "sis_pseudonym" might be selected differently depending
on whether the pseudonyms collection was already loaded or not
because no specific order clause was given.  This patchset
makes it so that all sis pseudonym selection strategies
order the data set the same way (by "unique id") so that
you can count on getting a deterministic result.

Also, user.rb is huge, so I took the opportunity to split out a
SisPsuedonym class.  There may be room to move more
functionality into it later liked deciding what pseudonym to
fall back to in cases where the current strategy finds
nothing, but this is a good first step.  I switched all the use
cases I could find of the old interface on user.rb, but left the
method in place for now in case other plugins or extensions make use of
it.  We can wait a while and let the deprecation warnings take effect
before removing it.

TEST PLAN:
 1) download a gradebook csv export for a course
 2) make sure the SIS Login ID is the same as the secondary
   ID for each user that you see in the gradebook view itself.

Change-Id: Ib18b40acbaf3a8f4352fd6ee8e0826897e3edf49
Reviewed-on: https://gerrit.instructure.com/57001
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2015-06-25 22:18:14 +00:00
Strand McCutchen 19271f0521 cleanup refactor of Rubocop's Style/WhileUntilDo
fixes CNVS-20009

Prefer while/until without `do`s.

This cleanup refactor was automatically generated using
this command:

  `rubocop $(find . -name '*.rb') --only Style/WhileUntilDo --auto-correct`

These code changes were autocorrected then reviewed.

Change-Id: Ie78f62c0caea4e154339365e2ad207d77cde967c
Reviewed-on: https://gerrit.instructure.com/53001
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
2015-04-28 18:37:29 +00:00
Ethan Vizitei 1004e66540 get sentry into canvas
closes CNVS-6016

No more error reports!  (soon)

this commit builds up sentry integration through the new
Canvas::Errors module, along with other things that need
to happen on every exception.  ErrorReports
should now get pushed towards just being used for representing
a complaint a user filed via the get help form.

I fixed about half the things that got linted as well
while I was in here, but because this touches to much
I fear divergence from tackling too many (I think we
can safely say it's "better than we found it")

I left a lot of the infrastructure for error reports in place
until other commits for plugins can be merged

TEST PLAN:
 1) setup your raven.yml config file with the dsn for our
  sentry install
 2) force an error to happen in a request response cycle.
 3) see the error in sentry
 4) force an error to happen in a job
 5) see the error in sentry
 6) statsd increments shoudl still fire
 7) for the moment, an error report should still get created.

Change-Id: I5a9dc7214598f8d5083451fd15f0423f8f939034
Reviewed-on: https://gerrit.instructure.com/51621
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-04-13 22:26:15 +00:00
Cody Cutrer 9834937c8c don't autorequire a bunch of gems that are rarely used
Change-Id: I09ed3686629b62849d392684d587f30cb2047013
Reviewed-on: https://gerrit.instructure.com/51853
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-04-09 18:47:50 +00:00
Joel Hough 942fec22cf better push notification endpoint handling
fixes CNVS-19286

test plan
- regression test push notifications

multi-user (endpoint stealing) test
- sign up for push notifications with one user
- ensure that they receive push notifications
- sign up for push notifications with another user
- ensure that the new user receives push notifications
- ensure that the first user no longer receives push notifications

Change-Id: I6ffacc065cb0b3c54e5224350a2e7c93c595b8df
Reviewed-on: https://gerrit.instructure.com/50622
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-03-31 21:09:06 +00:00
Joel Hough 439e119492 delete facebook integration
fixes CNVS-18978

test plan
- regression test canvas, particularly:
notifications, and their preferences
communication channels
messages
user ouath (like linkedin and google docs use)
avatars
profile page
user services (like twitter)
feature settings
context roster

Change-Id: I2d53125f76c9daf912fdeabc621c90ac1bd070df
Reviewed-on: https://gerrit.instructure.com/49267
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-03-30 20:21:58 +00:00
Joel Hough 8f3b4f8864 send push notifications to apns sandbox
fixes CNVS-18871

test plan
- send a push notification to an apns sandbox device

Change-Id: I4d4a3b9e8213e46f5eb0bfb33b575e296561af15
Reviewed-on: https://gerrit.instructure.com/49452
Reviewed-by: Miles Wright <mwright@instructure.com>
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-02-26 17:32:46 +00:00
Dave Donahue 3b6f8baffb custom e-mail logo setting
refs CAT-884

Test plan:
 1. Change the settings on a given root account to have
    a custom e-mail logo:
    a = Account.find(1)
    a.settings[:email_logo] = "http://some-cool-logo.jpg"
    a.save
 2. Trigger an e-mail alert on an event on that account
    (for instance, adding a new account admin - but it's
    worth testing several different e-mail alerts).
 3. Ensure the custom logo displays instead of the Canvas
    logo.
 4. Ensure that when a custom e-mail logo is not configured,
    the Canvas logo is rendered.

Change-Id: I37c29308dfb5404e94507c2d35872cf8609040b2
Reviewed-on: https://gerrit.instructure.com/48983
Tested-by: Jenkins
Reviewed-by: Ethan Gunderson <egunderson@instructure.com>
Reviewed-by: Jeff Belser <jbelser@instructure.com>
Product-Review: Jeff Belser <jbelser@instructure.com>
Tested-by: Jeff Belser <jbelser@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
2015-02-19 21:54:22 +00:00
Cody Cutrer d6312b7e0d use url helpers in messages
fixes CNVS-11838

and then choose the host more intelligently to use one the user
can actually log in to

test plan
- have accounts on two shards, referred to as "account 1" and
 "account 2" from now on
- have account domains that are resolvable for the accounts,
 referred to as account1.canvas.dev and account2.canvas.dev from
 now on
- have account 2 trust account 1 by POSTing to
 account2.canvas.dev/api/v1/accounts/<account 2 id>/trust_links
 with a site admin's auth token and setting
 trust_link[managing_account_id] to account 1's global id.
 you can now use users from account 1 on account 2

- regression test notifications, especially considering
 notifications generated by account 2 that are sent to account 1
 users.
- account 1 users should have links that use account1.canvas.dev
 and have global ids for referenced objects that live on
 account 2's shard,
 e.g. account1.canvas.dev/courses/2~1/discussion_topics/2~30
- avatars should use the avatar owner's account domain
- account 2 users should have links that use account2.canvas.dev
 and have local ids,
 e.g. account2.canvas.dev/courses/1/discussion_topics/30
- following the links when the user receiving the notification is
 logged in should take the user to the linked object
- following the links when not logged in should take the user to
 a login page that they are able to log in to
- be sure to at least check:
 context file downloads links (e.g. discussion topic attachments)
 file downloads links (e.g. conversation message attachments)
 avatars links
 conversation notifications
 discussion notifications
 peer review notifications

Change-Id: Idebd247fee99a2b973d3fa6f4f2fca0e723d99a5
Reviewed-on: https://gerrit.instructure.com/31867
Tested-by: Jenkins
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-02-18 23:07:57 +00:00
Rob Orton b1244f27f3 change and validate length of attributes on message
test plan
 - should not get a db error when to: is longer than 255 char

Change-Id: I55c697b3a0848cf700ecb4a19ef7447a643e0a64
Reviewed-on: https://gerrit.instructure.com/48157
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2015-02-18 19:39:15 +00:00
Joel Hough 28d82fa793 push notifications
fixes CNVS-7398

test plan
- using canvas mobile app with push notification support, enable
 push notifications
- cause a notification to be sent from the canvas web ui
- ensure that the canvas app gets a notification

Change-Id: Idb320520a23ba6c5c2649253da557160be54084a
Reviewed-on: https://gerrit.instructure.com/42892
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-01-15 22:19:24 +00:00
Joel Hough 82d0751897 yo integration
Fixes CNVS-16494

test plan
- configure yo plugin with an api token
- configure a user's yo service with their yo username
 (you'll need to install the yo app and register a user)
- set yo notification preferences to asap
- cause a notification to be sent
- ensure canvas yo's you
- ensure the yo link links back to canvas

Change-Id: I36ed467ed19842c2e92285ae20a3553272698f22
Reviewed-on: https://gerrit.instructure.com/42896
Product-Review: Joel Hough <joel@instructure.com>
QA-Review: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
2014-11-03 22:53:39 +00:00
Cody Cutrer 95ecf20e73 use Rails' base_class
and remove base_ar_class, that does the same thing

Change-Id: Id76a2dcc375cfea397ff4b4853f50d660b6b044c
Reviewed-on: https://gerrit.instructure.com/41783
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 21:14:22 +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 c14f18cb85 account setting for author email in notifications
fixes CNVS-15348

test plan
- send a conversation message
- ensure that the notification does not include the author's email
 address
- in the account's settings page, check "Show the email address of
 sender for user interaction Notifications"
- send another conversation message
- ensure that the notification includes the author's email address

Change-Id: I2816d82fb2f6413d1c2c972296a758b571fb03de
Reviewed-on: https://gerrit.instructure.com/40766
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Janelle Seegmiller <jseegmiller@instructure.com>
Reviewed-by: Mark Severson <markse@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2014-09-10 19:57:52 +00:00
Cody Cutrer 5f4dcccff4 avoid extraneous queries to Notification
just use the cached .all, even for associations

test plan:
 * go to the notification preferences page as a user
 * in console
   * np = NotificationPolicy.first; np.notification
   * the first time, it should query notification_policy,
     and *all* notifications
   * do it again, and this time it should not query
     notifications, but should still return an object

Change-Id: I3b83ec9ce6f6f6b4d542e83d2b8653b4e221afd4
Reviewed-on: https://gerrit.instructure.com/40460
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-09-09 21:54:16 +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 0c80487238 use absolute url for avatar in notifications
fixes CNVS-14251

test plan
- cause a notification with an avatar to be sent (discussion,
 conversation, or submission comment)
- ensure that the avatar image src attribute is an absolute url

Change-Id: I6992de1f4b83ecfdf838725a42e09feb1ca5e1c9
Reviewed-on: https://gerrit.instructure.com/37729
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
Tested-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2014-07-18 14:18:25 +00:00
Cody Cutrer 1277aaae90 stabby lambda scopes for rails4
Change-Id: I34f2527471cdb4d8cab5cde426ba959baa26189e
Reviewed-on: https://gerrit.instructure.com/37151
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-07-04 02:11:56 +00:00
Cody Cutrer f3e3920a0c fix message delivery in ruby 2
Change-Id: I9f087757431d69e9d0fb1c1890f05c89c141fb7a
Reviewed-on: https://gerrit.instructure.com/36845
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-06-25 16:32:29 +00:00
Ethan Vizitei 39a35ab09e Use source user as "FROM" for emails
This gives certain user-triggered events
a "look" as though they came directly from
that user (the FROM and REPLY-TO headers
have the name of the source user).

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

closes: CNVS-11837

TEST PLAN:

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

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

Change-Id: I0e04aa9aa5bf31a590e69507e04b86b637247acf
Conflicts:
	app/models/message.rb
Reviewed-on: https://gerrit.instructure.com/35362
Reviewed-by: Drew Bowman <dbowman@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-05-31 01:02:14 +00:00
Jayce Higgins d5af57e0bc Better formatting for emails and add avatar for conversations
Fixes: CNVS-12970

We needed an avatar and signature for notifications
sent out via conversations. Also reformatted all the
notifications to take on a cleaner and more easy to
read format.

The majority of testing can be done on the conversation
notifications. I was using letter opener to do this.
I have included letter opener and the relevant setup
stuff in this commit so that it can be tested.

Test-Plan:
-Make sure that your organization has allowed avatars
-Give a student or a teacher an avatar
-Send a conversation message to another user from
  the user that has an avatar
-If you have letter_opener installed, the email
  should be intercepted and you'll see its formatting.
  Otherwise, use whatever method you'd like to view
  the email.
-Verify that everything looks alright and we have
  an avatar and good formatting.

-STEP 2-
-Disable avatars
-Send another email and verify that the avatar isn't
  showing up

Change-Id: I876dc119c5daefa10811c75c08b315722a50f63d
Reviewed-on: https://gerrit.instructure.com/35144
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-05-30 23:24:03 +00:00
Anthus Williams c247a3758d remove some of the less useful associations from export
delayed_messages, exports, imports, migrations,
stream_items, etc.

Change-Id: I6eb63457ad496d7aaf56fc9ec8a9602a5679fdd7
Reviewed-on: https://gerrit.instructure.com/35215
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-27 15:44:00 +00:00
James Williams 7f6fbcbf62 don't escape message subjects
test plan:
* create an asset (such as an assignment) that includes
characters such as quotes, ampersands and brackets.
(e.g. "<stuff> &that's html escaped")
* create a notification for the asset (such as an
"Assignment Created" message)
* confirm that the message subject is not escaped
(e.g. "&lt;stuff&gt; &amp;that&#x27;s html escaped")

fixes #CNVS-11652

Change-Id: I23a4529b7e582a8a5f725f965d96c79748e762b7
Reviewed-on: https://gerrit.instructure.com/34796
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-05-19 16:51:49 +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
Joseph Rodriguez 2d9cfc5ac4 moved Facebook code into gem
fixes: CNVS-12120

test plan:
- regression test facebook functionality

Change-Id: I041e726ee12f9eca8fc27ccdd049422073d1af15
Reviewed-on: https://gerrit.instructure.com/33595
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-05-05 22:32:15 +00:00
Joseph Rodriguez 02761bce6f pull canvas specific code out of Facebook class
fixes: CNVS-12520

test plan:
- regression test facebook functionality

Change-Id: I0016edccd3186e7d55146bf216ec2b07a369c801
Reviewed-on: https://gerrit.instructure.com/33531
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-05-05 22:32:07 +00:00
Raphael Weiner a13f85e0ed move twitter to gem
fixes: CNVS-12492

test-plan:
* Test that all things Twitter related still work

Change-Id: Ib656c5bfcb2dc8490a6fa6f214b0f6dce25ad181
Reviewed-on: https://gerrit.instructure.com/33193
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: Liz Abinante <labinante@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-05-05 20:08:27 +00:00
Nathan Mills 8eeb4f5bf0 refactor twitter to not be a mixin
fixes: CNVS-12118

test-plan:
*twitter integration should work

Change-Id: I44a9011eb451aaa8eb196264bb4b65d1635da083
Reviewed-on: https://gerrit.instructure.com/33065
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: Liz Abinante <labinante@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-05-05 20:08:17 +00:00
Braden Anderson 34c2f55089 rails3: fix message email html
fixes CNVS-12213

test plan:
  * launch Rails 3
  * trigger a notification email
  * view it in /messages
  * verify that it looks the same as Rails 2 emails

Change-Id: I86526453c92e489f5f18002c3fe4adb55ddacf56
Reviewed-on: https://gerrit.instructure.com/32888
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Braden Anderson <banderson@instructure.com>
2014-04-04 22:25:48 +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
Joshua Simpson ae814421e0 namespace all of quiz into quizzes module
This commit namespaces the rest of quiz related code into a Quizzes
namespace: controllers, views, models, and classes that previously lived
under lib/ that are Quiz-related.

Test plan:

Full regression test on all quiz related items

refs CNVS-10457

Change-Id: If54b61213945056539e03271a936d233abb66188
Reviewed-on: https://gerrit.instructure.com/29351
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-02-18 22:17:13 +00:00
Cameron Matheson 67647ce982 rails3: second attempt at fixing erubis
Change-Id: I3bba2799e20fdd52efe6a16b1276d5cfac74419f
Reviewed-on: https://gerrit.instructure.com/30013
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
QA-Review: Cameron Matheson <cameron@instructure.com>
2014-02-13 19:12:41 +00:00
Raphael Weiner 6ae716da73 extracted html text helper methods into gem
test plan:
  * run specs

Change-Id: I8bd463396aee14853bdcf552eef144a509ffb62a
Reviewed-on: https://gerrit.instructure.com/29613
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-02-07 20:11:19 +00:00
Cody Cutrer e87f947d21 rename Mailer#message
in Rails 3, there's another method with the same name

also fix some specs that check the underlying delivery method

Change-Id: I1e318a280420ea5872b7e4dca097a2b68a0a69e7
Reviewed-on: https://gerrit.instructure.com/28742
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-01-21 20:15:28 +00:00
James Williams b9eddb6b24 use self.user instead of @user in message for rails 3 compatibility
Change-Id: Iac4e81744bb89a73c6a0dc8414d503f59e54df2a
Reviewed-on: https://gerrit.instructure.com/28425
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-14 13:24:57 +00:00
James Williams 51b12ec859 fix Message#define_content template helper for rails 3
Change-Id: Ib51c6521f918d216612df74cf7e156dd95a74f2a
Reviewed-on: https://gerrit.instructure.com/28427
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-14 13:12:49 +00:00
Zach Pendleton f5ee7dbfc3 remove tinychat code
fixes CNVS-10058

canvas no longer integrates with tinychat; this commit
removes legacy references to it.

test plan:
  * run specs

Change-Id: I4887e901d57ff39f8554af3e4eacd52ec4edd6e5
Reviewed-on: https://gerrit.instructure.com/27621
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Braden Anderson <banderson@instructure.com>
Product-Review: Zach Pendleton <zachp@instructure.com>
2013-12-18 22:51:45 +00:00
Jacob Fugal a888abbdf4 don't include ActionController::UrlWriter w/rails3
refs CNVS-9166

include Rails.application.routes.url_helpers instead

(in most of these, should be refactored to not include those either, but
not going down that rabbit hole in this commit.)

Change-Id: I3a7091ac604c811d9b7ad2777c289fc8c6477822
test-plan: N/A
Reviewed-on: https://gerrit.instructure.com/25725
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2013-10-29 15:50:39 +00:00
Jacob Fugal 2bcb852a18 convert app/models/mailer.rb for rails3
fixes CNVS-8732

makes Mailer#message act in the rails3 style, but then provides
scaffolding so that it produces the necessary rails2 behavior when
running under rails2

test-plan:
 * email delivery needs to be configured
 * set up an email communication channel for a student
 * configure to receive conversation alerts at that channel
 * have a teacher send a conversation message to that student
 * confirm receipt of the email at the student's address

Change-Id: I7f027a0a9a9dfd0231847017c888f1003b38d948
Reviewed-on: https://gerrit.instructure.com/25035
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2013-10-15 21:17:42 +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
Jon Jensen f493cb21df use correct i18n scope for html emails, fixes CNVS-6829
fixes an issue where the wrong translation could be used, or worse,
a crash (e.g. if an interpolation argument was missing)

test plan:
1. change the course language to French
2. invite a student to the course
3. go to /user/:id/messages
4. the message should have been sent
5. the html version email should have the website domain name, e.g.
   "Vous avez été invité à participer à une classe sur localhost"

Change-Id: Ie5ba87ff37f6b96acb814b8810ed2ed7cd44e03d
Reviewed-on: https://gerrit.instructure.com/22233
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
2013-07-11 22:21:45 +00:00
Eric Berry acfe36bcc5 twitter link sending to correct url
fixes CNVS-5147

test steps:
- trigger a twitter notification and ensure the link is pointing to
  the correct url (without 'mr' in the url)

Change-Id: Ib70b67039e919720c941c15ec1d20eca652d478b
Reviewed-on: https://gerrit.instructure.com/19882
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-04-26 16:02:03 +00:00
Jon Jensen b2507982f5 restore footer in plaintext emails, fix host in html email footer link
fixes CNVS-5421

the plaintext footer broke in e01a6d14

additionally, html emails always link to HostUrl.default_host, which
usually will not be correct

test plan:
1. do something that triggers an email notification
2. look at the plaintext version of it
3. it should have a footer with a link to set your communication prefs
4. the html email should also have a footer with a link, and it should
   point to the correct host for your user

Change-Id: Ie4109b6d2b40a018e22e85522a5cd749fac633aa
Reviewed-on: https://gerrit.instructure.com/19836
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
2013-04-25 16:26:08 +00:00
Jon Jensen d9f5c589da use RailsXss::Erubis for html email templates, fixes CNVS-5414
prevent malicious or accidental html content from getting through (e.g.
via translations or interpolated user content).

slight refactor in message.rb to make it more easily testable

test plan:
1. spot check html emails, make sure they look ok
2. ensure you can't get arbitrary html into an email, e.g.
   1. change your name in canvas to "<b>ZOMG</b>"
   2. send someone a message in canvasations
   3. check the html email that got sent to them. your name should appear
      as "<b>ZOMG</b>", and not "ZOMG" in bold text

Change-Id: Ie638a0d3d28427f25c0fa1ce89c10533802b0c6b
Reviewed-on: https://gerrit.instructure.com/19827
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-04-23 16:56:53 +00:00
Jon Willesen 495db783d5 Add API for admins to access user messages
There are three parts to this:
 - API access for site admins and account admins. Account
   admins can only see messages for their account.
 - Includes start and end time parameters for basic searching
 - Summary notification are gathered up per account now, so
   account admins will not see a summary notification from
   multiple accounts.

fixes CNVS-3695

test plan:
 - Verify Admin Access:
   - Have a user enrolled in two courses in separate root
     accounts.
   - Send the user ASAP notification from each account.
   - Go to /users/:id/messages (the old interface) and verify
     the messages appear there.
   - As a site admin, get /api/v1/comm_messages for the user
     (see documentation for the api).
   - Verify that data for both messages are returned.
   - Use the console to give an account admin on one of the
     accounts :read_messages permissions.
   - As the account admin, get /api/v1/comm_messages for the
     user.
   - Verify that only the message for the admin's account is
     returned.
 - Verify start_time and end_time parameters
   - Use the console to modify the created_at field for the
     user's messages
   - As a site admin, get /api/v1/comm_messages for the user,
     specifying various combinations of start_time and
     end_time, and make sure the appropriate messages are
     returned.
 - Verify account based summaries
   - Set the notification policies for the user to a summary
     setting (daily or weekly)
   - Send multiple notifications to the user from each account.
   - Use the console to run the
     SummaryMessageConsolidator::process function.
   - View /messages for the user and verify that separate
     summaries are sent for each account.

Change-Id: Ie33ec02cc2033a1cc2f1fcbe538b76792aab0e6c
Reviewed-on: https://gerrit.instructure.com/18586
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
2013-04-11 19:38:02 +00:00
Eric Berry ffd0fe56c3 HTMLify the outbound email messages and update the /messages UI
All of the outbound email notifications have been updated to have
a matching HTML version of the email in order for us to send multi-
part emails. There has also been some tweaking of the other email
messages (summary, plain text, etc) with a better looking layout

fixes CNVS-4728
fixes CNVS-4795

test steps:
- generate email messages for each template and review the results
  in the users message list view (/users/1/messages)

Change-Id: I1fd9cf2b134209e42c8d174f19b50963e6502f6a
Reviewed-on: https://gerrit.instructure.com/18942
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Product-Review: Eric Berry <ericb@instructure.com>
2013-04-03 20:03:34 +00:00
Cody Cutrer 8c94e53dc7 arel-ify scopes
s/named_scope/scope/g

refs CNVS-4707

Change-Id: I930d229fc9985c7c0096a0f4888933addd4f3aee
Reviewed-on: https://gerrit.instructure.com/18834
Reviewed-by: Duane Johnson <duane@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 21:57:16 +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
Joel Hough aaa9fa0115 refactored Notification::create_message
fixes CNVS-3953

test plan
- ensure that notifications work the same as they used to

Change-Id: I55e3e7893b57e47b009d89d66f2d027246a29897
Reviewed-on: https://gerrit.instructure.com/18151
Reviewed-by: Eric Berry <ericb@instructure.com>
Tested-by: Eric Berry <ericb@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-03-01 17:27:45 -07:00
Zach Pendleton 6f01c7cfcd fix deliver_via_email for ruby 1.8.
fixes CNVS-4196

Timeout::Error doesn't inherit from StandardError in
< 1.9, causing some exceptions to not be properly handled
in deliver_via_email.

test plan:
  * run spec/lib/message_dispatcher_spec.rb with ruby 1.8
    and verify that specs pass.

Change-Id: I233c62a5960e27804ef37f529512bb39b8746239
Reviewed-on: https://gerrit.instructure.com/18079
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Tested-by: Eric Berry <ericb@instructure.com>
2013-02-28 08:37:59 -07:00
Zach Pendleton 55f1fa66ea add multiple reply-to support to outgoing mail.
fixes CNVS-2514

allow multiple reply-to addresses that will be rotated
across when sending mail. this commit, in conjunction with
CNVS-3781, allows canvas to receive mail from multiple
inboxes and distribute its incoming mail across them.

test plan:
  * configure config/outgoing_mail.yml with multiple
    reply_to_addresses as explained in
    config/outgoing_mail.yml.example;
  * trigger at least n notifications for a user in canvas,
    where n is the number of reply_to_addresses configured;
  * visit /user/:id/messages and verify that each message
    is sent from a different reply_to address.

Change-Id: I53c01c7c355dcbf7c16595070f41eee721814849
Reviewed-on: https://gerrit.instructure.com/17870
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Zach Pendleton <zachp@instructure.com>
2013-02-22 14:02:27 -07:00
Zach Pendleton dbb259e62d support html emails.
fixes CNVS-65, CNVS-3921

test plan:
  * copy app/messages/new_discussion_entry.email.erb to
    /app/messages/new_discussion_entry.email.html.erb;
  * create a new discussion in a class with at least two
    users (who have their discussion entry notifications
    set to "immediately");
  * as user 1, post a reply to the discussion;
  * verify that user 2 receives a multipart email with
    an html part and a plaintext part.

Change-Id: I30e3e15fa53817767c770491ab8c19286281e0aa
Reviewed-on: https://gerrit.instructure.com/17964
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-02-22 12:37:36 -07:00
Eric Berry e01a6d14d0 Refactored Message#parse! and added additional specs
fixes CNVS-3924

test steps:
- Review the message.rb model changes
- Perform the spec tests on message_spec.rb

Change-Id: Ia095c4d09db0314c0ae1f48523fe8d5f642f8935
Reviewed-on: https://gerrit.instructure.com/17895
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-02-21 14:46:05 -07:00
Zach Pendleton aa04069591 document message.rb to help w/ future clean-up.
Change-Id: Iebc80221e7ea05b84f08ae52a24e60b13c6146f9
Reviewed-on: https://gerrit.instructure.com/17683
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Tested-by: Eric Berry <ericb@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-02-21 10:39:37 -07:00
Brian Palmer d118c9ede1 don't log an ErrorReport for 450 Recipient address rejected
This isn't an actionable error. Though at some point it'd be nice to
display a message to the user if their emails are consistently failing.

Change-Id: Ia760214c355976592373404b03a41d9ff64034e7
Reviewed-on: https://gerrit.instructure.com/16566
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-02-12 17:45:10 -07:00
Ethan Vizitei 2529ce88f3 Better signatures for message redirects
refs #CNVS-1833

This creates a signature policy that
prevents you from just being able to guess
the next id of another message and navigate
to it.  Also moved twitter messaging
responsibility out of the message persistence
object.

TEST PLAN:
  1) take any message and get the sig for it:
   in the console run:
     msg = Message.last
     AssetSignature.generate(Message.last)

  2) take the resulting signature and login to
the system, then use the url bar to navigate to
  "/mr/[signature]"

  3) you should get redirected to the message
   url properly
 
  4) now try changing the signature. Leave the ID
   alone, but change a few characters in the 
   hmac at the end, and you should no longer get
   redirected properly but should instead be
   taken to the default redirect.
Change-Id: I881e047341d16ba7e422dc05eae62b9f2a460898
Reviewed-on: https://gerrit.instructure.com/15889
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2012-12-13 12:12:58 -07:00
Zach Pendleton 179af6c9bf pass message data to delayed messages. fixes #CNVS-1286
previously, calls to Notification#record_delayed_messages
on a notification whose template expected data would throw
an error because data was not passed from create_messages.

now data is passed and these messages work as expected.

test plan:
  * create a teacher with appointment notification
    preferences set to daily or weekly;
  * as a student in that teacher's class, sign up for an
    appointment in the scheduler;
  * verify that no error report is created and that the
    teacher's notification is scheduled as expected.

Change-Id: Ie350576add18866bbfd980a9c8316d310f635b7e
Reviewed-on: https://gerrit.instructure.com/15841
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2012-12-11 16:59:49 -07:00
Joel Hough af9f41ed06 don't use "" for from_name when turning off custom from
fixes #11715

Change-Id: Ica0be72877b97a03eeee2fc23409bf3c988072e9
Reviewed-on: https://gerrit.instructure.com/15213
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Reviewed-by: Marc LeGendre <marc@instructure.com>
2012-11-12 12:15:29 -07:00
Mark Ericksen f5f1d6a936 Allow account admins to brand an outgoing email's 'from' field. Fixes #10525
Testing Steps:
===========
* As an account admin, go to account settings
* Use new "Notifications" tab to change the setting
* Change the setting to 'Custom "From" Name' and give a name.
* When email notifications are sent out, the "From" name
   should appear as this name.

Change-Id: I71dc9731b411f8f52a717ba83ce27f8bc43c476e
Reviewed-on: https://gerrit.instructure.com/14689
Reviewed-by: Zach Pendleton <zachp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-01 14:28:35 -06:00
Brian Palmer 70639150ba api: translate absolute paths to full urls with the canvas host
This fixes image links to /equation_images/X, among other things.

As part of this, I refactored the attachment.rb secure setting to be a
domain.yml (HostUrl) setting that can be used app-wide to determine
whether to use http or https when the code doesn't have access to a Request.

Fixes #8784

I also started down the road of having notification emails/sms/etc use
https links instead of http, but there is still work to do there, refs #9190

test plan: Use the rich text editor to post to a discussion or any other
rich text field that can be retrieved via the api, and include an
equation using the equation editor. Then retrieve that post through the
api, and verify that the url to the equation image includes the canvas
hostname and protocol (http://canvas.example.com/equation_images/X
instead of just /equation_images/X)

Change-Id: Iac28bf99d2d3b33c17d5b3eb128aa6d8488570fe
Reviewed-on: https://gerrit.instructure.com/11867
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-07-02 09:53:59 -06:00
Cameron Matheson b9e014ce86 notifications: allow including extra data for messages
refs #7771

This adds a 'data' block to broadcast_policy definitions.  The data
block should return a hash which will be turned into a struct named
'data' that is accessible in the message templates

Change-Id: I3c6d76577a1a1ba0f832669a4196fc8fae609058
Reviewed-on: https://gerrit.instructure.com/9720
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-04-18 17:08:13 -06:00
Cody Cutrer 0a4bae9b84 use global ids for message reply to addresses fixes #7723
test plan:
 * send someone a message on another shard
 * reply to that message
 * it should be added to the conversation

Change-Id: Id4439bd63f8805660d302a04e54bd47f304e29b2
Reviewed-on: https://gerrit.instructure.com/9545
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-03-22 16:34:26 -06:00
Brian Palmer f57f7a674b don't dispatch cancelled messages, fixes #7397
test plan:
  * perform an action that generates a delayed message, like grading an
    assignment
  * change the grade on the assignment to generate another message
  * wait 30 minutes, and very you only got the second message

Change-Id: I7aeccfb9db705ed3403e8927776a039403cabf27
Reviewed-on: https://gerrit.instructure.com/8944
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-24 12:21:21 -07:00
Jon Jensen a41081cf22 fix dashboard notifications for appointments
display stream items for new and updated appointment groups, as well as
when someone signs up another user (e.g. group signup)

removed unused message templates, fixed date_string range to just show a
single date if date parts are the same

test plan:

1. publish an appointment group and ensure all pertinent students get a
dashboard notification
2. add times to an appointment group and ensure all pertinent students
get a dashboard notification
3. sign up a group for a timeslot and ensure all other group members
get a dashboard notification

Change-Id: Id0dec52c0376fb6e14b0f26bb60e4695b25f7591
Reviewed-on: https://gerrit.instructure.com/7938
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2012-01-10 13:40:25 -07:00
Cody Cutrer 2b2f49d66f search for communication channels case insensitively fixes #6750
test plan:
 * create a user via SIS import with an e-mail address
 * add a different e-mail address to the user
 * re-import the user via SIS, and set their e-mail address
   to the second e-mail you added, but with a different case
 * the user should have a single e-mail address, the one set
   in the second SIS import

Change-Id: Iab6b16e0b37cfb8caac3faa453be570b99621a9e
Reviewed-on: https://gerrit.instructure.com/7784
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2011-12-30 19:36:29 -07:00
Jon Jensen f97772ae0d fix wrong hostname in message emails
root account is now tracked as the ConversationMessage#context

this also fixes a bug where these emails didn't include the footer

Change-Id: If5db3839f65fc68625497a7c8d2ee0f0be682115
Reviewed-on: https://gerrit.instructure.com/5246
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-08-24 15:30:37 -06:00
Cody Cutrer caae827136 alerts, closes #4317
* Daily job to evaluate alerts
   * Spawns a new job for each root account (for parallelization).
     It could be broken down to per-course level if needed (i.e.
     if there is a *huge* root account).
   * Evaluating criteria at a course level using efficient queries.
 * UI for CRUD on alerts
   * Render existing alerts
   * Delete existing alerts
   * Create a new alert
   * CRUD for criteria, recipients, repetition
   * Validations
 * Improve instructure_helper's formErrors to support passing errors
   for specific elements
 * Improve Rails' :include to be able to :exclude an :include
   inherited from a named scope
 * Specs!!
 * Note that we want to slowly roll this out, so there is a setting on
   root accounts to enable it

So I ran an alert with just an interaction criterion on a test
cluster against 50,000 courses, and it took less than 10 minutes
without any parallelization.  That seems like acceptable
performance to me (since there are only just over 3000 courses
in production that would even be elligible to have alerts sent
right now).  Of course, that's probably skewed because I'm sure
a bunch of those 50,000 courses were essentially empty.

Change-Id: Ie028ef206c9155b9a72fb2a820f3e0e516de562a
Reviewed-on: https://gerrit.instructure.com/4799
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-08-24 10:19:44 -06:00
JT Olds d5c8be2ca0 allow for configuration of outgoing email name
Change-Id: I87587c291801f39697e8dd691d6be9b3b396b86b
Reviewed-on: https://gerrit.instructure.com/4746
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-07-21 13:33:16 -06:00
Cody Cutrer 3bd7ac199b i18n enrollment_*.erb
also make ERB::Util (ERB::Util#h, specifically) available to messages.

Change-Id: I01621b3564182cacee0e52118cb6e7c5ded71e4b
Reviewed-on: https://gerrit.instructure.com/4493
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-06-30 11:11:28 -06:00
Bracken Mosbacker 6c6147b350 i18n assignment messages
make it stop.

Change-Id: I07ac240d0def58730dc2fe2135605543884158ec
Reviewed-on: https://gerrit.instructure.com/4494
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-06-30 10:42:47 -06:00
Jon Jensen b43dd2fd06 fix overzealous escaping of facebook message html
Change-Id: If849252b4285bfed6e8a14aa11bacfe967a25cc7
Reviewed-on: https://gerrit.instructure.com/4486
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-06-29 17:03:28 -06:00
JT Olds cfab93c9b5 notification category i18n reminders
Change-Id: I034fa38e582f862df27a60c689d592ffff8fa26f
Reviewed-on: https://gerrit.instructure.com/4224
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-06-16 08:49:40 -06:00
Brian Whitmer 2c5c268982 add twitter to notification preferences
Twitter recently stopped offering whitelist
exceptions for things like direct messaging.  We are
trying to work around the limitations by having
a user direct message themselves instead of having
some global account user that direct messages everyone.

Also added a "short_host" method for HostUrl that
in the future we can use to generate short-ish links
to include in tweets.  For now the links are somewhat
short, at least.

refs #4045

Change-Id: Iad59b979b166d572827a8ce16d3f9fcdd57d512d
Reviewed-on: https://gerrit.instructure.com/2938
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-06-14 11:57:48 -06:00
Jon Jensen 58a25bd462 preliminary i18n setup, closes #4124
* i18n key scoping for controller/model/js/etc.
 * inline English translation support
 * rdiscount gem for markdown'ed translations
 * html_safe interpolation tweaks
 * label helpers
 * crummy tweak to translate symbol keys
 * internationalized most of lib, and some plugins/messages
 * conference i18n (view/model/controller/js)

Change-Id: I42772b9e19a110efbe855dc83a681be49ec98df2
Reviewed-on: https://gerrit.instructure.com/4080
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-06-06 14:19:03 -06:00
Cody Cutrer bdbebfaec8 check all models for protecting attributes refs #3847
Change-Id: I7cba6e26ad98e91723e2ccf0a28b8db79bb37b5c
Reviewed-on: https://gerrit.instructure.com/3631
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-25 17:38:50 -06:00
Brian Palmer b657f4e959 generate an error report for all errors, not just some of them
refs #4487

This consolidates our ErrorReport class with our ErrorLogging mechanism,
it's all in ErrorReport now and you call ErrorReport.log_error or
ErrorReport.log_exception to both create an ErrorReport object, and call
the hooks similar to what ErrorLogging did so that plugins for other
error handling mechanisms can be injected.

ErrorReport has a category field now, similar to how ErrorLogging used
to take a type. the /error_reports UI can filter by category.

The plugin interface was designed with Hoptoad integration in mind, but
it should be pretty general.

Change-Id: I59f7a0d44cf4b6215ad13ff92d30e1d1af607b74
Reviewed-on: https://gerrit.instructure.com/3577
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-11 10:36:56 -06:00
Zach Wily d4d138016b mark message as sent when sending to facebook
Change-Id: I72323c86b078023b631710005060d57964a6d9eb
Reviewed-on: https://gerrit.instructure.com/3592
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-11 07:20:58 -06:00
Brian Whitmer 2782f0749c fix for facebook dashboard increment
Change-Id: I5f61d3ac571c20e3b63148b6170fb1d9e214ee38
Reviewed-on: https://gerrit.instructure.com/3588
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-10 22:09:13 -06:00
Brian Whitmer 8dca8a0d19 update facebook integration to oauth 2
This should allow open source installs to now set up
their own Facebook apps if desired.  The facebooker
gem is no longer required and configuration now
happens in a plugin instead of a yml file.

fixes #4509

Change-Id: Iec76dc8c31f0ad0276e992319f368826baa4ccc5
Reviewed-on: https://gerrit.instructure.com/3545
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-10 16:18:23 -06:00
Cody Cutrer 63bad32df0 Handle incoming mails. Closes #4016.
* Uses Mailman gem
 * Can be configured for POP3, Maildir, or stdin (push from mailserver)
 * Maildir can be chained with fetchmail or similar to support IMAP
 * Can be run as part of the job server, or as a separate process

Change-Id: I000000000000000000000000000001
Reviewed-on: https://gerrit.instructure.com/2971
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-04-07 10:46:11 -06:00
Brian Whitmer b17c00abdd set "from_name" to user's name for private messages
Right now emails get sent to users with the from_name
"Instructure Canvas" instead of the sender's name.
In other cases we try to use the course/group name,
so it makes sense to use the user name in this case.

refs #4171

Change-Id: Iec17edfbcf15fb06b089f2556b3b100f78642f9c
Reviewed-on: https://gerrit.instructure.com/2945
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-05 15:28:45 -06:00
Zach Wily 16eecfd4dc fix escaping in messages, refs #3888
It's unnecessary to html unescape the subject and body anymore, as they are
already unescaped.

Change-Id: I10b13805a42c677e1309983c77f1aa62e56e8578
Reviewed-on: https://gerrit.instructure.com/2413
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-02-23 14:37:42 -07:00