MM-58066-Use Client Config to determine AppsEnabled (#27872)
* remove enabling apps plugin by default * use client config to determine creating app bindings. * update the way dispatch is made * updated type setting * fixed unit test * prevent a nil check * dispatch batch --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
081aa8f6dc
Коммит
e64cdfb34b
@@ -302,6 +302,7 @@ func GenerateLimitedClientConfig(c *model.Config, telemetryID string, license *m
|
|||||||
props["HasImageProxy"] = strconv.FormatBool(*c.ImageProxySettings.Enable)
|
props["HasImageProxy"] = strconv.FormatBool(*c.ImageProxySettings.Enable)
|
||||||
|
|
||||||
props["PluginsEnabled"] = strconv.FormatBool(*c.PluginSettings.Enable)
|
props["PluginsEnabled"] = strconv.FormatBool(*c.PluginSettings.Enable)
|
||||||
|
props["AppsPluginEnabled"] = strconv.FormatBool(*c.PluginSettings.Enable && c.PluginSettings.PluginStates[model.PluginIdApps] != nil && c.PluginSettings.PluginStates[model.PluginIdApps].Enable)
|
||||||
|
|
||||||
props["PasswordMinimumLength"] = strconv.Itoa(*c.PasswordSettings.MinimumLength)
|
props["PasswordMinimumLength"] = strconv.Itoa(*c.PasswordSettings.MinimumLength)
|
||||||
props["PasswordRequireLowercase"] = strconv.FormatBool(*c.PasswordSettings.Lowercase)
|
props["PasswordRequireLowercase"] = strconv.FormatBool(*c.PasswordSettings.Lowercase)
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ import {
|
|||||||
import {removeNotVisibleUsers} from 'mattermost-redux/actions/websocket';
|
import {removeNotVisibleUsers} from 'mattermost-redux/actions/websocket';
|
||||||
import {Client4} from 'mattermost-redux/client';
|
import {Client4} from 'mattermost-redux/client';
|
||||||
import {General, Permissions} from 'mattermost-redux/constants';
|
import {General, Permissions} from 'mattermost-redux/constants';
|
||||||
import {appsFeatureFlagEnabled} from 'mattermost-redux/selectors/entities/apps';
|
import {appsEnabled} from 'mattermost-redux/selectors/entities/apps';
|
||||||
import {
|
import {
|
||||||
getChannel,
|
getChannel,
|
||||||
getChannelMembersInChannels,
|
getChannelMembersInChannels,
|
||||||
@@ -230,7 +230,7 @@ export function reconnect() {
|
|||||||
const mostRecentId = getMostRecentPostIdInChannel(state, currentChannelId);
|
const mostRecentId = getMostRecentPostIdInChannel(state, currentChannelId);
|
||||||
const mostRecentPost = getPost(state, mostRecentId);
|
const mostRecentPost = getPost(state, mostRecentId);
|
||||||
|
|
||||||
if (appsFeatureFlagEnabled(state)) {
|
if (appsEnabled(state)) {
|
||||||
dispatch(handleRefreshAppsBindings());
|
dispatch(handleRefreshAppsBindings());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ jest.mock('plugins', () => ({
|
|||||||
|
|
||||||
let mockState = {
|
let mockState = {
|
||||||
entities: {
|
entities: {
|
||||||
|
apps: {
|
||||||
|
enablePlugin: false,
|
||||||
|
},
|
||||||
users: {
|
users: {
|
||||||
currentUserId: 'currentUserId',
|
currentUserId: 'currentUserId',
|
||||||
profiles: {
|
profiles: {
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
|
import {batchActions} from 'redux-batched-actions';
|
||||||
|
|
||||||
import {LogLevel} from '@mattermost/types/client4';
|
import {LogLevel} from '@mattermost/types/client4';
|
||||||
import type {ClientConfig} from '@mattermost/types/config';
|
import type {ClientConfig} from '@mattermost/types/config';
|
||||||
import type {SystemSetting} from '@mattermost/types/general';
|
import type {SystemSetting} from '@mattermost/types/general';
|
||||||
|
|
||||||
import {GeneralTypes} from 'mattermost-redux/action_types';
|
import {AppsTypes, GeneralTypes} from 'mattermost-redux/action_types';
|
||||||
import {Client4} from 'mattermost-redux/client';
|
import {Client4} from 'mattermost-redux/client';
|
||||||
import type {ActionFuncAsync} from 'mattermost-redux/types/actions';
|
import type {ActionFuncAsync} from 'mattermost-redux/types/actions';
|
||||||
|
|
||||||
@@ -26,7 +28,9 @@ export function getClientConfig(): ActionFuncAsync<ClientConfig> {
|
|||||||
Client4.setEnableLogging(data.EnableDeveloper === 'true');
|
Client4.setEnableLogging(data.EnableDeveloper === 'true');
|
||||||
Client4.setDiagnosticId(data.DiagnosticId);
|
Client4.setDiagnosticId(data.DiagnosticId);
|
||||||
|
|
||||||
dispatch({type: GeneralTypes.CLIENT_CONFIG_RECEIVED, data});
|
const type = data.AppsPluginEnabled === 'true' ? AppsTypes.APPS_PLUGIN_ENABLED : AppsTypes.APPS_PLUGIN_DISABLED;
|
||||||
|
const actions = [{type: GeneralTypes.CLIENT_CONFIG_RECEIVED, data}, {type}];
|
||||||
|
dispatch(batchActions(actions));
|
||||||
|
|
||||||
return {data};
|
return {data};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export type ClientConfig = {
|
|||||||
AndroidLatestVersion: string;
|
AndroidLatestVersion: string;
|
||||||
AndroidMinVersion: string;
|
AndroidMinVersion: string;
|
||||||
AppDownloadLink: string;
|
AppDownloadLink: string;
|
||||||
|
AppsPluginEnabled: string;
|
||||||
AsymmetricSigningPublicKey: string;
|
AsymmetricSigningPublicKey: string;
|
||||||
AvailableLocales: string;
|
AvailableLocales: string;
|
||||||
BannerColor: string;
|
BannerColor: string;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user