-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MM-9479 Add ability to join team and channel through url #1372
Conversation
From ticket.
Check
Check
Haven't tested with all methods but logic should hold true for all redirect(Will test this to be sure)
I didn't get this. Can someone shed more light on this? @esethna @jasonblais
Check |
@sudheerDev Regarding item D), this was something that @hmhealey mentioned when we discussed the ticket. @hmhealey Can you help elaborate on that point? |
There are couple of things.
My take on the requirement was that we should always treat URL as a source of truth i.e don't redirect to a possible thread or team just because user has access with that in mind should the above cases be handles this way
as opposed to what master does now
|
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.
Just minor comments/queries.
components/needs_team/needs_team.jsx
Outdated
@@ -50,14 +54,13 @@ export default class NeedsTeam extends React.Component { | |||
team: PropTypes.string.isRequired, | |||
}).isRequired, | |||
}).isRequired, | |||
history: PropTypes.object.isRequired, | |||
}; | |||
|
|||
constructor(params) { | |||
super(params); | |||
|
|||
this.shortcutKeyDown = (e) => this.onShortcutKeyDown(e); |
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.
Will this work the same if this is removed and just make onShortcutKeyDown (below) as arrow function?
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.
It does work. Will fix this.
components/needs_team/needs_team.jsx
Outdated
@@ -81,35 +84,104 @@ export default class NeedsTeam extends React.Component { | |||
this.state = { | |||
team, | |||
finishedFetchingChannels: false, | |||
attemptingToJoinTeam: !team, |
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.
I can't see the use of attemptingToJoinTeam
.
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.
Good catch. I don't need this anymore.
props.history.push('/?redirect_to=' + encodeURIComponent(props.location.pathname)); | ||
return null; | ||
// Set up tracking for whether the window is active | ||
window.isActive = true; |
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.
Do we need to set this to false on componentWillUnmount?
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.
Looks like it is better to set it to false as not to updates on socket emits.
components/needs_team/needs_team.jsx
Outdated
} | ||
|
||
handleFocus = async () => { | ||
await this.props.actions.markChannelAsRead(this.props.currentChannelId); |
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.
It's not using the return data
of markChannelAsRead. Will it work the same without await?
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.
True. This does not require await here
components/needs_team/needs_team.jsx
Outdated
if (team) { | ||
const {error} = await props.actions.joinTeam(team.invite_id, team.id); | ||
if (error) { | ||
props.history.push('/error_page'); |
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.
Instead of /error_page
, should this be pushed to /error
and/or pass params like type, etc?
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.
Waiting for feedback on this. Yes we should have params and define the states for this
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.
Has this been addressed yet? I think the way we normally handle this is to kick the user to the /
route which then redirects the user like it would when they first log in
render={[Function]} | ||
/> | ||
</Switch> | ||
`; |
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.
👍
tests/components/needs_team.test.jsx
Outdated
expect(wrapper.state().attemptingToJoinTeam).toEqual(true); | ||
expect(wrapper.state().team).toEqual(null); | ||
}); | ||
}); |
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.
👍
@saturninoabril Fixed with review comments |
Saturn is off rest of the week, would there be a second engineer who can review this in case Saturn doesn't have time tomorrow? |
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.
LGTM
Looks good other than the possible changes needed for the error handling |
* If the url belongs to an unjoined team try to join and before redirecting to default team * Add tests to check join logic
bc3c041
to
83dab2f
Compare
* Update snapshots with channel and team error pages.
|
Spinmint test server created at: http:https://i-0b71878690454709c.test.spinmint.com Test Admin Account: Username: Test User Account: Username: Instance ID: i-0b71878690454709c |
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.
Awesome work Sudheer!
Spinmint test server destroyed |
@jwilander Added one commit for route handling for error scenarios. Can you have one more look at it? |
@jwilander Never mind :) |
…1372) * MM-9479 Add ability to join team and channel through url * If the url belongs to an unjoined team try to join and before redirecting to default team * Add tests to check join logic * Fix review comments * Add error routes for channel and team * Update snapshots with channel and team error pages.
Summary
Add ability to join team and channel through url.
This will address the issue of joining the team after account creation or login if there is a redirect.
TODO:
Add access denied screen for private teams and private channels?
Ticket Link
MM-9479
Checklist
[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]
make check-style
to check for style errors (required for all pull requests)make test
to ensure unit and component tests passed