Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function mapStateToProps(state) {
const team = getCurrentTeam(state) || {};
return {
channels: getNotArchivedOtherChannels(state) || [],
archivedChannels: getArchivedOtherChannels(state) || [],
currentUserId: getCurrentUserId(state),
teamId: team.id,
teamName: team.name,
channelsRequestStarted: state.requests.channels.getChannels.status === RequestStatus.STARTED,
canShowArchivedChannels: (getConfig(state).ExperimentalViewArchivedChannels === 'true'),
};
}
function mapStateToProps(state) {
const config = getConfig(state);
return {
currentUserId: getCurrentUserId(state),
passwordConfig: getPasswordConfig(config),
};
}
function mapStateToProps(state) {
const channel = getCurrentChannel(state);
const config = getConfig(state);
const enableTutorial = config.EnableTutorial === 'true';
const tutorialStep = getInt(state, Preferences.TUTORIAL_STEP, getCurrentUserId(state), TutorialSteps.FINISHED);
const viewArchivedChannels = config.ExperimentalViewArchivedChannels === 'true';
return {
channelId: channel ? channel.id : '',
deactivatedChannel: channel ? getDeactivatedChannel(state, channel.id) : false,
showTutorial: enableTutorial && tutorialStep <= TutorialSteps.INTRO_SCREENS,
channelIsArchived: channel ? channel.delete_at !== 0 : false,
viewArchivedChannels,
};
}
function mapStateToProps(state) {
return {
serverURL: getCurrentUrl(state),
siteURL: getConfig(state).SiteURL,
};
}
function mapStateToProps(state, ownProps) {
const config = getConfig(state);
const {createChannel: createChannelRequest} = state.requests.channels;
const militaryTime = getBool(state, Preferences.CATEGORY_DISPLAY_SETTINGS, 'use_military_time');
const enableTimezone = isTimezoneEnabled(state);
return {
config,
createChannelRequest,
currentDisplayName: state.views.channel.displayName,
user: state.entities.users.profiles[ownProps.userId],
bot: getBotAccounts(state)[ownProps.userId],
teammateNameDisplay: getTeammateNameDisplaySetting(state),
enableTimezone,
militaryTime,
theme: getTheme(state),
isMyUser: getCurrentUserId(state) === ownProps.userId,
isLandscape: isLandscape(state),
const currentChannel = getCurrentChannel(state);
if (currentChannel) {
context.currentChannel = {
id: currentChannel.id,
type: currentChannel.type,
};
}
const currentChannelMember = getMyCurrentChannelMembership(state);
if (currentChannelMember) {
context.currentChannelMember = {
roles: currentChannelMember.roles,
};
}
const config = getConfig(state);
if (config) {
context.config = {
BuildDate: config.BuildDate,
BuildEnterpriseReady: config.BuildEnterpriseReady,
BuildHash: config.BuildHash,
BuildHashEnterprise: config.BuildHashEnterprise,
BuildNumber: config.BuildNumber,
};
}
return context;
}
function mapStateToProps(state) {
const config = getConfig(state);
const closeUnusedDirectMessages = getPreference(
state,
Preferences.CATEGORY_SIDEBAR_SETTINGS,
'close_unused_direct_messages',
'after_seven_days'
);
const channelSwitcherOption = getPreference(
state,
Preferences.CATEGORY_SIDEBAR_SETTINGS,
'channel_switcher_section',
'true'
);
const sidebarPreference = getSidebarPreferences(state);
export const getPluginServerRoute = (state) => {
const config = getConfig(state);
let basePath = '/';
if (config && config.SiteURL) {
basePath = new URL(config.SiteURL).pathname;
if (basePath && basePath[basePath.length - 1] === '/') {
basePath = basePath.substr(0, basePath.length - 1);
}
}
return basePath + '/plugins/' + pluginId;
};
function mapStateToProps(state) {
const config = getConfig(state);
return {
enableWebrtc: config.EnableWebrtc === 'true',
isRhsOpen: getIsRhsOpen(state),
};
}
function mapStateToProps(state) {
const config = getConfig(state);
const siteName = config.SiteName;
const enableIncomingWebhooks = config.EnableIncomingWebhooks === 'true';
const enableOutgoingWebhooks = config.EnableOutgoingWebhooks === 'true';
const enableCommands = config.EnableCommands === 'true';
const enableOAuthServiceProvider = config.EnableOAuthServiceProvider === 'true';
return {
siteName,
enableIncomingWebhooks,
enableOutgoingWebhooks,
enableCommands,
enableOAuthServiceProvider,
};
}