Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getCurrent() {
const team = Selectors.getCurrentTeam(store.getState());
if (team) {
return team;
}
return null;
}
function mapStateToProps(state) {
const currentTeamMemberCount = getCurrentTeamStats(state) && getCurrentTeamStats(state).total_member_count;
const currentChannelMemberCount = getCurrentChannelStats(state) && getCurrentChannelStats(state).member_count;
return {
theme: getTheme(state),
currentChannel: getCurrentChannel(state),
membersNotInChannel: getProfilesNotInCurrentChannel(state),
currentTeam: getCurrentTeam(state),
currentTeamMemberCount,
currentChannelMemberCount,
preferences: getMyPreferences(state),
loadMoreRequestStatus: state.requests.users.getProfilesNotInChannel.status,
addChannelMemberRequestStatus: state.requests.channels.addChannelMember,
searchRequestStatus: state.requests.users.searchProfiles.status,
addChannelMemberStatus: state.requests.channels.addChannelMember.status
};
}
function mapStateToProps(state) {
const config = getConfig(state);
const enableUserCreation = config.EnableUserCreation === 'true';
const defaultChannel = getChannelsNameMapInCurrentTeam(state)[Constants.DEFAULT_CHANNEL];
const team = getCurrentTeam(state);
return {
enableUserCreation,
currentUser: getCurrentUser(state),
defaultChannelName: defaultChannel ? defaultChannel.display_name : '',
teamType: team ? team.type : '',
teamId: team ? team.id : '',
};
}
function mapStateToProps(state) {
const {currentUserId} = state.entities.users;
const profiles = getUsers(state);
let teamProfiles = {};
const restrictDms = getConfig(state).RestrictDirectMessage !== General.RESTRICT_DIRECT_MESSAGE_ANY;
if (restrictDms) {
teamProfiles = getTeamProfiles(state);
}
const searchOrder = Config.DrawerSearchOrder ? Config.DrawerSearchOrder : DEFAULT_SEARCH_ORDER;
return {
channels: getChannelsWithUnreadSection(state),
currentChannel: getCurrentChannel(state),
currentTeam: getCurrentTeam(state),
currentUserId,
otherChannels: getOtherChannels(state, false),
archivedChannels: getArchivedChannels(state),
groupChannelMemberDetails: getGroupChannelMemberDetails(state),
profiles,
teamProfiles,
teammateNameDisplay: getTeammateNameDisplaySetting(state),
statuses: getUserStatuses(state),
searchOrder,
pastDirectMessages: pastDirectMessages(state),
restrictDms,
theme: getTheme(state),
isLandscape: isLandscape(state),
};
}
function mapStateToProps(state) {
return {
config: state.entities.general.config,
theme: getTheme(state),
teamsRequest: state.requests.teams.allTeams,
teams: state.entities.teams.teams,
currentTeam: getCurrentTeam(state),
myMembers: state.entities.teams.myMembers,
notification: state.views.notification
};
}
function mapStateToProps(state) {
const config = getConfig(state);
const license = getLicense(state);
const currentChannel = getCurrentChannel(state);
const currentTeam = getCurrentTeam(state);
const isLicensed = license.IsLicensed === 'true';
const customBrand = license.CustomBrand === 'true';
const enableCustomBrand = config.EnableCustomBrand === 'true';
const customDescriptionText = config.CustomDescriptionText;
const siteName = config.SiteName;
return {
currentChannel,
currentTeam,
isLicensed,
customBrand,
enableCustomBrand,
customDescriptionText,
siteName,
};
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 team = getCurrentTeam(state);
const channel = getCurrentChannel(state);
let channelId = '';
let channelName = '';
let channelIsArchived;
if (channel) {
channelId = channel.id;
channelName = channel.name;
channelIsArchived = channel.delete_at !== 0;
}
let teamName = '';
if (team) {
teamName = team.name;
}
return {
return (state, ownProps) => {
const config = getConfig(state);
const preferences = getMyPreferences(state);
const enablePostUsernameOverride = config.EnablePostUsernameOverride === 'true';
const {post} = ownProps;
const user = getUser(state, post.user_id);
const channel = getChannel(state, post.channel_id) || {delete_at: 0};
return {
createAriaLabel: createAriaLabelForPost(state, post),
channelId: channel.id,
channelName: channel.display_name,
channelType: channel.type,
channelIsArchived: channel.delete_at !== 0,
currentTeamName: getCurrentTeam(state).name,
commentCountForPost: getCommentCountForPost(state, {post}),
enablePostUsernameOverride,
isFlagged: isPostFlagged(post.id, preferences),
isBot: user ? user.is_bot : false,
};
};
}
function getExtraContext(state) {
const context = {};
const currentTeam = getCurrentTeam(state);
if (currentTeam) {
context.currentTeam = {
id: currentTeam.id,
};
}
const currentTeamMember = getCurrentTeamMembership(state);
if (currentTeamMember) {
context.currentTeamMember = {
roles: currentTeamMember.roles,
};
}
const currentChannel = getCurrentChannel(state);
if (currentChannel) {
context.currentChannel = {