summaryrefslogtreecommitdiffstats
path: root/webapp/utils
diff options
context:
space:
mode:
authorDavid Meza <dmeza@users.noreply.github.com>2017-06-15 07:11:35 -0500
committerJoram Wilander <jwawilander@gmail.com>2017-06-15 08:11:35 -0400
commit98ac903fce24418538edbec77a218bcac9e20cd2 (patch)
tree794595c84946be50d44b11651232d2e490d6a189 /webapp/utils
parent0e89d9be1d6a2a1ca470f9ca92e0d59e5945ca18 (diff)
downloadchat-98ac903fce24418538edbec77a218bcac9e20cd2.tar.gz
chat-98ac903fce24418538edbec77a218bcac9e20cd2.tar.bz2
chat-98ac903fce24418538edbec77a218bcac9e20cd2.zip
PLT-6481 Create platform route and logic to be able to DM a user by email or username (#6310)
* Add logic to be able to DM a user by email or username * PLT-6481 update DM url to be in the format https://servername.com/teamname/messages/xxxxxxxx * PLT-6481 Adding logic to get user by full email * PLT-6481 logic for routes /messages/user_id and /messages/id1_id2 to redirect to /messages/@username * PLT-6481 logic for GM route /messages/generated_id
Diffstat (limited to 'webapp/utils')
-rw-r--r--webapp/utils/utils.jsx7
1 files changed, 6 insertions, 1 deletions
diff --git a/webapp/utils/utils.jsx b/webapp/utils/utils.jsx
index 1f3716039..9254b17e3 100644
--- a/webapp/utils/utils.jsx
+++ b/webapp/utils/utils.jsx
@@ -1099,7 +1099,12 @@ export function getDirectChannelName(id, otherId) {
// Used to get the id of the other user from a DM channel
export function getUserIdFromChannelName(channel) {
- var ids = channel.name.split('__');
+ return getUserIdFromChannelId(channel.name);
+}
+
+// Used to get the id of the other user from a DM channel id (id1_id2)
+export function getUserIdFromChannelId(channelId) {
+ var ids = channelId.split('__');
var otherUserId = '';
if (ids[0] === UserStore.getCurrentId()) {
otherUserId = ids[1];