From 202c383d8dc23ff3c0633fff99bd7da95397fe3a Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Tue, 9 May 2017 07:48:57 -0500 Subject: Fix MFA enforcement on login and page load (#6356) --- webapp/components/mfa/components/confirm.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'webapp/components') diff --git a/webapp/components/mfa/components/confirm.jsx b/webapp/components/mfa/components/confirm.jsx index a6c2eda4e..6ec99ef47 100644 --- a/webapp/components/mfa/components/confirm.jsx +++ b/webapp/components/mfa/components/confirm.jsx @@ -8,6 +8,8 @@ import React from 'react'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; import {browserHistory} from 'react-router/es6'; +import {loadMe} from 'actions/user_actions.jsx'; + export default class Confirm extends React.Component { constructor(props) { super(props); @@ -25,7 +27,9 @@ export default class Confirm extends React.Component { submit(e) { e.preventDefault(); - browserHistory.push('/'); + loadMe(() => { + browserHistory.push('/'); + }); } onKeyPress(e) { -- cgit v1.2.3-1-g7c22 From 0c701cc1d02c3d3b630050a0547f9dc632596013 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 9 May 2017 16:00:40 -0400 Subject: PLT-6518 Fixed user's locale not being loaded with redux actions (#6359) * Stopped ManageLanguages component from mutating user * Removed obsolete reference to mm_user * PLT-6518 Fixed user's locale not being loaded with redux actions --- webapp/components/login/login_controller.jsx | 2 +- webapp/components/root.jsx | 6 +++--- webapp/components/user_settings/manage_languages.jsx | 10 ++++------ 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/login/login_controller.jsx b/webapp/components/login/login_controller.jsx index fa3412f34..04ba46896 100644 --- a/webapp/components/login/login_controller.jsx +++ b/webapp/components/login/login_controller.jsx @@ -210,7 +210,7 @@ export default class LoginController extends React.Component { finishSignin(team) { const query = this.props.location.query; - GlobalActions.loadDefaultLocale(); + GlobalActions.loadCurrentLocale(); if (query.redirect_to) { browserHistory.push(query.redirect_to); } else if (team) { diff --git a/webapp/components/root.jsx b/webapp/components/root.jsx index 6907e84e4..701ee6e80 100644 --- a/webapp/components/root.jsx +++ b/webapp/components/root.jsx @@ -20,8 +20,8 @@ export default class Root extends React.Component { constructor(props) { super(props); this.state = { - locale: 'en', - translations: null + locale: LocalizationStore.getLocale(), + translations: LocalizationStore.getTranslations() }; this.localizationChanged = this.localizationChanged.bind(this); @@ -113,7 +113,7 @@ export default class Root extends React.Component { LocalizationStore.addChangeListener(this.localizationChanged); // Get our localizaiton - GlobalActions.loadDefaultLocale(); + GlobalActions.loadCurrentLocale(); } componentWillUnmount() { diff --git a/webapp/components/user_settings/manage_languages.jsx b/webapp/components/user_settings/manage_languages.jsx index b88485110..09b32e1d7 100644 --- a/webapp/components/user_settings/manage_languages.jsx +++ b/webapp/components/user_settings/manage_languages.jsx @@ -33,12 +33,10 @@ export default class ManageLanguage extends React.Component { changeLanguage(e) { e.preventDefault(); - var user = this.props.user; - var locale = this.state.locale; - - user.locale = locale; - - this.submitUser(user); + this.submitUser({ + ...this.props.user, + locale: this.state.locale + }); } submitUser(user) { updateUser(user, Constants.UserUpdateEvents.LANGUAGE, -- cgit v1.2.3-1-g7c22 From 9625362494888c9423bb6503b7e18557b6b9cc79 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 10 May 2017 07:41:12 -0400 Subject: Fix DM getting marked unread from your own message (#6373) --- webapp/components/notify_counts.jsx | 34 +--------------------------------- webapp/components/sidebar.jsx | 24 ++---------------------- 2 files changed, 3 insertions(+), 55 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/notify_counts.jsx b/webapp/components/notify_counts.jsx index dda352349..f05ecbf12 100644 --- a/webapp/components/notify_counts.jsx +++ b/webapp/components/notify_counts.jsx @@ -2,42 +2,10 @@ // See License.txt for license information. import * as utils from 'utils/utils.jsx'; +import {getCountsStateFromStores} from 'utils/channel_utils.jsx'; import ChannelStore from 'stores/channel_store.jsx'; import TeamStore from 'stores/team_store.jsx'; -function getCountsStateFromStores() { - let mentionCount = 0; - let messageCount = 0; - const teamMembers = TeamStore.getMyTeamMembers(); - const channels = ChannelStore.getAll(); - const members = ChannelStore.getMyMembers(); - - teamMembers.forEach((member) => { - if (member.team_id !== TeamStore.getCurrentId()) { - mentionCount += (member.mention_count || 0); - messageCount += (member.msg_count || 0); - } - }); - - channels.forEach((channel) => { - const channelMember = members[channel.id]; - if (channelMember == null) { - return; - } - - if (channel.type === 'D') { - mentionCount += channel.total_msg_count - channelMember.msg_count; - } else if (channelMember.mention_count > 0) { - mentionCount += channelMember.mention_count; - } - if (channelMember.notify_props.mark_unread !== 'mention' && channel.total_msg_count - channelMember.msg_count > 0) { - messageCount += 1; - } - }); - - return {mentionCount, messageCount}; -} - import React from 'react'; export default class NotifyCounts extends React.Component { diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx index aa7b98be0..5784f96ba 100644 --- a/webapp/components/sidebar.jsx +++ b/webapp/components/sidebar.jsx @@ -90,28 +90,8 @@ export default class Sidebar extends React.Component { } getTotalUnreadCount() { - let msgs = 0; - let mentions = 0; - const unreadCounts = this.state.unreadCounts; - const teamMembers = this.state.teamMembers; - - teamMembers.forEach((member) => { - if (member.team_id !== this.state.currentTeam.id) { - msgs += member.msg_count || 0; - mentions += member.mention_count || 0; - } - }); - - Object.keys(unreadCounts).forEach((chId) => { - const channel = ChannelStore.get(chId); - - if (channel && (channel.type === Constants.DM_CHANNEL || channel.type === Constants.GM_CHANNEL || channel.team_id === this.state.currentTeam.id)) { - msgs += unreadCounts[chId].msgs; - mentions += unreadCounts[chId].mentions; - } - }); - - return {msgs, mentions}; + const unreads = ChannelUtils.getCountsStateFromStores(this.state.currentTeam, this.state.teamMembers, this.state.unreadCounts); + return {msgs: unreads.messageCount, mentions: unreads.mentionCount}; } getStateFromStores() { -- cgit v1.2.3-1-g7c22 From b868aa1dc7af16ddea8f65ed60683a6f440567ec Mon Sep 17 00:00:00 2001 From: Asaad Mahmood Date: Wed, 10 May 2017 18:48:22 +0500 Subject: Fixes for RC1 (#6376) * PLT-6505 - Fixing z-index for post control menu * PLT-6507 - Channel header icons not aligned * PLT-6508 - Options popover issue on android * PLT-6528 - Removing cross contamination on badge * PLT-6535 - Aligning content in SSO buttons * PLT-6509 - Aligning dropdown close icon --- webapp/components/login/login_controller.jsx | 42 +++++++++++-------- webapp/components/signup/signup_controller.jsx | 57 +++++++++++++++----------- 2 files changed, 58 insertions(+), 41 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/login/login_controller.jsx b/webapp/components/login/login_controller.jsx index 04ba46896..4b6757294 100644 --- a/webapp/components/login/login_controller.jsx +++ b/webapp/components/login/login_controller.jsx @@ -493,12 +493,14 @@ export default class LoginController extends React.Component { key='gitlab' href={Client.getOAuthRoute() + '/gitlab/login' + this.props.location.search} > - - + + + + ); @@ -511,12 +513,14 @@ export default class LoginController extends React.Component { key='google' href={Client.getOAuthRoute() + '/google/login' + this.props.location.search} > - - + + + + ); @@ -529,12 +533,14 @@ export default class LoginController extends React.Component { key='office365' href={Client.getOAuthRoute() + '/office365/login' + this.props.location.search} > - - + + + + ); @@ -547,9 +553,11 @@ export default class LoginController extends React.Component { key='saml' href={'/login/sso/saml' + this.props.location.search} > - - {global.window.mm_config.SamlLoginButtonText} + + + {global.window.mm_config.SamlLoginButtonText} + ); diff --git a/webapp/components/signup/signup_controller.jsx b/webapp/components/signup/signup_controller.jsx index 0c969e5ed..9a6ed0ada 100644 --- a/webapp/components/signup/signup_controller.jsx +++ b/webapp/components/signup/signup_controller.jsx @@ -144,9 +144,8 @@ export default class SignupController extends React.Component { key='email' to={'/signup_email' + window.location.search} > - - + - - + + + + ); @@ -181,12 +182,14 @@ export default class SignupController extends React.Component { key='google' href={Client.getOAuthRoute() + '/google/signup' + window.location.search} > - - + + + + ); @@ -199,12 +202,14 @@ export default class SignupController extends React.Component { key='office365' href={Client.getOAuthRoute() + '/office365/signup' + window.location.search} > - - + + + + ); @@ -217,12 +222,14 @@ export default class SignupController extends React.Component { key='ldap' to={'/signup_ldap' + window.location.search} > - - + + + + ); @@ -242,9 +249,11 @@ export default class SignupController extends React.Component { key='saml' href={'/login/sso/saml' + window.location.search + query} > - - {global.window.mm_config.SamlLoginButtonText} + + + {global.window.mm_config.SamlLoginButtonText} + ); -- cgit v1.2.3-1-g7c22 From 2b7e71e47a0679396e64993b49c6d7c3d4321030 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 10 May 2017 09:49:16 -0400 Subject: Fix JS error when deleting post that has comments (#6381) --- webapp/components/rhs_thread.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/rhs_thread.jsx b/webapp/components/rhs_thread.jsx index da958d9d5..1b4eb720f 100644 --- a/webapp/components/rhs_thread.jsx +++ b/webapp/components/rhs_thread.jsx @@ -324,8 +324,6 @@ export default class RhsThread extends React.Component { const postsArray = this.state.postsArray; const selected = this.state.selected; const profiles = this.state.profiles || {}; - const rootPostDay = Utils.getDateForUnixTicks(selected.create_at); - let previousPostDay = rootPostDay; if (postsArray == null || selected == null) { return ( @@ -333,6 +331,9 @@ export default class RhsThread extends React.Component { ); } + const rootPostDay = Utils.getDateForUnixTicks(selected.create_at); + let previousPostDay = rootPostDay; + let profile; if (UserStore.getCurrentId() === selected.user_id) { profile = this.props.currentUser; -- cgit v1.2.3-1-g7c22 From 8ec90d88faaf3ab57a6e7a0cdf46a376d6bed54b Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Thu, 11 May 2017 05:10:47 -0700 Subject: PLT-6561 Fixing javascript issue on compliance report (#6387) --- webapp/components/audit_table.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'webapp/components') diff --git a/webapp/components/audit_table.jsx b/webapp/components/audit_table.jsx index 5d4bc4580..e07d6ca12 100644 --- a/webapp/components/audit_table.jsx +++ b/webapp/components/audit_table.jsx @@ -378,7 +378,10 @@ export function formatAuditInfo(audit, formatMessage) { if (userIdField.indexOf('user_id') >= 0) { userId = userIdField[userIdField.indexOf('user_id') + 1]; - username = UserStore.getProfile(userId).username; + var profile = UserStore.getProfile(userId); + if (profile) { + username = profile.username; + } } } -- cgit v1.2.3-1-g7c22 From e22bab5be03337e39c14bffc911dac1bd7385ed4 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 11 May 2017 16:18:48 -0400 Subject: PLT-6566 Prevented terms of service link from being blank (#6392) --- webapp/components/header_footer_template.jsx | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/header_footer_template.jsx b/webapp/components/header_footer_template.jsx index c41d7ee41..6fb9c9046 100644 --- a/webapp/components/header_footer_template.jsx +++ b/webapp/components/header_footer_template.jsx @@ -33,20 +33,18 @@ export default class NotLoggedIn extends React.Component { ); } - if (global.window.mm_config.TermsOfServiceLink) { - content.push( - - - - ); - } + content.push( + + + + ); if (global.window.mm_config.PrivacyPolicyLink) { content.push( -- cgit v1.2.3-1-g7c22