Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Tak-Iwamoto/mattermost-webapp int…
Browse files Browse the repository at this point in the history
…o MM-20499

* 'master' of github.com:Tak-Iwamoto/mattermost-webapp: (71 commits)
  Fix bot icon heigth (mattermost#6578)
  Cypress/E2E: Update quick switch hint (mattermost#6691)
  migrate string-refs in search_results.jsx (mattermost#6671)
  MM-T581 Regen token (mattermost#6642)
  Switch button-bg-## to use button-bg-rgb variables (mattermost#6635)
  [MM-27142] In-Web-App purchase of Mattermost Cloud  (mattermost#6583)
  migrate user_list_row_with_error to ts (mattermost#6624)
  [MM-28217] Front-end for displaying company info (mattermost#6580)
  [MM-28211] Plan Details Card (mattermost#6582)
  [MM-28216] Billing History View (UX Only) (mattermost#6637)
  Added final set of cypress tests part of MM-29347 (mattermost#6659)
  [MM-24507] - Pin comment box on bottom of RHS thread (mattermost#6167)
  Cypress/E2E: Fix channel switcher spec (mattermost#6662)
  [MM-28781] migrate string refs in channelView (mattermost#6607)
  [GH-15777] Replace center-channel-color-## with center-channel-color-rgb variables (mattermost#6643)
  [GH-15776]Switch center-channel-color-## with center-channel-color-rgb variables (mattermost#6641)
  MM-29038 Removed usage of centre-channel-color from post comments (mattermost#6633)
  [MM-29034] Remove usage of sidebar-text-## CSS variables (mattermost#6634)
  Translations update from Weblate (mattermost#6673)
  [MM-20462] migrate any_team_permission_gate to typescript (mattermost#6547)
  ...
  • Loading branch information
Tak-Iwamoto committed Oct 10, 2020
2 parents e67382d + eba3166 commit 8f76d21
Show file tree
Hide file tree
Showing 363 changed files with 26,597 additions and 18,693 deletions.
2 changes: 1 addition & 1 deletion actions/admin_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as TeamActions from 'mattermost-redux/actions/teams';
import {Client4} from 'mattermost-redux/client';
import {bindClientFunc} from 'mattermost-redux/actions/helpers';

import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {trackEvent} from 'actions/telemetry_actions.jsx';

import {emitUserLoggedOutEvent} from 'actions/global_actions.jsx';
import {getOnNavigationConfirmed} from 'selectors/views/admin';
Expand Down
2 changes: 1 addition & 1 deletion actions/channel_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {getChannelByName, getUnreadChannelIds, getChannel} from 'mattermost-redu
import {getCurrentTeamUrl, getCurrentTeamId} from 'mattermost-redux/selectors/entities/teams';
import {getCurrentUserId} from 'mattermost-redux/selectors/entities/users';

import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import {loadNewDMIfNeeded, loadNewGMIfNeeded, loadProfilesForSidebar} from 'actions/user_actions.jsx';
import {browserHistory} from 'utils/browser_history';
import {Constants, Preferences, NotificationLevels} from 'utils/constants';
Expand Down
71 changes: 71 additions & 0 deletions actions/cloud.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {Stripe} from '@stripe/stripe-js';
import {getCode} from 'country-list';

import {Client4} from 'mattermost-redux/client';

import {getConfirmCardSetup} from 'components/payment_form/stripe';

import {StripeSetupIntent, BillingDetails} from 'types/cloud/sku';

// Returns true for success, and false for any error
export function completeStripeAddPaymentMethod(stripe: Stripe, billingDetails: BillingDetails, isDevMode: boolean) {
return async () => {
let paymentSetupIntent: StripeSetupIntent;
try {
paymentSetupIntent = await Client4.createPaymentMethod() as StripeSetupIntent;
} catch (error) {
return error;
}
const cardSetupFunction = getConfirmCardSetup(isDevMode);
const confirmCardSetup = cardSetupFunction(stripe.confirmCardSetup);

const result = await confirmCardSetup(
paymentSetupIntent.client_secret,
{
payment_method: {
card: billingDetails.card,
billing_details: {
name: billingDetails.name,
address: {
line1: billingDetails.address,
line2: billingDetails.address2,
city: billingDetails.city,
state: billingDetails.state,
country: getCode(billingDetails.country),
postal_code: billingDetails.postalCode,
},
},
},
},
);

if (!result) {
return false;
}

const {setupIntent, error: stripeError} = result;

if (stripeError) {
return false;
}

if (setupIntent == null) {
return false;
}

if (setupIntent.status !== 'succeeded') {
return false;
}

try {
await Client4.confirmPaymentMethod(setupIntent.id);
} catch (error) {
return false;
}

return true;
};
}
6 changes: 5 additions & 1 deletion actions/file_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ export function uploadFile(file, name, channelId, rootId, clientId) {
return request.
post(Client4.getFilesRoute()).
set(Client4.getOptions({method: 'post'}).headers).
attach('files', file, name).

// The order here is important:
// keeping the channel_id/client_ids fields before the files contents
// allows the server to stream the uploads instead of loading them in memory.
field('channel_id', channelId).
field('client_ids', clientId).
attach('files', file, name).
accept('application/json');
};
}
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion actions/user_actions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {makeFilterAutoclosedDMs, makeFilterManuallyClosedDMs} from 'mattermost-r
import {CategoryTypes} from 'mattermost-redux/constants/channel_categories';

import {loadStatusesForProfilesList, loadStatusesForProfilesMap} from 'actions/status_actions.jsx';
import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import store from 'stores/redux_store.jsx';
import * as Utils from 'utils/utils.jsx';
import {Constants, Preferences, UserStatuses} from 'utils/constants';
Expand Down
6 changes: 3 additions & 3 deletions actions/user_actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {CategoryTypes} from 'mattermost-redux/constants/channel_categories';
import * as UserActions from 'actions/user_actions';
import {getState} from 'stores/redux_store';
import TestHelper from 'tests/helpers/client-test-helper';
import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {trackEvent} from 'actions/telemetry_actions.jsx';

const mockStore = configureStore([thunk]);

Expand Down Expand Up @@ -87,8 +87,8 @@ jest.mock('stores/redux_store', () => {
};
});

jest.mock('actions/diagnostics_actions.jsx', () => {
const original = jest.requireActual('actions/diagnostics_actions.jsx');
jest.mock('actions/telemetry_actions.jsx', () => {
const original = jest.requireActual('actions/telemetry_actions.jsx');
return {
...original,
trackEvent: jest.fn(),
Expand Down
2 changes: 1 addition & 1 deletion actions/views/rhs.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {getPost} from 'mattermost-redux/selectors/entities/posts';
import {getUserTimezone} from 'mattermost-redux/selectors/entities/timezone';
import {getUserCurrentTimezone} from 'mattermost-redux/utils/timezone_utils';

import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import {getSearchTerms, getRhsState, getPluggableId} from 'selectors/rhs';
import {ActionTypes, RHSStates} from 'utils/constants';
import * as Utils from 'utils/utils';
Expand Down
4 changes: 2 additions & 2 deletions actions/views/rhs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
closeMenu,
openAtPrevious,
} from 'actions/views/rhs';
import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import {ActionTypes, RHSStates} from 'utils/constants';
import {getBrowserUtcOffset} from 'utils/timezone.jsx';

Expand Down Expand Up @@ -61,7 +61,7 @@ jest.mock('mattermost-redux/actions/search', () => ({
getPinnedPosts: jest.fn(),
}));

jest.mock('actions/diagnostics_actions.jsx', () => ({
jest.mock('actions/telemetry_actions.jsx', () => ({
trackEvent: jest.fn(),
}));

Expand Down
11 changes: 5 additions & 6 deletions components/admin_console/admin_definition.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import TeamAnalytics from 'components/analytics/team_analytics';
import PluginManagement from 'components/admin_console/plugin_management';
import CustomPluginSettings from 'components/admin_console/custom_plugin_settings';

import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {trackEvent} from 'actions/telemetry_actions.jsx';

import Audits from './audits';
import CustomUrlSchemesSetting from './custom_url_schemes_setting.jsx';
Expand Down Expand Up @@ -184,7 +184,10 @@ const AdminDefinition = {
icon: 'fa-info-circle',
sectionTitle: t('admin.sidebar.about'),
sectionTitleDefault: 'About',
isHidden: it.not(it.userHasReadPermissionOnResource('about')),
isHidden: it.any(
it.configIsTrue('ExperimentalSettings', 'RestrictSystemAdmin'),
it.not(it.userHasReadPermissionOnResource('about')),
),
license: {
url: 'about/license',
title: t('admin.sidebar.license'),
Expand All @@ -199,10 +202,6 @@ const AdminDefinition = {
'Mattermost Enterprise Edition. Unlock enterprise features in this software through the purchase of a subscription from ',
'This software is offered under a commercial license.\n\nSee ENTERPRISE-EDITION-LICENSE.txt in your root install directory for details. See NOTICE.txt for information about open source software used in this system.',
],
isHidden: it.any(
it.not(it.enterpriseReady),
it.configIsTrue('ExperimentalSettings', 'RestrictSystemAdmin'),
),
isDisabled: it.not(it.userHasWritePermissionOnResource('about')),
schema: {
id: 'LicenseSettings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {FormattedMessage, injectIntl, IntlShape} from 'react-intl';
import {Team} from 'mattermost-redux/types/teams';

import * as GlobalActions from 'actions/global_actions.jsx';
import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {trackEvent} from 'actions/telemetry_actions.jsx';

import {filterAndSortTeamsByDisplayName} from 'utils/team_utils.jsx';
import {ModalIdentifiers} from 'utils/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,33 @@ exports[`components/AdminSidebar should match snapshot 1`] = `
<ul
className="nav nav-pills nav-stacked"
>
<AdminSidebarCategory
definitionKey="about"
icon="fa-info-circle"
key="about"
parentLink="/admin_console"
sectionClass=""
title={
<FormattedMessage
defaultMessage="About"
id="admin.sidebar.about"
/>
}
>
<AdminSidebarSection
definitionKey="about.license"
key="about.license"
name="about/license"
parentLink=""
subsection={false}
title={
<FormattedMessage
defaultMessage="Edition and License"
id="admin.sidebar.license"
/>
}
/>
</AdminSidebarCategory>
<AdminSidebarCategory
definitionKey="reporting"
icon="fa-bar-chart"
Expand Down
2 changes: 1 addition & 1 deletion components/admin_console/admin_sidebar_section.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import PropTypes from 'prop-types';
import React from 'react';

import {trackEvent} from 'actions/diagnostics_actions.jsx';
import {trackEvent} from 'actions/telemetry_actions.jsx';
import BlockableLink from 'components/admin_console/blockable_link';
import * as Utils from 'utils/utils.jsx';

Expand Down
Loading

0 comments on commit 8f76d21

Please sign in to comment.