From 11de77f63f2f9f555977aac3e918e8e546a4c03b Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Mon, 14 Nov 2016 05:39:48 -0800 Subject: [PATCH 1/5] Adding debugging for body errors (#4542) --- webapp/client/client.jsx | 12 +++++++++++- webapp/client/web_client.jsx | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx index a615bd5011..3ce6977f60 100644 --- a/webapp/client/client.jsx +++ b/webapp/client/client.jsx @@ -206,7 +206,12 @@ export default class Client { } if (successCallback) { - successCallback(res.body, res); + if (res.body) { + successCallback(res.body, res); + } else { + console.error('Missing response body for ' + methodName); // eslint-disable-line no-console + successCallback('', res); + } } } @@ -1952,6 +1957,11 @@ export default class Client { if (err) { return error(err); } + + if (!res.body) { + console.error('Missing response body for samlCertificateStatus'); // eslint-disable-line no-console + } + return success(res.body); }); } diff --git a/webapp/client/web_client.jsx b/webapp/client/web_client.jsx index d6474f1d97..5d2696c37c 100644 --- a/webapp/client/web_client.jsx +++ b/webapp/client/web_client.jsx @@ -92,6 +92,11 @@ class WebClientClass extends Client { if (err) { return error(err); } + + if (!res.body) { + console.error('Missing response body for getYoutubeVideoInfo'); // eslint-disable-line no-console + } + return success(res.body); }); } From db0314053e0ac32a29e628a1389975d046a22edb Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 14 Nov 2016 13:48:22 -0500 Subject: [PATCH 2/5] Move channel click dispatch outside of promise (#4545) --- webapp/actions/global_actions.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index f7c4c455cd..bcd981df69 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -50,13 +50,13 @@ export function emitChannelClickEvent(channel) { AsyncClient.updateLastViewedAt(chan.id); loadPosts(chan.id); trackPage(); + }); - AppDispatcher.handleViewAction({ - type: ActionTypes.CLICK_CHANNEL, - name: chan.name, - id: chan.id, - prev: ChannelStore.getCurrentId() - }); + AppDispatcher.handleViewAction({ + type: ActionTypes.CLICK_CHANNEL, + name: chan.name, + id: chan.id, + prev: ChannelStore.getCurrentId() }); } From 814d2fc88d000c61b4430fa00cbadeb9674091c5 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Mon, 14 Nov 2016 13:48:28 -0500 Subject: [PATCH 3/5] Fixed websocket to properly logout when logged out from another tab (#4546) --- webapp/actions/global_actions.jsx | 12 +++++++----- webapp/components/logged_in.jsx | 4 +--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/webapp/actions/global_actions.jsx b/webapp/actions/global_actions.jsx index bcd981df69..a704622954 100644 --- a/webapp/actions/global_actions.jsx +++ b/webapp/actions/global_actions.jsx @@ -461,21 +461,23 @@ export function emitRemoteUserTypingEvent(channelId, userId, postParentId) { }); } -export function emitUserLoggedOutEvent(redirectTo) { - const rURL = (redirectTo && typeof redirectTo === 'string') ? redirectTo : '/'; +export function emitUserLoggedOutEvent(redirectTo = '/', shouldSignalLogout = true) { Client.logout( () => { - BrowserStore.signalLogout(); + if (shouldSignalLogout) { + BrowserStore.signalLogout(); + } + BrowserStore.clear(); ErrorStore.clearLastError(); PreferenceStore.clear(); UserStore.clear(); TeamStore.clear(); newLocalizationSelected(global.window.mm_config.DefaultClientLocale); - browserHistory.push(rURL); + browserHistory.push(redirectTo); }, () => { - browserHistory.push(rURL); + browserHistory.push(redirectTo); } ); } diff --git a/webapp/components/logged_in.jsx b/webapp/components/logged_in.jsx index 4e7df0392a..ec4ca2a6a8 100644 --- a/webapp/components/logged_in.jsx +++ b/webapp/components/logged_in.jsx @@ -14,8 +14,6 @@ import {loadEmoji} from 'actions/emoji_actions.jsx'; import * as Utils from 'utils/utils.jsx'; import Constants from 'utils/constants.jsx'; -import {browserHistory} from 'react-router/es6'; - const BACKSPACE_CHAR = 8; import $ from 'jquery'; @@ -41,7 +39,7 @@ export default class LoggedIn extends React.Component { } console.log('detected logout from a different tab'); //eslint-disable-line no-console - browserHistory.push('/'); + GlobalActions.emitUserLoggedOutEvent('/', false); } if (e.originalEvent.key === '__login__' && e.originalEvent.storageArea === localStorage && e.originalEvent.newValue) { From e39a50e4d6ba93b457141cd3ed640a9448421ba4 Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Mon, 14 Nov 2016 10:48:33 -0800 Subject: [PATCH 4/5] Fixing problem with email verification link (#4547) --- api/user.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/user.go b/api/user.go index e78b5be037..9c24609ce7 100644 --- a/api/user.go +++ b/api/user.go @@ -376,7 +376,7 @@ func sendWelcomeEmail(c *Context, userId string, email string, siteURL string, v } if !verified { - link := fmt.Sprintf("%s/do_verify_email?uid=%s&hid=%s&email=%s", siteURL, userId, model.HashPassword(userId), url.QueryEscape(email)) + link := fmt.Sprintf("%s/do_verify_email?uid=%s&hid=%s&email=%s", siteURL, userId, model.HashPassword(userId+utils.Cfg.EmailSettings.InviteSalt), url.QueryEscape(email)) bodyPage.Props["VerifyUrl"] = link } @@ -423,7 +423,7 @@ func addDirectChannels(teamId string, user *model.User) { } func SendVerifyEmail(c *Context, userId, userEmail, siteURL string) { - link := fmt.Sprintf("%s/do_verify_email?uid=%s&hid=%s&email=%s", siteURL, userId, model.HashPassword(userId), url.QueryEscape(userEmail)) + link := fmt.Sprintf("%s/do_verify_email?uid=%s&hid=%s&email=%s", siteURL, userId, model.HashPassword(userId+utils.Cfg.EmailSettings.InviteSalt), url.QueryEscape(userEmail)) url, _ := url.Parse(siteURL) @@ -1863,7 +1863,7 @@ func sendEmailChangeEmail(c *Context, oldEmail, newEmail, siteURL string) { } func SendEmailChangeVerifyEmail(c *Context, userId, newUserEmail, siteURL string) { - link := fmt.Sprintf("%s/do_verify_email?uid=%s&hid=%s&email=%s", siteURL, userId, model.HashPassword(userId), url.QueryEscape(newUserEmail)) + link := fmt.Sprintf("%s/do_verify_email?uid=%s&hid=%s&email=%s", siteURL, userId, model.HashPassword(userId+utils.Cfg.EmailSettings.InviteSalt), url.QueryEscape(newUserEmail)) subjectPage := utils.NewHTMLTemplate("email_change_verify_subject", c.Locale) subjectPage.Props["Subject"] = c.T("api.templates.email_change_verify_subject", @@ -2269,7 +2269,7 @@ func verifyEmail(c *Context, w http.ResponseWriter, r *http.Request) { return } - if model.ComparePassword(hashedId, userId) { + if model.ComparePassword(hashedId, userId+utils.Cfg.EmailSettings.InviteSalt) { if c.Err = (<-Srv.Store.User().VerifyEmail(userId)).Err; c.Err != nil { return } else { From 3f19ccf1b1a6efdcc990cf8a0270ec4ffc0c6e22 Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 14 Nov 2016 21:35:34 -0300 Subject: [PATCH 5/5] PLT-4754 Fix RHS options menu (#4552) --- webapp/components/rhs_comment.jsx | 21 ++------- webapp/components/rhs_dropdown.jsx | 61 +++++++++++++++++++++++++ webapp/components/rhs_dropdown_menu.jsx | 22 +++++++++ webapp/components/rhs_root_post.jsx | 19 +------- 4 files changed, 88 insertions(+), 35 deletions(-) create mode 100644 webapp/components/rhs_dropdown.jsx create mode 100644 webapp/components/rhs_dropdown_menu.jsx diff --git a/webapp/components/rhs_comment.jsx b/webapp/components/rhs_comment.jsx index c7b005845e..416c0fe4bd 100644 --- a/webapp/components/rhs_comment.jsx +++ b/webapp/components/rhs_comment.jsx @@ -6,6 +6,7 @@ import FileAttachmentListContainer from './file_attachment_list_container.jsx'; import PendingPostOptions from 'components/post_view/components/pending_post_options.jsx'; import PostMessageContainer from 'components/post_view/components/post_message_container.jsx'; import ProfilePicture from 'components/profile_picture.jsx'; +import RhsDropdown from 'components/rhs_dropdown.jsx'; import TeamStore from 'stores/team_store.jsx'; import UserStore from 'stores/user_store.jsx'; @@ -218,24 +219,8 @@ export default class RhsComment extends React.Component { } return ( - + + {this.props.dropdownContents} + + + ); + } +} + +RhsDropdown.propTypes = { + dropdownContents: React.PropTypes.array.isRequired +}; diff --git a/webapp/components/rhs_dropdown_menu.jsx b/webapp/components/rhs_dropdown_menu.jsx new file mode 100644 index 0000000000..6efaa9deaa --- /dev/null +++ b/webapp/components/rhs_dropdown_menu.jsx @@ -0,0 +1,22 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import {Dropdown} from 'react-bootstrap'; +import React from 'react'; + +export default class RhsDropdownMenu extends Dropdown.Menu { + constructor(props) { //eslint-disable-line no-useless-constructor + super(props); + } + + render() { + return ( +
+ {super.render()} +
+ ); + } +} diff --git a/webapp/components/rhs_root_post.jsx b/webapp/components/rhs_root_post.jsx index aa663bda79..0dae5976fa 100644 --- a/webapp/components/rhs_root_post.jsx +++ b/webapp/components/rhs_root_post.jsx @@ -6,6 +6,7 @@ import PostBodyAdditionalContent from 'components/post_view/components/post_body import PostMessageContainer from 'components/post_view/components/post_message_container.jsx'; import FileAttachmentListContainer from './file_attachment_list_container.jsx'; import ProfilePicture from 'components/profile_picture.jsx'; +import RhsDropdown from 'components/rhs_dropdown.jsx'; import ChannelStore from 'stores/channel_store.jsx'; import UserStore from 'stores/user_store.jsx'; @@ -228,23 +229,7 @@ export default class RhsRootPost extends React.Component { var rootOptions = ''; if (dropdownContents.length > 0) { rootOptions = ( -