Commit Graph

143 Commits

Author SHA1 Message Date
Arpit Jalan
2ae71b7a87 FEATURE: allow sending bulk invites to staged users 2019-10-30 11:40:03 +05:30
Krzysztof Kotlarek
427d54b2b0 DEV: Upgrading Discourse to Zeitwerk (#8098)
Zeitwerk simplifies working with dependencies in dev and makes it easier reloading class chains. 

We no longer need to use Rails "require_dependency" anywhere and instead can just use standard 
Ruby patterns to require files.

This is a far reaching change and we expect some followups here.
2019-10-02 14:01:53 +10:00
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
Arpit Jalan
e7fe7010b8
FIX: use hijack for processing bulk invites (#7679)
FIX: do not store bulk invite CSV file on server
2019-06-04 20:19:46 +05:30
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
Sam Saffron
30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00
Arpit Jalan
95ada3f190 FIX: save registration IP address for invited users 2019-04-13 13:04:25 +05:30
Robin Ward
b58867b6e9 FEATURE: New 'Reviewable' model to make reviewable items generic
Includes support for flags, reviewable users and queued posts, with REST API
backwards compatibility.

Co-Authored-By: romanrizzi <romanalejandro@gmail.com>
Co-Authored-By: jjaffeux <j.jaffeux@gmail.com>
2019-03-28 12:45:10 -04: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
Robin Ward
95f263995d FIX: Previous annotations were broken 2019-01-11 14:30:19 -05:00
Robin Ward
a3839495e0 Update annotations 2019-01-11 12:19:43 -05:00
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
Guo Xiang Tan
125bb46052 Remove unused constant in the codebase. 2018-12-03 11:04:47 +08:00
Gerhard Schlager
24e5be3f0c FIX: Relative links in translations should work with subfolder 2018-11-08 23:31:05 +00:00
Sam
89ad2b5900 DEV: Rails 5.2 upgrade and global gem upgrade
This updates tests to use latest rails 5 practice
and updates ALL dependencies that could be updated

Performance testing shows that performance has not regressed
if anything it is marginally faster now.
2018-06-07 14:21:33 +10:00
Arpit Jalan
8d9c77e113 optimize group invitation code 2018-05-28 17:59:14 +05:30
Arpit Jalan
c8bc942333 FIX: do not add invited user to automatic groups 2018-05-28 17:17:48 +05:30
Guo Xiang Tan
226ace1643 Update annotations. 2018-02-20 14:28:58 +08:00
Gerhard Schlager
dde0fcc658 FEATURE: Allow sending invites to staged users 2018-01-22 15:37:18 +01:00
Arpit Jalan
daeb7694bc update annotations 2017-12-05 21:03:20 +05:30
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
5012d46cbd Add rubocop to our build. (#5004) 2017-07-28 10:20:09 +09:00
Leo McArdle
d0b027d88d FEATURE: phase 1 of supporting multiple email addresses 2017-07-20 11:22:27 +09:00
Guo Xiang Tan
c5b1317a15 Remove code that is no longer being used. 2017-07-11 11:11:51 +09:00
Robin Ward
f1a6449e4b SECURITY: Remove disposable invite feature 2017-07-07 20:24:39 -04:00
Arpit Jalan
d3ee5752b8 remove unneeded condition from invite model 2017-07-01 21:50:34 +05:30
Arpit Jalan
16d356ab4e FEATURE: resending invite should include original custom message
https://meta.discourse.org/t/will-resent-invite-include-original-custom-message/64699
2017-06-30 18:13:33 +05:30
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
b9c94aa234 FEATURE: add required user fields to invite accept form
UX: make "accept invitation" page consistent with sign up modal
2017-06-12 20:43:07 +05:30
Arpit Jalan
77a8cae094 FIX: rescue specific errors on invite failure 2017-05-02 15:13:33 +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
Neil Lalonde
d0fbb27f3e FEATURE: new invite acceptance page, where username can be chosen and password can be set 2017-02-15 16:51:57 -05: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
Guo Xiang Tan
05f55dbc10 FEATURE: Group logs. 2016-12-12 17:29:54 +08:00
Arpit Jalan
ce974da9e5 FIX: simplify CSV file upload 2016-12-05 14:09:08 +05:30
Arpit Jalan
e03c1e4cdf annotate models 2016-10-31 15:02:11 +05:30
Arpit Jalan
3d02dc28be FIX: genrating invite link should not send email 2016-10-07 12:54:11 +05:30
Robin Ward
b0ee7930e8 Server side support for inviting as a moderator via the wizard 2016-09-22 09:52:19 -04:00
Arpit Jalan
7b205ebba4 FEATURE: customize invite email message 2016-06-06 20:15:30 +05:30
Arpit Jalan
c4e1ad0953 FEATURE: Resend all pending invitations 2016-06-03 12:23:13 +05:30
Sam
32c681c96b annotate models 2016-02-23 10:33:53 +11:00
Arpit Jalan
f2c1dbaa68 FIX: return 422 if the invite is already redeemed 2015-09-16 17:30:00 +05:30
Arpit Jalan
eb96016043 FEATURE: copy invite link for topic invites 2015-08-31 21:15:15 +05:30
Arpit Jalan
4ad07b8c09 FEATURE: generate invite token 2015-08-28 18:29:31 +05:30
Arpit Jalan
99edcddafb FEATURE: show pending/redeemed invite count in tabs 2015-08-25 01:12:46 +05:30
Arpit Jalan
e0c9054748 FEATURE: invite page tabs 2015-07-13 09:42:51 +05:30
Arpit Jalan
e8dd5592c6 FEATURE: support inviting existing users to topic and message when SSO is enabled 2015-04-05 14:31:35 +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
riking
3c035dce7c FIX: Don't expire ratelimits at midnight server time 2015-02-10 22:45:46 -08:00
Arpit Jalan
5e751ce90a FEATURE: 🎁 rate limit invites for non-staff users 2015-01-20 01:12:24 +05:30
Arpit Jalan
c5229a0268 upload bulk invite csv file to /public/uploads/csv 2014-11-25 22:25:09 +05:30
Arpit Jalan
430967c354 FIX: invite email should be verified against email_domains_blacklist 2014-10-09 20:21:01 +05:30
Arpit Jalan
78fd99fc40 Feature: resend invites 2014-10-07 01:43:17 +05:30
Sam
414c6d191f FIX: remove nullable dates post upgrade to Rails 4 2014-08-27 15:19:25 +10:00
Arpit Jalan
4cd8abc905 FEATURE: dynamically load invites 2014-08-05 22:20:23 +05:30
Arpit Jalan
f571abfaaf FEATURE: allow staff to send multiple invites to same email 2014-07-30 00:13:11 +05:30
Sam
bfb37054e8 Badge Grouping work in progress 2014-07-17 16:11:10 +10:00
Arpit Jalan
c14a35f173 FIX: If the invite with topic id already exists, redirect user to home page instead 2014-07-17 03:10:38 +05:30
Arpit Jalan
8862a881f8 FEATURE: topic support in disposable invites 2014-07-15 23:11:06 +05:30
Sam
45ca83328d Annotate 2014-07-15 11:29:44 +10:00
Arpit Jalan
575b5e3d13 FEATURE: disposable invite tokens 2014-07-14 21:30:46 +05:30
Arpit Jalan
b301391116 FEATURE: redeem Invite when user sign up 2014-07-04 02:03:04 +05:30
Arpit Jalan
727184641e FEATURE: Bulk Invite 2014-06-09 01:43:39 +05:30
Sam
b1d5f4440b Annotate models 2014-05-28 12:30:57 +10:00
Sam
3f07c1d0a1 Backend support for group invites 2014-05-09 18:22:35 +10:00
Sam
34d1668f9f FEATURE: backend for inviting a user to a group 2014-05-09 18:22:35 +10:00
Louis Rose
1574485443 Perform the where(...).first to find_by(...) refactoring.
This refactoring was automated using the command: bundle exec "ruby refactorings/where_dot_first_to_find_by/app.rb"
2014-05-06 14:41:59 +01:00
Erick Guan
6d45f71254 move concerns to the model/concerns 2014-04-19 12:00:40 +08:00
Sam
862a6696c0 Correct annotations
allow longer usernames (up to 60)
2014-04-15 15:53:48 +10:00
Régis Hanol
6373de550f update annotations 2014-04-08 17:35:44 +02:00
Stephan Kaag
f12925887c Drop Rails3 support 2014-02-17 19:42:08 +01:00
Sam
be560d4eb6 Update annotations 2014-02-07 11:07:52 +11:00
Neil Lalonde
da825451d0 Invite link can't be used to log in after you set a password or sign in with 3rd party 2014-01-21 16:56:41 -05:00
Neil Lalonde
1dbc1c56b4 FIX: inviting a user again after the first invite expires will create a new invite 2014-01-21 16:56:40 -05:00
Godfrey Chan
3c80ee0b8a ✂️ scoped for Rails 4 compat 2013-12-12 00:37:04 -08:00
Scott Albertson
77b59b54ce Refactor UsersController#invited
* Add test coverage
* Simplify controller action
* Move finder code to Invite class
2013-11-11 13:23:49 -08:00
Robin Ward
de30af9302 Support for inviting to a forum from a user's invite page. 2013-11-06 12:56:50 -05:00
Sam
ecf17cfebb work in progress, add fidelity to category group permissions (full, create posts, readonly) 2013-07-16 15:46:11 +10:00
Ian Christian Myers
0d01c33482 Enabled strong_parameters across all models/controllers.
All models are now using ActiveModel::ForbiddenAttributesProtection, which shifts the responsibility for parameter whitelisting for mass-assignments from the model to the controller. attr_accessible has been disabled and removed as this functionality replaces that.

The require_parameters method in the ApplicationController has been removed in favor of strong_parameters' #require method.

It is important to note that there is still some refactoring required to get all parameters to pass through #require and #permit so that we can guarantee that parameter values are scalar. Currently strong_parameters, in most cases, is only being utilized to require parameters and to whitelist the few places that do mass-assignments.
2013-06-06 00:30:59 -07:00
Ian Christian Myers
3b245031a4 Implemented strong_parameters for Invite/InvitesController.
The email parameter is now required using strong parameters and will throw ActionController::ParameterMissing if it is missing. If the email address is incorrect or invalid, Discourse::InvalidParameters will still be thrown.
2013-06-05 00:04:03 -07:00
Brian Plexico
0591d5be11 Extract InviteRedeemer from Invite 2013-05-30 11:49:11 -04:00
Sam
ca2dee52db moved comments to the bottom, they are way less intrusive there 2013-05-24 12:48:32 +10:00
Sam
2cd95bc649 lets try out annotations 2013-05-24 12:35:14 +10:00
Sam
e9fc272db7 remove acts_as_paranoid, use .trash! , .recover! and .with_deleted as needed
makes upgrading to rails 4 possible
2013-05-07 14:39:01 +10:00
Régis Hanol
b24c1a1ad9 better consistency around email case sensitivity 2013-04-15 02:20:33 +02:00
Gosha Arinich
0c99dea153 introduce Enum 2013-03-01 21:16:36 +03:00
Gosha Arinich
6e5399d544 minor cleanup, using AR querying DSL over raw SQL in some places 2013-02-28 21:54:12 +03:00
Jakub Arnold
61654ab8f0 Fix all the trailing whitespace 2013-02-07 16:45:24 +01:00
Robin Ward
21b5628528 Initial release of Discourse 2013-02-05 14:16:51 -05:00