-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃帹 Separate invites from user #7422
馃帹 Separate invites from user #7422
Conversation
issue TryGhost/Ghost#7420, requires TryGhost/Ghost#7422 - adds a new `Invite` model with associated serializer and test setup - updates team screen to use invites rather than existing users with the "invited" property - updates signup process to work with new invite model - updates setup process to create invites instead of users
issue TryGhost/Ghost#7420, requires TryGhost/Ghost#7422 - adds a new `Invite` model with associated serializer and test setup - updates team screen to use invites rather than existing users with the "invited" property - updates signup process to work with new invite model - updates setup process to create invites instead of users
15c689e
to
4ce8069
Compare
ready for review 馃憤 |
issue TryGhost/Ghost#7420, requires TryGhost/Ghost#7422 - adds a new `Invite` model with associated serializer and test setup - updates team screen to use invites rather than existing users with the "invited" property - updates signup process to work with new invite model - updates setup process to create invites instead of users - swaps usage of `gh-select-native` for `one-way-select` in the invite modal so that attributes can be set on the `select` element - updates resend invite process to account for server returning a new model - rewrites the invite management tests and fixes mirage mocks for invite endpoints
issue TryGhost/Ghost#7420, requires TryGhost/Ghost#7422 - adds a new `Invite` model with associated serializer and test setup - updates team screen to use invites rather than existing users with the "invited" property - updates signup process to work with new invite model - updates setup process to create invites instead of users - swaps usage of `gh-select-native` for `one-way-select` in the invite modal so that attributes can be set on the `select` element - updates resend invite process to account for server returning a new model - rewrites the invite management tests and fixes mirage mocks for invite endpoints
issue TryGhost/Ghost#7420, requires TryGhost/Ghost#7422 - adds a new `Invite` model with associated serializer and test setup - updates team screen to use invites rather than existing users with the "invited" property - updates signup process to work with new invite model - updates setup process to create invites instead of users - swaps usage of `gh-select-native` for `one-way-select` in the invite modal so that attributes can be set on the `select` element - updates resend invite process to account for server returning a new model - rewrites the invite management tests and fixes mirage mocks for invite endpoints - sorts invites by email address to avoid jumping invites when re-sending
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got a few comments, all pretty minor. Biggest thing to decide is whether the invites_roles
table is necessary. This could be changed later, however it seems to add unnecessary complexity in places so thought I'd flag it up as a possible simplification.
@@ -8,6 +9,7 @@ var _ = require('lodash'), | |||
globalUtils = require('../utils'), | |||
utils = require('./utils'), | |||
errors = require('../errors'), | |||
models = require('../models'), |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
return pipeline(tasks, object, options); | ||
}, | ||
|
||
/** |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
{ | ||
"name": "Delete invites", | ||
"action_type": "destroy", | ||
"object_type": "invite" |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
invites_roles: { | ||
id: {type: 'increments', nullable: false, primary: true}, | ||
role_id: {type: 'integer', nullable: false}, | ||
invite_id: {type: 'integer', nullable: false} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -388,6 +388,7 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({ | |||
findOne: function findOne(data, options) { | |||
data = this.filterData(data); | |||
options = this.filterOptions(options, 'findOne'); | |||
|
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -273,7 +269,7 @@ User = ghostBookshelf.Model.extend({ | |||
|
|||
options = options || {}; | |||
optInc = options.include; | |||
options.withRelated = _.union(options.withRelated, options.include); | |||
options.withRelated = _.union(options.withRelated, options.include); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -545,11 +538,7 @@ User = ghostBookshelf.Model.extend({ | |||
if (!user) { | |||
return Promise.reject(new errors.NotFoundError(i18n.t('errors.models.user.noUserWithEnteredEmailAddr'))); | |||
} | |||
if (user.get('status') === 'invited' || user.get('status') === 'invited-pending' || |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
P.S. I've tested and all the behaviour is working as far as I can tell 馃憤 |
refs TryGhost#7420 - remove invite logic from user - add invite model and adapt affected logic for inviting team members
4ce8069
to
b79a18c
Compare
Updated the PR, waiting for travis to finish 馃憤 |
Travis is green, ready to merge |
closes TryGhost/Ghost#7420, requires TryGhost/Ghost#7422 - adds a new `Invite` model with associated serializer and test setup - updates team screen to use invites rather than existing users with the "invited" property - updates signup process to work with new invite model - updates setup process to create invites instead of users - swaps usage of `gh-select-native` for `one-way-select` in the invite modal so that attributes can be set on the `select` element - updates resend invite process to account for server returning a new model - rewrites the invite management tests and fixes mirage mocks for invite endpoints - sorts invites by email address to avoid jumping invites when re-sending
refs #7420
With this PR we split invites from the user model 馃憤
See more in the written issue.
There is one
TODO
(see https://github.com/TryGhost/Ghost/pull/7422/files#diff-5da9649b589920bc040270ac06508495R88), but we can fix later.