mattermost-redux
Version:
Common code (API client, Redux stores, logic, utility functions) for building a Mattermost client
38 lines (37 loc) • 2.48 kB
TypeScript
import type { Channel } from '@mattermost/types/channels';
import type { Post, PostType, PostMetadata, PostEmbed } from '@mattermost/types/posts';
import type { GlobalState } from '@mattermost/types/store';
import type { Team } from '@mattermost/types/teams';
import type { UserProfile } from '@mattermost/types/users';
export declare function isSystemMessage(post: Post): boolean;
export declare function isMeMessage(post: Post): boolean;
export declare function isFromWebhook(post: Post): boolean;
export declare function isPostEphemeral(post: Post): boolean;
export declare function isUserAddedInChannel(post: Post, userId?: UserProfile['id']): boolean;
export declare function shouldIgnorePost(post: Post, userId?: UserProfile['id']): boolean;
export declare function isUserActivityPost(postType: PostType): boolean;
export declare function isPostOwner(userId: UserProfile['id'], post: Post): boolean;
export declare function isEdited(post: Post): boolean;
export declare function canEditPost(state: GlobalState, config: any, license: any, teamId: Team['id'], channelId: Channel['id'], userId: UserProfile['id'], post: Post): boolean;
export declare function getLastCreateAt(postsArray: Post[]): number;
/**
* If the user has "Show Join/Leave Messages" disabled, this function will return true if the post should be hidden if it's of type join/leave.
* The post object passed in must be not null/undefined.
* @returns Returns true if a post should be hidden
*/
export declare function shouldFilterJoinLeavePost(post: Post, showJoinLeave: boolean, currentUsername: string): boolean;
export declare function isPostPendingOrFailed(post: Post): boolean;
export declare function comparePosts(a: Post, b: Post): number;
export declare function isPostCommentMention({ post, currentUser, threadRepliedToByCurrentUser, rootPost }: {
post: Post;
currentUser: UserProfile;
threadRepliedToByCurrentUser: boolean;
rootPost: Post;
}): boolean;
export declare function fromAutoResponder(post: Post): boolean;
export declare function getEmbedFromMetadata(metadata: PostMetadata): PostEmbed | null;
export declare function isPermalink(post: Post): boolean;
export declare function shouldUpdatePost(receivedPost: Post, storedPost?: Post): boolean;
export declare function ensureString(v: unknown): string;
export declare function ensureNumber(v: unknown): number;
export declare function secureGetFromRecord<T>(v: Record<string, T> | undefined, key: string): T | undefined;