mattermost-redux
Version:
Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client
111 lines (110 loc) • 9.72 kB
TypeScript
import type { Channel, ChannelMembership } from '@mattermost/types/channels';
import type { Group } from '@mattermost/types/groups';
import type { Reaction } from '@mattermost/types/reactions';
import type { GlobalState } from '@mattermost/types/store';
import type { Team, TeamMembership } from '@mattermost/types/teams';
import type { UserProfile } from '@mattermost/types/users';
import type { IDMappedObjects, RelationOneToManyUnique, RelationOneToOne } from '@mattermost/types/utilities';
export declare const getCurrentUser: (state: GlobalState) => UserProfile;
export declare const getCurrentUserId: (state: GlobalState) => string;
export declare const getUsers: (state: GlobalState) => IDMappedObjects<UserProfile>;
export type Filters = {
role?: string;
inactive?: boolean;
active?: boolean;
roles?: string[];
exclude_roles?: string[];
channel_roles?: string[];
team_roles?: string[];
exclude_bots?: boolean;
exclude_remote?: boolean;
};
export declare function getUserIdsInChannels(state: GlobalState): RelationOneToManyUnique<Channel, UserProfile>;
export declare function getUserIdsNotInChannels(state: GlobalState): RelationOneToManyUnique<Channel, UserProfile>;
export declare function getUserIdsInTeams(state: GlobalState): RelationOneToManyUnique<Team, UserProfile>;
export declare function getUserIdsNotInTeams(state: GlobalState): RelationOneToManyUnique<Team, UserProfile>;
export declare function getUserIdsWithoutTeam(state: GlobalState): Set<UserProfile['id']>;
export declare function getUserIdsInGroups(state: GlobalState): RelationOneToManyUnique<Group, UserProfile>;
export declare function getUserIdsNotInGroups(state: GlobalState): RelationOneToManyUnique<Group, UserProfile>;
export declare function getUserStatuses(state: GlobalState): RelationOneToOne<UserProfile, string>;
export declare function getUserSessions(state: GlobalState): any[];
export declare function getUserAudits(state: GlobalState): any[];
export declare function getUser(state: GlobalState, id: UserProfile['id']): UserProfile;
export declare function getUsersByIDs(state: GlobalState, ids: Array<UserProfile['id']>): UserProfile[];
export declare const getUsersByUsername: (a: GlobalState) => Record<string, UserProfile>;
export declare function getUserByUsername(state: GlobalState, username: UserProfile['username']): UserProfile;
export declare const getUsersByEmail: (a: GlobalState) => Record<string, UserProfile>;
export declare function getUserByEmail(state: GlobalState, email: UserProfile['email']): UserProfile;
export declare const isCurrentUserSystemAdmin: (state: GlobalState) => boolean;
export declare const isCurrentUserGuestUser: (state: GlobalState) => boolean;
export declare const currentUserHasAnAdminRole: (state: GlobalState) => boolean;
export declare const getCurrentUserRoles: (_: GlobalState) => UserProfile['roles'];
export type UserMentionKey = {
key: string;
caseSensitive?: boolean;
};
export declare const getCurrentUserMentionKeys: (state: GlobalState) => UserMentionKey[];
export type HighlightWithoutNotificationKey = {
key: string;
};
export declare const getHighlightWithoutNotificationKeys: (state: GlobalState) => HighlightWithoutNotificationKey[];
export declare const getProfileSetInCurrentChannel: (state: GlobalState) => Set<UserProfile['id']>;
export declare const getProfileSetNotInCurrentChannel: (state: GlobalState) => Set<UserProfile['id']>;
export declare const getProfileSetInCurrentTeam: (state: GlobalState) => Set<UserProfile['id']>;
export declare const getProfileSetNotInCurrentTeam: (state: GlobalState) => Set<UserProfile['id']>;
export declare const getProfiles: (state: GlobalState, filters?: Filters) => UserProfile[];
export declare function filterProfiles(profiles: IDMappedObjects<UserProfile>, filters?: Filters, memberships?: RelationOneToOne<UserProfile, TeamMembership> | RelationOneToOne<UserProfile, ChannelMembership>): IDMappedObjects<UserProfile>;
export declare function getIsManualStatusForUserId(state: GlobalState, userId: UserProfile['id']): boolean;
export declare const getProfilesInCurrentChannel: (state: GlobalState) => UserProfile[];
export declare const getActiveProfilesInCurrentChannel: (state: GlobalState) => UserProfile[];
export declare const getActiveProfilesInCurrentChannelWithoutSorting: (state: GlobalState) => UserProfile[];
export declare const getProfilesNotInCurrentChannel: (state: GlobalState, filters?: Filters) => UserProfile[];
export declare const getProfilesInCurrentTeam: (state: GlobalState, filters?: Filters) => UserProfile[];
export declare const getProfilesInTeam: (state: GlobalState, teamId: Team['id'], filters?: Filters) => UserProfile[];
export declare const getProfilesNotInTeam: (state: GlobalState, teamId: Team['id'], filters?: Filters) => UserProfile[];
export declare const getProfilesNotInCurrentTeam: (state: GlobalState) => UserProfile[];
export declare const getProfilesWithoutTeam: (state: GlobalState, filters: Filters) => UserProfile[];
export declare function getStatusForUserId(state: GlobalState, userId: UserProfile['id']): string;
export declare function getDndEndTimeForUserId(state: GlobalState, userId: UserProfile['id']): number;
export declare function getTotalUsersStats(state: GlobalState): Partial<import("@mattermost/types/users").UsersStats>;
export declare function getFilteredUsersStats(state: GlobalState): Partial<import("@mattermost/types/users").UsersStats>;
export declare function makeSearchProfilesStartingWithTerm(): (state: GlobalState, term: string, skipCurrent?: boolean, filters?: Filters) => UserProfile[];
export declare function makeSearchProfilesMatchingWithTerm(): (state: GlobalState, term: string, skipCurrent?: boolean, filters?: Filters) => UserProfile[];
export declare function makeSearchProfilesInChannel(): (state: GlobalState, channelId: Channel["id"], term: string, skipCurrent?: boolean, filters?: Filters) => UserProfile[];
export declare function searchProfilesInCurrentChannel(state: GlobalState, term: string, skipCurrent?: boolean): UserProfile[];
export declare function searchActiveProfilesInCurrentChannel(state: GlobalState, term: string, skipCurrent?: boolean): UserProfile[];
export declare function searchProfilesNotInCurrentChannel(state: GlobalState, term: string, skipCurrent?: boolean): UserProfile[];
export declare function searchProfilesInCurrentTeam(state: GlobalState, term: string, skipCurrent?: boolean, filters?: Filters): UserProfile[];
export declare function searchProfilesInTeam(state: GlobalState, teamId: Team['id'], term: string, skipCurrent?: boolean, filters?: Filters): UserProfile[];
export declare function searchProfilesNotInCurrentTeam(state: GlobalState, term: string, skipCurrent?: boolean): UserProfile[];
export declare function searchProfilesWithoutTeam(state: GlobalState, term: string, skipCurrent: boolean | undefined, filters: Filters): UserProfile[];
export declare const shouldShowTermsOfService: (state: GlobalState) => boolean;
export declare const getUsersInVisibleDMs: (state: GlobalState) => UserProfile[];
export declare function makeGetProfilesForReactions(): (state: GlobalState, reactions: Reaction[]) => UserProfile[];
/**
* Returns a selector that returns all profiles in a given channel with the given filters applied.
*
* Note that filters, if provided, must be either a constant or memoized to prevent constant recomputation of the selector.
*/
export declare function makeGetProfilesInChannel(): (state: GlobalState, channelId: Channel['id'], filters?: Filters) => UserProfile[];
/**
* Returns a selector that returns all profiles not in a given channel.
*/
export declare function makeGetProfilesNotInChannel(): (state: GlobalState, channelId: Channel['id'], filters?: Filters) => UserProfile[];
export declare function makeGetProfilesByIdsAndUsernames(): (state: GlobalState, props: {
allUserIds: Array<UserProfile['id']>;
allUsernames: Array<UserProfile['username']>;
}) => UserProfile[];
export declare function makeGetDisplayName(): (state: GlobalState, userId: UserProfile['id'], useFallbackUsername?: boolean) => string;
export declare function makeDisplayNameGetter(): (state: GlobalState, useFallbackUsername: boolean) => (user: UserProfile | null | undefined) => string;
export declare const getProfilesInGroup: (state: GlobalState, groupId: Group['id'], filters?: Filters) => UserProfile[];
export declare const getProfilesInGroupWithoutSorting: (state: GlobalState, groupId: Group['id'], filters?: Filters) => UserProfile[];
export declare const getProfilesNotInCurrentGroup: (state: GlobalState, groupId: Group['id'], filters?: Filters) => UserProfile[];
export declare function searchProfilesInGroup(state: GlobalState, groupId: Group['id'], term: string, skipCurrent?: boolean, filters?: Filters): UserProfile[];
export declare function searchProfilesInGroupWithoutSorting(state: GlobalState, groupId: Group['id'], term: string, skipCurrent?: boolean, filters?: Filters): UserProfile[];
export declare function getUserLastActivities(state: GlobalState): RelationOneToOne<UserProfile, number>;
export declare function getLastActivityForUserId(state: GlobalState, userId: UserProfile['id']): number;
export declare function checkIsFirstAdmin(currentUser: UserProfile, users: IDMappedObjects<UserProfile>): boolean;
export declare const isFirstAdmin: import("mattermost-redux/selectors/create_selector").OutputSelector<GlobalState, boolean, (res1: UserProfile, res2: IDMappedObjects<UserProfile>) => boolean>;
export declare const displayLastActiveLabel: (state: GlobalState, userId: string) => boolean;
export declare const getLastActiveTimestampUnits: (state: GlobalState, userId: string) => string[];