Commit Graph

66 Commits

Author SHA1 Message Date
Arpit Jalan eb9155f3fe
FEATURE: send max 200 emails every minute for bulk invites (#7875)
DEV: deprecate `invite.via_email` in favor of `invite.emailed_status`

This commit adds a new column `emailed_status` in `invites` table for
 tracking email sending status.
 0 - not required
 1 - pending
 2 - bulk pending
 3 - sending
 4 - sent

For normal email invites, invite record is created with emailed_status
 set to 'pending'.

When bulk invites are sent invite record is created with emailed_status
 set to 'bulk pending'.

For invites that generates link, invite record is created with
 emailed_status set to 'not required'.

When invite email is in queue emailed_status is updated to 'sending'

Once the email is sent via `InviteEmail` job the invite emailed_status
 is updated to 'sent'.
2019-07-19 11:29:12 +05:30
romanrizzi 87c2cbe062 DEV: Enable invite_spec test again 2019-05-16 18:55:36 -03:00
romanrizzi b716439c3e DEV: Improve component test skip option and skipped new tests 2019-05-16 15:15:37 -03:00
Sam Saffron d643294c9d FIX: delete duplicate invites earlier in the process
There was a race condition when 2 invites existed for 1 user where in some
cases data from both invites would be used for the redeem. Depending on DB
ordering.

Fix is to delete duplicate invites earlier in the process prior to
`redeem_from_email` being called.
2019-05-13 17:42:39 +10:00
Daniel Waterworth bf7594b327 More prefabrication 2019-05-10 08:34:04 -04:00
Daniel Waterworth e219588142 DEV: Prefabrication (test optimization) (#7414)
* Introduced fab!, a helper that creates database state for a group

It's almost identical to let_it_be, except:

 1. It creates a new object for each test by default,
 2. You can disable it using PREFABRICATION=0
2019-05-07 13:12:20 +10:00
Sam Saffron 4ea21fa2d0 DEV: use #frozen_string_literal: true on all spec
This change both speeds up specs (less strings to allocate) and helps catch
cases where methods in Discourse are mutating inputs.

Overall we will be migrating everything to use #frozen_string_literal: true
it will take a while, but this is the first and safest move in this direction
2019-04-30 10:27:42 +10:00
Arpit Jalan 2c8e1d3578 FEATURE: remove all expired invitations by default 2019-03-07 15:28:39 +05:30
Arpit Jalan ab2c2ea605
FIX: validate Invite email against `EmailValidator.email_regex` (#6975) 2019-02-06 22:38:06 +05:30
Gerhard Schlager 7977b09025 FEATURE: Activate users invited via email when invite is redeemed
Do not send an activation email to users invited via email. They
already confirmed their email address by clicking the invite link.
Users invited via link will need to confirm their email address before
they can login.
2018-12-11 00:09:53 +01:00
Guo Xiang Tan 978f0db109 SECURITY: Require groups to be given when inviting to a restricted category. (#6715) 2018-12-05 16:43:07 +01:00
Arpit Jalan c8bc942333 FIX: do not add invited user to automatic groups 2018-05-28 17:17:48 +05:30
Arpit Jalan 83245aa508 FIX: better handling of invite links after they are redeemed
FIX: deprecate invite_passthrough_hours setting
2018-05-08 20:17:57 +05:30
Arpit Jalan d074a39d39 fix the build 2018-04-27 20:04:24 +05:30
Guo Xiang Tan 1b5d955a34 Fix the build. 2018-02-26 12:46:15 +08:00
Gerhard Schlager dde0fcc658 FEATURE: Allow sending invites to staged users 2018-01-22 15:37:18 +01:00
Gerhard Schlager 4be8f17e66 FIX: counting invites didn't work
PostgreSQL reported the following error:
"for SELECT DISTINCT, ORDER BY expressions must appear in select list"
2017-11-14 11:40:07 +01:00
Arpit Jalan a2183c3f1d SECURITY: verify that inviter can invite new user to a topic 2017-10-09 15:59:41 +05:30
Guo Xiang Tan 77d4c4d8dc Fix all the errors to get our tests green on Rails 5.1. 2017-09-25 13:48:58 +08:00
Guo Xiang Tan 5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Guo Xiang Tan c5b1317a15 Remove code that is no longer being used. 2017-07-11 11:11:51 +09:00
Guo Xiang Tan 13f3de4bf6 Nuke all `SiteSetting.stubs` from our codebase. 2017-07-07 15:09:14 +09:00
Arpit Jalan e7b9b1312e FEATURE: remove all invites
https://meta.discourse.org/t/remove-all-invitations-button-for-the-admin-panel/65207
2017-06-29 22:30:10 +05:30
Arpit Jalan 77a8cae094 FIX: rescue specific errors on invite failure 2017-05-02 15:13:33 +05:30
Arpit Jalan f968b4e662 Fix the build 2017-04-18 16:34:58 +05:30
Arpit Jalan 7389831961 Fix the build 2017-04-15 15:52:35 +05:30
Arpit Jalan 8fb41bf5fb FIX: update timestamp when resending invite 2017-04-11 20:02:32 +05:30
Arpit Jalan 295cf8839e FIX: better error message when invited user already exists 2017-03-22 13:55:28 +05:30
Arpit Jalan 8cbfa24ca2 Fix failing test 2017-03-20 20:14:25 +05:30
Blake Erickson dbb3ddc7a6 FIX: approve invited user
This commit fixes the case where invited users who typed in a password
would not be approved by default. Because we moved the user create logic
for an invited user there was a clash with the `save` in the user model
and the `save` in the invite_redeemer class.

- added approve logic into invite_redeemer class.
- added tests to verify that the user is approved
- added a check to see if must_approve_users is on
- added a check to see if the inviter is staff
- go ahead and approve the user if must_approve_users is off
- keep existing User.approve workflow if user exists
- improve if/else logic to remove duplicate code
- use `Time.zone.now`
2017-03-05 06:58:23 -07:00
Arpit Jalan dc2171960b FIX: allow existing users to be invited to topic/message when must_approve_users is enabled 2017-02-03 13:01:23 +05:30
Robin Ward b0ee7930e8 Server side support for inviting as a moderator via the wizard 2016-09-22 09:52:19 -04:00
Andy Waite 3e50313fdc Prepare for separation of RSpec helper files
Since rspec-rails 3, the default installation creates two helper files:
* `spec_helper.rb`
* `rails_helper.rb`

`spec_helper.rb` is intended as a way of running specs that do not
require Rails, whereas `rails_helper.rb` loads Rails (as Discourse's
current `spec_helper.rb` does).

For more information:

https://www.relishapp.com/rspec/rspec-rails/docs/upgrade#default-helper-files

In this commit, I've simply replaced all instances of `spec_helper` with
`rails_helper`, and renamed the original `spec_helper.rb`.

This brings the Discourse project closer to the standard usage of RSpec
in a Rails app.

At present, every spec relies on loading Rails, but there are likely
many that don't need to. In a future pull request, I hope to introduce a
separate, minimal `spec_helper.rb` which can be used in tests which
don't rely on Rails.
2015-12-01 20:39:42 +00:00
Arpit Jalan e0c9054748 FEATURE: invite page tabs 2015-07-13 09:42:51 +05:30
Arpit Jalan fb0e7dc0b2 FIX: do not delete already redeemed invite 2015-03-25 23:30:09 +05:30
Arpit Jalan 4862a93804 FIX: delete duplicate invites 2015-03-25 22:43:41 +05:30
Jason W. May 0f36774246 group manager can invite members into the group from any restricted topic 2015-03-03 12:18:42 -08:00
Arpit Jalan 5e751ce90a FEATURE: 🎁 rate limit invites for non-staff users 2015-01-20 01:12:24 +05:30
Luciano Sousa b3d769ff4f Update rspec syntax to v3
update rspec syntax to v3

change syntax to rspec v3

oops. fix typo

mailers classes with rspec3 syntax

helpers with rspec3 syntax

jobs with rspec3 syntax

serializers with rspec3 syntax

views with rspec3 syntax

support to rspec3 syntax

category spec with rspec3 syntax
2015-01-05 11:59:30 -03:00
David McClure efc4109902 update specs to remove deprecation warnings 2014-11-07 06:05:44 -08:00
Régis Hanol ada750b384 fixed some more deprecations. 20 to go 2014-10-29 16:06:50 +01:00
Arpit Jalan 861f321263 FEATURE: send set password instructions after invite redemption 2014-10-11 14:13:05 +05:30
Arpit Jalan 430967c354 FIX: invite email should be verified against email_domains_blacklist 2014-10-09 20:21:01 +05:30
Régis Hanol de76b512c1 fix most deprecations in the specs (still some left) 2014-09-25 17:44:48 +02:00
Sam 0f585bcdbe FIX: PM should never be allowed to have a category
FIX: TL3 should not be allowed to muck with PM titles
2014-09-11 17:39:34 +10:00
Sam 59d04c0695 Internal renaming of elder,leader,regular,basic to numbers
Changed internals so trust levels are referred to with

TrustLevel[1], TrustLevel[2] etc.

This gives us much better flexibility naming trust levels, these names
are meant to be controlled by various communities.
2014-09-05 15:20:52 +10:00
Neil Lalonde 01a68f8cc7 Emails are case insensitive 2014-07-16 10:22:01 -04:00
Arpit Jalan 575b5e3d13 FEATURE: disposable invite tokens 2014-07-14 21:30:46 +05:30
Arpit Jalan caf8dbe92f Add tests for redeem invite feature 2014-07-05 02:23:11 +05:30
Robin Ward d9e583af1a FEATURE: Add new site setting to restrict how many times you can click on an
invite to "passthrough" as logged in, with a default of 0 hours. Also changes
default invite expiry from 7 days to 1.
2014-07-01 12:52:52 -04:00