Commit Graph

41 Commits

Author SHA1 Message Date
Cody Cutrer 4e7e22b852 add push communication channel type
fixes CNVS-5794

links to an access token to get the proper ARN

test plan:
 * set up an SNS app in AWS
 * configure your credentials in sns.yml
 * set sns_arn on a developer key to be the ARN of the app in SNS
 * using an access token created from that developer key,
   you should be able to create a push channel
 * you should see that channel in your profile (named after your developer
   key)

Change-Id: I183241d02715252bf558c495d72d4995cea4232d
Reviewed-on: https://gerrit.instructure.com/25281
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-11-21 21:38:45 +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 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
Cody Cutrer d3f0b18684 validate nullness in the db on a bunch of columns
fixes CNVS-7414

Change-Id: I60978f66d88d916dc5736dbb975715172bd1e14b
Reviewed-on: https://gerrit.instructure.com/23141
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>
2013-09-12 22:20:39 +00:00
Brian Palmer 72e500aa29 use the database lower() function instead of ruby downcase
fixes CNVS-6974

test plan:
* create a user with Ĭńşŧřůćƭǜȑȩ in their name, enroll them in a course
* search for that user in the course roster, they should be found

Change-Id: Ia21d4d5163eec950cd45950123c1a273673a8c9a
Reviewed-on: https://gerrit.instructure.com/22470
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-07-19 15:59:47 +00:00
Cody Cutrer fc23549907 use more efficient has_merge_candidates? where possible
no behavior change

test plan:
 * run specs
 * invite a user to a course, and accept the invitation as an
   existing user

Change-Id: I2b0dc379a2c34065183cb8d9b74c2f61e94a736e
Reviewed-on: https://gerrit.instructure.com/15261
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-07-01 22:12:31 +00:00
Joe Tanner 5c9b83f826 Allow users to resurrect a retired email, closes #CNVS-6045
Really resurrect retired communication channels.
Fixes some callbacks that should've returned true.

test plan:
1) in rails console:
    u = User.find(<some user id>)
    cc = u.communication_channels.detect{|cc| cc.path_type == 'email'}
    cc.bounce_count = 5
    cc.workflow_state = 'retired'
    cc.save
2) take note of the email on the cc
3) start up the server and go to /about/<user id>
4) click 'Add Email Address' and enter the email noted in #2
5) it should be successful

Change-Id: I0b4572545859eacd823a46b326303860069b00f1
Reviewed-on: https://gerrit.instructure.com/21102
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
2013-06-03 17:13:37 +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
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 909d443e9e refactor notification message creation
fixes CNVS-4544

the bugfix was rolled into a larger refactor. registration
messages should now work as they originally did, before the
last refactor broke them

the refactor consumed three notable methods:
- Notification#create_message (which is still there, but calls
  NotificationMessageCreator#create_message immediately)
- Notification#record_delayed_jobs
- CommunicationChannel#find_all_for

related specs have been adapted and moved to
NotificationMessageCreator's specs

test plan
- ensure that notification messages work as they did before
- particularly ensure that adding additional email addresses send
  registration emails to those addresses, not the default address

Change-Id: Id201abbbc3cdc37305f5cd7125f1e4cb82fe4c96
Reviewed-on: https://gerrit.instructure.com/18561
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
2013-03-15 10:26:20 -06:00
Zach Pendleton 2976d9c60f add setting to control institution email address.
fixes CNVS-4001

allow institutions to prevent students from removing
their institution-given, SIS-imported email address
from canvas.

test plan:
  * in an account set the 'Users cannot delete their
    institution email address' setting to true;
  * create an SIS-imported communication channel;
  * as a student or teacher in the account, create
    and confirm a new communication channel and set
    it to your default;
  * verify that you cannot delete the SIS-imported channel
    using the UI (e.g. the trash can icon will not
    display);
  * verify that attempting to delete the SIS-imported
    channel from the API returns a 401.

Change-Id: If9b92f9436d6fe027a977894a1819792530435c4
Reviewed-on: https://gerrit.instructure.com/18071
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-03-01 15:08:56 -07:00
Cody Cutrer 56e317e4ab use mysql2 gem for mysql
closes CNVS-4199

Change-Id: I81a14efca365a61ff9e5d29892ec95ace64aabb3
Reviewed-on: https://gerrit.instructure.com/18089
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-02-27 14:10:37 -07:00
Cody Cutrer 1470b3aaf5 fix merge_candidates to search the correct shard
refs CNVS-3559

test plan:
 * create a user on the default shard (and confirm the e-mail address)
 * on another shard, invite that same e-mail address to a course
 * it should *not* show the user from the default shard

Change-Id: I897c55f8eaac832cbf655e0348189db4dc7a0a5e
Reviewed-on: https://gerrit.instructure.com/17414
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2013-02-04 16:20:06 -07:00
Ethan Vizitei b1d8f2ef3b user searching module
refs #CNVS-2326

Added a UserSearch module that provides
and interface for searching across the name,
the email, and the sis id (and the database id),
and added a trigram index on the columns
that will be searched against.

also made a slight refactor to the AR
initializer in order to expose
some of the behavior I wanted more granularly
and added some specs to cover it

fixed a small permissions bug in course.rb
and pulled some scoping out of the courses
controller down into the user search module

TEST PLAN:
  This is currently not accessible from
the site itself, this is just the ground
work for the eventual user search api endpoint.
The code is not called by anything currently in
production either so there is no need for
regression testing.  The one thing to check would
be the creation of new users (and pseudonyms and
communication channels).  There have been new
indexes added to columns on those tables
and there is some documentation indicating
that writing to these indexes can be time
consuming if the data set is quite large.  It
would be worth making sure that there have not
been any unacceptable performance regressions
in the creation of any of those record types in
a database that has a full load of data
(comparable to the production environment)

Change-Id: I8fb13a6ec714f27efc8012c5ed2bed4d963c24e6
Reviewed-on: https://gerrit.instructure.com/16459
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2013-01-21 17:25:32 -07:00
Mark Ericksen b03a1147db Support 'C Spire' phone network for SMS. Fixes #1287
Adds support for the "cspire" cell carrier for user SMS
 notification options.

 Testing Notes:
 ==========
 NOTE: Full testing requires someone with that network service
 to verify that messages are correctly being received.
 * On /profile/settings page click the 'Add Contact Method'
    in the sidebar under "Other Contacts"
* On the "Text (SMS)" tab, verify that 'C Spire' is now a carrier
   option.
* Verify that when selected, the "SMS Email" uses the
   "@cspire1.com" domain

Change-Id: I1dd409f728cff28499bfbf5fa7c189f64f705746
Reviewed-on: https://gerrit.instructure.com/16555
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-01-07 12:31:27 -07:00
Cody Cutrer 261ba20b14 fix cross-shard merges that copy retired sms communication channels
test plan:
 * add an sms channel to a user
 * retire that channel
 * merge that user with a user in a different shard

Change-Id: Ibd24978c7456505b813961044b635b99b6beec6b
Reviewed-on: https://gerrit.instructure.com/15318
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-11-14 09:08:57 -07:00
Cody Cutrer b85ed5a22e make CommunicationChannelsController#confirm sharding-aware
* Add CommunicationChannel#merge_candidates and use that in
   CommunicationChannelsController#confirm, UsersController#create,
   and profile settings view
 * change a few pseudonym accesses to be based off the account, not
   the user
 * search all_pseudonyms in a few places
 * shorten @communication_channel.confirmation_code to @nonce in
   several places

test plan:
 * create a normal user in shard 1. invite the same e-mail address to
   a course in shard 2. accept the invitation as you're existing user
   (you should have to log in)
 * invite a different e-mail address to a course in shard 2. accept
   the invitation while logged in as the user from the previous step

Change-Id: I9e7a4adb0b816650f444210c7a110b08858ec037
Reviewed-on: https://gerrit.instructure.com/15121
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-11-12 10:34:09 -07:00
Cody Cutrer 626dddfddc show temporary invitations from all shards
test plan:
 * turn on cross-shard invitations in the console
   (Setting.set('cross_shard_invitations', '1'))
 * create a user with an email address in a shard (NOT
   a site admin)
 * in an unrelated shard with open registration on,
   as an admin invite that e-mail address to a course
 * log in as the original user on the first shard; the invitation
   should show up on your dashboard
 * accepting/rejecting that invitation is *not* yet supported

Change-Id: I3b0c9657fe0dd37a737af9f4253ea8ef8b2f2b91
Reviewed-on: https://gerrit.instructure.com/14903
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-11-12 09:24:29 -07:00
Zach Pendleton 126246bba5 respect course/account locale settings in notifications.
fixes #10690

previously, notifications only considered user locale settings
when translating; they now consider the context as well.

test plan:
  * create a course with a spanish or russian locale;
  * enroll an english user in the course;
  * verify that the enrollment email is sent in the course
    locale and not the user locale.

Change-Id: Ib942f35dff770ec02aa4e39880a5234e318f26a9
Reviewed-on: https://gerrit.instructure.com/14103
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-10-08 13:17:10 -06:00
Cody Cutrer b7b407248f multi-factor authentication closes #9532
test plan:
 * enable optional MFA, and check the following:
   * normal log in should not be affected
   * you can enroll in MFA from your profile page
   * you can re-enroll in MFA from your profile page
   * you can disable MFA from your profile page
   * MFA can be reset by an admin on your user page
   * when enrolled, you are asked for verification code after
     username/password when logging in
   * you can't access any other part of the site directly until
     until entering your verification code
 * enable required MFA, and check the following
   * when not enrolled in MFA, and you log in, you are forced to
     enroll
   * you cannot disable MFA from your profile page
   * you can re-enroll in MFA from your profile page
   * an admin (other than himself) can reset MFA from the user page
 * for enrolling in MFA
   * use Google Authenticator and scan the QR code; you should have
     30-seconds or so of extra leeway to enter your code
   * having no SMS communication channels on your profile, the
     enrollment page should just have a form to add a new phone
   * having one or more SMS communication channels on your profile,
     the enrollment page should list them, or allow you to create
     a new one (and switch back)
   * having more than one SMS communication channel on your profile,
     the enrollment page should remember which one you have selected
     after you click "send"
   * an unconfirmed SMS channel should go to confirmed when it's used
     to enroll in MFA
   * you should not be able to go directly to /login/otp to enroll
     if you used "Remember me" token to log in
 * MFA login flow
   * if configured with SMS, it should send you an SMS after you
     put in your username/password; you should have about 5 minutes
     of leeway to put it in
   * if you don't check "remember computer" checkbox, you should have
     to enter a verification code each time you log in
   * if you do check it, you shouldn't have to enter your code
     anymore (for three days). it also shouldn't SMS you a
     verification code each time you log in
 * setting MFA to required for admins should make it required for
   admins, optional for other users
 * with MFA enabled, directly go to /login/otp after entering
   username/password but before entering a verification code; it
   should send you back to the main login page
 * if you enrolled via SMS, you should not be able to remove that
   SMS from your profile
 * there should not be a reset MFA link on a user page if they
   haven't enrolled
 * test a login or required enrollment sequence with CAS and/or SAML

Change-Id: I692de7405bf7ca023183e717930ee940ccf0d5e6
Reviewed-on: https://gerrit.instructure.com/12700
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-08-16 13:09:07 -06:00
Mark Ericksen 36cf340563 Rewrite of the Notification Preferences page. Closes #8066, Closes #9400
Implementing the re-designed Notification Preferences page.

Testing plan:
=========
* Verify that expected preferences can be set.
* Verify that it supports accessibility (screen readers) for blind users
* Verify that mobile users (iPad at least) can smoothly interact.

Change-Id: I2b98f2477932d800d2ec3de580e47a95f827616b
Reviewed-on: https://gerrit.instructure.com/12356
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-07-25 10:04:36 -06:00
Cody Cutrer b48b122438 use a meaningful context for confirmation notifications
fixes #5711

also cleans up broadcast policy a bit
 * remove cruft
 * re-organize so that the DSL doesn't become methods on the model
 * add context method to the DSL that becomes asset_context on the
   message
 * only evaluate the policy block once, instead of every time a
   model that has a broadcast policy is saved

test plan:
 * add an e-mail address to a user, and check the "I want to login" checkbox
 * the notification e-mail should link back to the correct domain

Change-Id: I484d07963c86c81f9b0226fd942ef9a71ac5500c
Reviewed-on: https://gerrit.instructure.com/8830
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-22 14:43:53 -07:00
Cody Cutrer bc48b1ef34 normalize user_id out of notification_policies
fixes #6585, #7096

by normalizing, it's impossible to not maintain a column that isn't
there (yes, triple negative is intended in that sentence), thus
preventing sending notifications to the wrong user after a merge
or any other bugs that would have missing maintaining the
denormalization.

test plan:
 * test notifications in general
 * merge two active users together - their notification preferences
   should survive the merge

Change-Id: I239d810c5499b94550b65128cac71c42cedd11ba
Reviewed-on: https://gerrit.instructure.com/8013
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-02-01 12:42:23 -07:00
Cody Cutrer 31f9b3ffea explicitly use memoizeable in communication_channel
we include memoizable in AR::Base in an initializer, but that runs
after plugin initializers, so we have to do this if a plugin needs
to use CommunicationChannel in its initializer

test plan: n/a

Change-Id: Iddd4141ab816b0b98358bdda3a325a0725f81994
Reviewed-on: https://gerrit.instructure.com/8082
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-01-16 10:14:18 -07:00
Zach Wily 9222bcfd4f fix showing default notification preferences, again; refs #6876
It turns out that the defaults for daily/weekly policies actually do work -
the issue before was that they won't work for a user whose first communication
channel is retired. This fixes that problem by using the first active email
channel.

Another problem was that we would only build placeholder policies if the user
had NO notification policies at all. However, that rarely happens - when a
user receives a notification and they don't have a policy for it, that policy
gets built. In this case, when the user went to their preferences page, they
would see all the notification categories they didn't have policies for as
"never". This creates placeholder policies for all the notification categories
the user doesn't have one for.

It also makes sure the correct defaults are displayed on the preferences
screen.

test plan:
 * Create a new user A, and enroll them in a course.
 * As another user B, create a calendar event in that course. A calendar event
   is by default a "never" item.
 * As user A, go to your communication prefs and notice that all the default
   preferences are still appearing. In the console you can verify that the
   policy was created for you too:
   > User.find(<A.id>).notification_policies
 * Now, delete that policy from the database.
 * As user A, add a new comm channel and delete the old one.
 * As user B, create another calendar event
 * Verify in the console that user A got a notification policy created for the
   second communication channel.
 * As user B, create a discussion topic.
 * As user A, add an entry to that topic.
 * As user B, comment on that topic as well.
   Discussion entries are by default 'daily', so user A should have a
   DelayedMessage. Verify in console:
   > DelayedMessage.last

Change-Id: I3f7827d2aa83d5b72ab5f8f96aa92ef96652f115
Reviewed-on: https://gerrit.instructure.com/8062
Reviewed-by: JT Olds <jt@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-13 13:12:19 -07:00
Zach Wily 885d32f304 show the default notification policies for users with no policies; fixes #6876
When a user had not configured any notification policies, on the communication
preferences page, they would see everything as "immediate". That would lead
people to believe that those are the defaults.

Note that for now, only "immediate" notifications actually will be sent by
default. All others are assumed to be never, so that should be reflected in
the UI.

test plan:
 * Create a new user
 * Go to the Profile -> Communication Preferences page
 * Notice that the pre-selected preferences are immediate for immediate
   notifications, and never for everything else.

Change-Id: Ibbd908a5b6f38d144fd4f752bc57258e96c4dc78
Reviewed-on: https://gerrit.instructure.com/8050
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-13 10:34:38 -07:00
Zach Wily d3b25ae4dc use the first active email channel when using default notification policy
We were just finding the first CommunicationChannel, which might even be
retired. This will make sure we get an active one and it's an email one.

test plan:
 * (perform all these steps on a new account, and don't go into the
   notification preferences screen)
 * Create a new account with an email address X
 * Add a new, secondary email address Y to your account
 * Delete the email address X
 * As another user, start a conversation with the user created above.
 * Verify that you received the email notification at email address Y and not
   X.

Change-Id: I7b16001918c5f39b5929e0f520069838a10bcf66
Reviewed-on: https://gerrit.instructure.com/8035
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Zach Wily <zach@instructure.com>
2012-01-12 13:05:47 -07:00
Cody Cutrer d9a23a9bd0 improve communication channel uniqueness check
fixes #6786, #6789

the uniqueness check was failing if there was a matching retired cc,
even though this cc is the only active/unconfirmed one.  so
instead write a custom validator that only searches for
active/unconfirmed ccs.

test plan:
 * manually add the same email address to a user multiple times,
   in a retired state (in script/console, or directly in the db)
 * try to add that email address to the user in the UI
 * it should work

Change-Id: I41bdff34ffcd273d82d1d251e45c1ce48b61d51c
Reviewed-on: https://gerrit.instructure.com/7889
Tested-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-01-06 15:35:19 -07:00
Brian Palmer 2c160d745f don't send notifications to unconfirmed communication channels
fixes #4805

test plan:
- set up a new email address or SMS in your profile
- in the notifications tab of the profile, add that new unconfirmed
  address to "For new conversation messages" and save
- as another user, message your first user, confirm the notification
  goes to the active channel but not the new uncofirmed one.

Change-Id: Id34540486e9107e829cacf9a7badcac15ede1dd6
Reviewed-on: https://gerrit.instructure.com/7859
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-04 16:33:39 -07:00
Cody Cutrer b9fee70ee6 use Pseudonym.custom_find_by_unique_id instead of find_by_unique_id
so that it's case insensitive

also fix some latent CommunicationChannel.find_or_initialize_by_path
discovered by specs for this

test plan:
 * run the specs
 * use forgot password with a username that differs in case
 * self-register a new user multiple times (without confirming)
   with e-mail addresses that differ in case

Change-Id: I476325f591c997fc8d50d5f38480177f732f07a7
Reviewed-on: https://gerrit.instructure.com/7724
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-01-04 15:58:40 -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
Cody Cutrer d9b4a245ba redesign merge/registration/confirmation page closes #6149
* Don't show merge opportunities for confirmation or transfer enrollment flows
 * Combine current user and other user sections into a single section
 * Use simplified wording for single merge opportunity
 * Use "add e-mail address" for logged in, non-matching single e-mail opportunity
 * Hide the registration form behind an additional click if there are merge
   opportunities
 * When a login is required to complete the action, automatically do the action
   after login, assuming they logged in as the correct user

Change-Id: If07b38702c15509af6798fc00bc062f286789438
Reviewed-on: https://gerrit.instructure.com/6649
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-11-07 12:19:24 -07:00
Cody Cutrer c59c0f593f refactor user creation/invitations closes #5833
fixes #5573, #5572, #5753

 * communication channels are now only unique within a single user
 * UserList changes
   * Always resolve pseudonym#unique_ids
   * Support looking up by SMS CCs
   * Option to either require e-mails match an existing CC,
     or e-mails that don't match a Pseudonym will always be
     returned unattached (relying on better merging behavior
     to not have a gazillion accounts created)
   * Method to return users, creating new ones (*without* a
     Pseudonym) if necessary. (can't create with a pseudonym,
     since Pseudonym#unique_id is still unique, I can't have
     multiple outstanding users with the same unique_id)
 * EnrollmentsFromUserList is mostly gutted, now using UserList's
   functionality directy.
 * Use UserList for adding account admins, removing the now
   unused Account#add_admin => User#find_by_email/User#assert_by_email
   codepath
 * Update UsersController#create to not worry about duplicate
   communication channels
 * Remove AccountsController#add_user, and just use
   UsersController#create
 * Change SIS::UserImporter to send out a merge opportunity
   e-mail if a conflicting CC is found (but still create the CC)
 * In /profile, don't worry about conflicting CCs (the CC confirmation
   process will now allow merging)
   * Remove CommunicationChannelsController#try_merge and #merge
 * For the non-simple case of CoursesController#enrollment_invitation
   redirect to /register (CommunicationsChannelController#confirm)
   * Remove CoursesController#transfer_enrollment
 * Move PseudonymsController#registration_confirmation to
   CommunicationChannelsController#confirm (have to be able to
   register an account without a Pseudonym yet)
   * Fold the old direct confirm functionality in, if there are
     no available merge opportunities
   * Allow merging the new account with the currently logged in user
   * Allow changing the Pseudonym#unique_id when registering a new
     account (since there might be conflicts)
   * Display a list of merge opportunities based on conflicting
     communication channels
     * Provide link(s) to log in as the other user,
       redirecting back to the registration page after login is
       complete (to complete the merge as the current user)
   * Remove several assert_* methods that are no longer needed
 * Update PseudonymSessionsController a bit to deal with the new
   way of dealing with conflicting CCs (especially CCs from LDAP),
   and to redirect back to the registration/confirmation page when
   attempting to do a merge
 * Expose the open_registration setting; use it to control if
   inviting users to a course is able to create new users

Change-Id: If2f38818a71af656854d3bf8431ddbf5dcb84691
Reviewed-on: https://gerrit.instructure.com/6149
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-10-24 12:07:08 -06:00
Jacob Fugal 1a761c2d1f explicit utc db times in update_all
update_all's update hash doesn't have any magic performed on bare Time
objects; it assumes any Time object it's given is already in UTC. using
a TimeWithZone object (regardless of timezone), which Fixnum#ago and
friends happen to return, is still fine.

Change-Id: I297b2a3211b896b5225ebcfaaee3c1eb56e55fb6
Reviewed-on: https://gerrit.instructure.com/5351
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-08-30 16:46:25 -06:00
Cody Cutrer 3aab3fdf47 i18n communication channel
Change-Id: Ida1b226a9364f534d77319c691d8ca6b1088702f
Reviewed-on: https://gerrit.instructure.com/4245
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-06-16 13:13:15 -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
Cody Cutrer d143e152a7 lazy create initial notification policies
Refs #3752 - this change alone is a 4x increase in users-per-second
import speed.

This should be safe - I looked through as much relevant code as I
could find, and it all is already defensive against policies not
being set up yet.  In fact, when you initialize a blank db, the
initial user doesn't have policies set up, and they work just fine.

Change-Id: Id0e449ad0d588e83993bf83ea5536767c9166789
Reviewed-on: https://gerrit.instructure.com/3514
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-05-09 15:47:50 -06:00
Zach Wily 06e89cdb6e do default notification policy setup synchronously during SIS import
Change-Id: Ic619952b079d0774bb78fdd8cbb3b930b83bce28
Reviewed-on: https://gerrit.instructure.com/3199
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-04-22 08:23:51 -06:00
tom metge 28dbe009ff fix sqlite compatibility for delayed_jobs-related queries
Change-Id: I13004a50207401c4b8a990dce5cfa2ec3871a102
Reviewed-on: https://gerrit.instructure.com/2256
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-02-11 12:56:46 -07:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00