Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

[PLT-91] Change URLs of Direct Messages to usernames and more+ #189

Merged
merged 10 commits into from
Feb 2, 2018

Conversation

cometkim
Copy link
Collaborator

@cometkim cometkim commented Oct 24, 2017

Summary

Worked on team routes.

  • Channel Route: /channels/{channel_name}
  • GM Route: /messages/{group_id}
  • DM Route: /messages/@{username}
  • Fallback Route: /channels/{default_channel_name}

Worked on redirection rules.

  • /channels/{channel_id} -> Channel Route
  • /channels/{id1}__{id2} -> DM Route
  • /messages/{user_id} -> DM Route
  • /messages/{user_email} -> DM Route
  • /channels/{group_id} -> GM Route
  • Any other routes -> Fail Route (Let me know if needs more handling)

And Clean up codes.

Ticket Link

Checklist

  • Has UI changes
  • Added or updated unit tests (required for all new features)

@cometkim cometkim changed the title WIP: [PLT-91] Change URLs of Direct Messages to usernames and more+ [PLT-91] Change URLs of Direct Messages to usernames and more+ Oct 24, 2017
@jasonblais jasonblais added 1: PM Review Requires review by a product manager Setup Old Test Server Triggers the creation of a test server labels Oct 24, 2017
@jasonblais jasonblais self-assigned this Oct 24, 2017
@jasonblais
Copy link
Contributor

Thanks @cometkim! Looks like there is a build failure, can you help resolve them?

@cometkim
Copy link
Collaborator Author

I resolved! @jasonblais

@jasonblais jasonblais removed Awaiting Submitter Action Blocked on the author Setup Old Test Server Triggers the creation of a test server labels Oct 24, 2017
@mattermost mattermost deleted a comment from mattermod Oct 24, 2017
@mattermost mattermost deleted a comment from mattermod Oct 24, 2017
@mattermost mattermost deleted a comment from mattermod Oct 24, 2017
@jasonblais jasonblais added the Setup Old Test Server Triggers the creation of a test server label Oct 24, 2017
@jasonblais
Copy link
Contributor

Have asked @lindalumitchell's help with testing

@jasonblais jasonblais removed the Setup Old Test Server Triggers the creation of a test server label Oct 25, 2017
@mattermost mattermost deleted a comment from mattermod Oct 25, 2017
@mattermost mattermost deleted a comment from mattermod Oct 25, 2017
@mattermost mattermost deleted a comment from mattermod Oct 25, 2017
@jasonblais jasonblais added the Setup Old Test Server Triggers the creation of a test server label Oct 25, 2017
@cometkim
Copy link
Collaborator Author

Please wait for a few more changes.

@cometkim
Copy link
Collaborator Author

OK. Looks fine to me now.
I was replaced legacy URLs on the LHS.

Let me know if anyone finds more legacy URLs on the UI.

@mattermost mattermost deleted a comment from mattermod Oct 25, 2017
@mattermost mattermost deleted a comment from mattermod Oct 25, 2017
Worked on team routes.
- Channel Route: /channels/{channel_name}
- GM Route: /messages/{group_id}
- DM Route: /messages/@{username}
- Fail Route: /channels/{default_channel_name}

Worked on redirection rules.
- /channels/{channel_id} -> Channel Route
- /channels/{id1}__{id2} -> DM Route
- /messages/{user_id} -> DM Route
- /messages/{user_email} -> DM Route
- /channels/{group_id} -> GM Route
- Any other routes -> Fail Route

(Let me know if needs more handling)
@cometkim
Copy link
Collaborator Author

cometkim commented Jan 30, 2018

@jwilander Can I add the testURL config to jest to pass the test? that will affect to exist test snapshots which has URL.

@cometkim
Copy link
Collaborator Author

I just set the value to http:https://localhost:8065 and updated snapshots.
Now the tests are passed.

Please review and let me know if needs more changes then

@lindy65 lindy65 removed the Awaiting Submitter Action Blocked on the author label Jan 31, 2018
import ChannelView from 'components/channel_view';
import UserStore from 'stores/user_store.jsx';
import ChannelStore from 'stores/channel_store.jsx';
import TeamStore from 'stores/team_store.jsx';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is minor and up to you since the code was already doing this, but it would nice if we could use redux in here instead of these flux stores

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, to make router container using redux would be better.

Yeah, actually it was same means above.

Copy link
Collaborator Author

@cometkim cometkim Feb 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwilander Can you check the channel_identifier_router.jsx on the latest commit?

Still use the flux stores to effectively select entities so I'm not sure it makes sense for your comment. (ex: getByName)

GlobalActions.emitChannelClickEvent() seems to not work properly after connecting to redux store.
But if you like this style, I'd try to switch to this one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, that's fine. We can deal with that in another PR in the future


const LengthOfId = 26;
const LengthOfGroupId = 40;
const LengthOfUserIdPair = 54;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also minor, but can we use all capitals for constants like so LENGTH_OF_ID? Just to be consistent with the rest of the codebase

const {path, identifier} = match.params;

if (path === 'channels') {
if (identifier.length === LengthOfId) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if I have a channel name that happens to be 26 characters long? Is it going to try it as a channel ID and fail?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've found I cannot enter more than 22 characters for a channel name in the webapp. if it could be in another way and that has not same length as specified, it will going to try it as a channel name, and fail (replaced to fallback URL).

history.push(team ? `/${team}/channels/${Constants.DEFAULT_CHANNEL}` : '/');
}

export default class NeedsTeam extends React.PureComponent {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NeedsTeam? You mean MessageIdentifierRouter?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right? I've wondered about why the previous is

I will change

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crspeller I have changed that to ChannelIdentiferRouter on latest commit

}

render() {
return <ChannelView/>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a case where we actually render somthing or do we just redirect? If we just redirect then maybe we should just render nil here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no redirect here, so I think it should keep returning channel view.

Actually, I'm not sure it can be called "router".

It is just a bunch of onEnter callback to select a channel and it does call an action, does not switch a route.

Copy link
Member

@jwilander jwilander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once @crspeller's comments are addressed

@crspeller crspeller merged commit b42c94a into mattermost:master Feb 2, 2018
@jwilander
Copy link
Member

Thanks @cometkim ! Great work on this

@amyblais amyblais added Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation labels Feb 2, 2018
@lindalumitchell lindalumitchell added the Tests/Done Release tests have been written label Feb 9, 2018
@cometkim cometkim deleted the 7186-change-dm-url branch September 27, 2018 19:42
hmhealey pushed a commit that referenced this pull request Aug 28, 2020
* Changed getProfilesAndStatusesForPosts to get at mentioned users in posts

* Fix loop format

* Changed Object.keys to Object.values

* Exported getProfilesAndStatusesForPost

* Fix merge

* Switch emoji endpoints to v4

* Add license upload and remove actions

* Add analytics actions and reducers

* Add action for creating group channel

* Add functions to v4 client

* Fix execute command

* Update addToTeamFromInvite function

* Update analytics reducers

* Add client function to get public file link

* Add default headers and oauth route to client

* Add action to get user by email

* Add team import client function

* Set last viewed at for channel members in viewChannel

* Remove current user from by ids and usernames actions

* General clean-up in preparation for merge to master

* Add telemetry tracking

* Updates to telemetry

* Remove accidentl test code

* Always include cookies in fetch requests

* Updates per feedback

* Minor fix
hmhealey pushed a commit that referenced this pull request Mar 17, 2021
* Changed getProfilesAndStatusesForPosts to get at mentioned users in posts

* Fix loop format

* Changed Object.keys to Object.values

* Exported getProfilesAndStatusesForPost

* Fix merge

* Switch emoji endpoints to v4

* Add license upload and remove actions

* Add analytics actions and reducers

* Add action for creating group channel

* Add functions to v4 client

* Fix execute command

* Update addToTeamFromInvite function

* Update analytics reducers

* Add client function to get public file link

* Add default headers and oauth route to client

* Add action to get user by email

* Add team import client function

* Set last viewed at for channel members in viewChannel

* Remove current user from by ids and usernames actions

* General clean-up in preparation for merge to master

* Add telemetry tracking

* Updates to telemetry

* Remove accidentl test code

* Always include cookies in fetch requests

* Updates per feedback

* Minor fix
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
2: Dev Review Requires review by a core commiter Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation Hacktoberfest Tests/Done Release tests have been written
Projects
None yet
7 participants