Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const enableTimezone = isTimezoneEnabled(state);
const userTimezone = enableTimezone ? getUserCurrentTimezone(currentUser.timezone) : '';
return {
commentedOnDisplayName: ownProps.commentedOnUserId ? displayUsername(commentedOnUser, teammateNameDisplay) : '',
commentCount: getCommentCountForPost(state, {post}),
createAt: post.create_at,
displayName: displayUsername(user, teammateNameDisplay),
enablePostUsernameOverride: config.EnablePostUsernameOverride === 'true',
fromWebHook: post?.props?.from_webhook === 'true', // eslint-disable-line camelcase
militaryTime,
isPendingOrFailedPost: isPostPendingOrFailed(post),
isSystemMessage: isSystemMessage(post),
fromAutoResponder: fromAutoResponder(post),
overrideUsername: post?.props?.override_username, // eslint-disable-line camelcase
theme: getTheme(state),
username: user.username,
isBot: user.is_bot || false,
isGuest: isGuest(user),
isLandscape: isLandscape(state),
userTimezone,
};
};
}
function mapStateToProps(state) {
return {
theme: getTheme(state),
};
}
function getThemeFromState() {
const state = store.getState();
return getTheme(state);
}
teamMembers = filterMembersInCurrentTeam(state, matchTerm);
} else {
inChannel = filterMembersInChannel(state, matchTerm);
outChannel = filterMembersNotInChannel(state, matchTerm);
}
return {
currentChannelId,
currentTeamId: getCurrentTeamId(state),
defaultChannel: getDefaultChannel(state),
matchTerm,
teamMembers,
inChannel,
outChannel,
requestStatus: state.requests.users.autocompleteUsers.status,
theme: getTheme(state),
isLandscape: isLandscape(state),
};
}
return {
...getDimensions(state),
canAddReaction,
canReply,
canCopyPermalink,
canCopyText,
canEdit,
canEditUntil,
canDelete,
canFlag,
canPin,
currentTeamUrl: getCurrentTeamUrl(state),
currentUserId,
isMyPost: currentUserId === post.user_id,
theme: getTheme(state),
isLandscape: isLandscape(state),
};
};
}
function mapStateToProps(state) {
const currentUserId = getCurrentUserId(state);
const currentUserStatus = getStatusForUserId(state, currentUserId);
return {
theme: getTheme(state),
currentUserStatus,
isLandscape: isLandscape(state),
};
}
function mapStateToProps(state, ownProps) {
let status = ownProps.status;
const user = getUser(state, ownProps.userId);
if (!status && ownProps.userId) {
status = getStatusForUserId(state, ownProps.userId);
}
const isCurrentUser = getCurrentUserId(state) === ownProps.userId;
let profileImageUri = '';
if (isCurrentUser) {
profileImageUri = getProfileImageUri(state);
}
return {
isCurrentUser,
theme: getTheme(state),
profileImageUri,
status,
user,
};
}
function mapStateToProps(state) {
const {deviceHeight} = getDimensions(state);
return {
deviceHeight,
theme: getTheme(state),
};
}
function mapStateToProps(state) {
return {
theme: getTheme(state),
};
}
function mapStateToProps(state, ownProps) {
const user = getUser(state, ownProps.userId);
return {
firstName: user.first_name,
lastName: user.last_name,
username: user.username,
isBot: Boolean(user.is_bot),
theme: getTheme(state),
};
}