mirror of
https://github.com/mattermost/mattermost.git
synced 2026-11-01 09:28:09 -06:00
Address review: rename isEnterpriseOrSKUStarterFree and inline isSelfHostedStarter
Co-authored-by: Nick Misasi <nick13misasi@gmail.com>
This commit is contained in:
1 parent
d85494d03b
commit
d6857ec009
8 files changed
+16
-17
No files matched your search
@@ -52,7 +52,6 @@ export default function InviteAs(props: Props) {
|
||||
|
||||
const isEnterpriseReady = config.BuildEnterpriseReady === 'true';
|
||||
const isSelfHostedStarter = isEnterpriseReady && license.IsLicensed === 'false';
|
||||
const isStarter = isSelfHostedStarter;
|
||||
|
||||
let extraGuestLegend = true;
|
||||
let guestDisabledClass = '';
|
||||
@@ -68,7 +67,7 @@ export default function InviteAs(props: Props) {
|
||||
const hasSelfHostedPriorTrial = prevTrialLicense.IsLicensed === 'true';
|
||||
const hasPriorTrial = hasCloudPriorTrial || hasSelfHostedPriorTrial;
|
||||
|
||||
const isPaidSubscription = !isStarter && !isFreeTrial;
|
||||
const isPaidSubscription = !isSelfHostedStarter && !isFreeTrial;
|
||||
|
||||
// show the badge logic (the restricted indicator takes care of the look when it is trial or not)
|
||||
if (isSystemAdmin && !isPaidSubscription) {
|
||||
@@ -137,7 +136,7 @@ export default function InviteAs(props: Props) {
|
||||
}
|
||||
|
||||
// disable the radio button logic (is disabled when is starter - pre and post trial)
|
||||
if (isStarter || !props.canInviteGuests) {
|
||||
if (isSelfHostedStarter || !props.canInviteGuests) {
|
||||
guestDisabled = (id: string) => {
|
||||
return (id === InviteType.GUEST);
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@ import {getCurrentUserMentionKeys, getHighlightWithoutNotificationKeys} from 'ma
|
||||
|
||||
import {canManageMembers} from 'utils/channel_utils';
|
||||
import {Preferences} from 'utils/constants';
|
||||
import {isEnterpriseOrCloudOrSKUStarterFree} from 'utils/license_utils';
|
||||
import {isEnterpriseOrSKUStarterFree} from 'utils/license_utils';
|
||||
import type {MentionKey} from 'utils/text_formatting';
|
||||
|
||||
import type {GlobalState} from 'types/store';
|
||||
@@ -82,7 +82,7 @@ function makeMapStateToProps() {
|
||||
isMilitaryTime: getBool(state, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.USE_MILITARY_TIME, false),
|
||||
timezone: getCurrentTimezone(state),
|
||||
hideGuestTags: getConfig(state).HideGuestTags === 'true',
|
||||
isEnterpriseOrCloudOrSKUStarterFree: isEnterpriseOrCloudOrSKUStarterFree(license, isEnterpriseReady),
|
||||
isEnterpriseOrSKUStarterFree: isEnterpriseOrSKUStarterFree(license, isEnterpriseReady),
|
||||
isEnterpriseReady,
|
||||
renderEmoticonsAsEmoji: getBool(state, Preferences.CATEGORY_DISPLAY_SETTINGS, Preferences.RENDER_EMOTICONS_AS_EMOJI, Preferences.RENDER_EMOTICONS_AS_EMOJI_DEFAULT === 'true'),
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ describe('components/PostMarkdown', () => {
|
||||
highlightKeys: [],
|
||||
hasPluginTooltips: false,
|
||||
isUserCanManageMembers: false,
|
||||
isEnterpriseOrCloudOrSKUStarterFree: true,
|
||||
isEnterpriseOrSKUStarterFree: true,
|
||||
isEnterpriseReady: false,
|
||||
dispatch: jest.fn(),
|
||||
renderEmoticonsAsEmoji: true,
|
||||
|
||||
@@ -147,7 +147,7 @@ export default class PostMarkdown extends React.PureComponent<Props> {
|
||||
);
|
||||
|
||||
let highlightKeys;
|
||||
if (!this.props.isEnterpriseOrCloudOrSKUStarterFree && this.props.isEnterpriseReady) {
|
||||
if (!this.props.isEnterpriseOrSKUStarterFree && this.props.isEnterpriseReady) {
|
||||
highlightKeys = this.props.highlightKeys;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
|
||||
import {isCallsEnabled, isCallsRingingEnabledOnServer} from 'selectors/calls';
|
||||
|
||||
import {isEnterpriseOrCloudOrSKUStarterFree} from 'utils/license_utils';
|
||||
import {isEnterpriseOrSKUStarterFree} from 'utils/license_utils';
|
||||
|
||||
import type {GlobalState} from 'types/store';
|
||||
|
||||
@@ -47,7 +47,7 @@ const mapStateToProps = (state: GlobalState, props: OwnProps) => {
|
||||
enableAutoResponder,
|
||||
isCollapsedThreadsEnabled: props.adminMode && props.userPreferences ? isCollapsedThreadsEnabledForUser(state, props.userPreferences) : isCollapsedThreadsEnabled(state),
|
||||
isCallsRingingEnabled: isCallsEnabled(state, '0.17.0') && isCallsRingingEnabledOnServer(state),
|
||||
isEnterpriseOrCloudOrSKUStarterFree: isEnterpriseOrCloudOrSKUStarterFree(license, isEnterpriseReady),
|
||||
isEnterpriseOrSKUStarterFree: isEnterpriseOrSKUStarterFree(license, isEnterpriseReady),
|
||||
isEnterpriseReady,
|
||||
};
|
||||
};
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ describe('components/user_settings/display/UserSettingsDisplay', () => {
|
||||
enableAutoResponder: false,
|
||||
isCallsRingingEnabled: false,
|
||||
intl: {} as IntlShape,
|
||||
isEnterpriseOrCloudOrSKUStarterFree: false,
|
||||
isEnterpriseOrSKUStarterFree: false,
|
||||
isEnterpriseReady: true,
|
||||
};
|
||||
|
||||
@@ -40,7 +40,7 @@ describe('components/user_settings/display/UserSettingsDisplay', () => {
|
||||
});
|
||||
|
||||
test('should match snapshot when its a starter free', () => {
|
||||
const props = {...defaultProps, isEnterpriseOrCloudOrSKUStarterFree: true};
|
||||
const props = {...defaultProps, isEnterpriseOrSKUStarterFree: true};
|
||||
|
||||
const wrapper = renderWithContext(
|
||||
<UserSettingsNotifications {...props}/>,
|
||||
|
||||
+5
-5
@@ -814,14 +814,14 @@ class NotificationsTab extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
let collapsedDescription = this.props.intl.formatMessage({id: 'user.settings.notifications.keywordsWithHighlight.none', defaultMessage: 'None'});
|
||||
if (!this.props.isEnterpriseOrCloudOrSKUStarterFree && this.props.isEnterpriseReady && this.state.customKeysWithHighlight.length > 0) {
|
||||
if (!this.props.isEnterpriseOrSKUStarterFree && this.props.isEnterpriseReady && this.state.customKeysWithHighlight.length > 0) {
|
||||
const customKeysWithHighlightStringArray = this.state.customKeysWithHighlight.map((key) => key.value);
|
||||
collapsedDescription = customKeysWithHighlightStringArray.map((key) => `"${key}"`).join(', ');
|
||||
}
|
||||
|
||||
const collapsedEditButtonWhenDisabled = (
|
||||
<RestrictedIndicator
|
||||
blocked={this.props.isEnterpriseOrCloudOrSKUStarterFree && this.props.isEnterpriseReady}
|
||||
blocked={this.props.isEnterpriseOrSKUStarterFree && this.props.isEnterpriseReady}
|
||||
feature={MattermostFeatures.HIGHLIGHT_WITHOUT_NOTIFICATION}
|
||||
minimumPlanRequiredForFeature={LicenseSkus.Professional}
|
||||
tooltipTitle={this.props.intl.formatMessage({
|
||||
@@ -882,7 +882,7 @@ class NotificationsTab extends React.PureComponent<Props, State> {
|
||||
describe={collapsedDescription}
|
||||
updateSection={this.handleUpdateSection}
|
||||
max={expandedSection}
|
||||
isDisabled={this.props.isEnterpriseOrCloudOrSKUStarterFree && this.props.isEnterpriseReady}
|
||||
isDisabled={this.props.isEnterpriseOrSKUStarterFree && this.props.isEnterpriseReady}
|
||||
collapsedEditButtonWhenDisabled={collapsedEditButtonWhenDisabled}
|
||||
/>);
|
||||
};
|
||||
@@ -1166,7 +1166,7 @@ class NotificationsTab extends React.PureComponent<Props, State> {
|
||||
{channelMentionAutoFollowSection}
|
||||
<div className='divider-light'/>
|
||||
{keywordsWithNotificationSection}
|
||||
{(!this.props.isEnterpriseOrCloudOrSKUStarterFree && this.props.isEnterpriseReady) && (
|
||||
{(!this.props.isEnterpriseOrSKUStarterFree && this.props.isEnterpriseReady) && (
|
||||
<>
|
||||
<div className='divider-light'/>
|
||||
{keywordsWithHighlightSection}
|
||||
@@ -1187,7 +1187,7 @@ class NotificationsTab extends React.PureComponent<Props, State> {
|
||||
)}
|
||||
|
||||
{/* We placed the disabled items in the last */}
|
||||
{(this.props.isEnterpriseOrCloudOrSKUStarterFree && this.props.isEnterpriseReady) && (
|
||||
{(this.props.isEnterpriseOrSKUStarterFree && this.props.isEnterpriseReady) && (
|
||||
<>
|
||||
<div className='divider-light'/>
|
||||
{keywordsWithHighlightSection}
|
||||
|
||||
@@ -109,7 +109,7 @@ export const licenseSKUWithFirstLetterCapitalized = (license: ClientLicense) =>
|
||||
return sku.charAt(0).toUpperCase() + sku.slice(1);
|
||||
};
|
||||
|
||||
export function isEnterpriseOrCloudOrSKUStarterFree(license: ClientLicense, isEnterpriseReady: boolean) {
|
||||
export function isEnterpriseOrSKUStarterFree(license: ClientLicense, isEnterpriseReady: boolean) {
|
||||
const isSelfHostedStarter = isEnterpriseReady && (license.IsLicensed === 'false');
|
||||
|
||||
const isStarterSKULicense = license.IsLicensed === 'true' && license.SelfHostedProducts === SelfHostedProducts.STARTER;
|
||||
|
||||
Reference in new issue
Block a user