mirror of
https://github.com/mattermost/mattermost-mobile.git
synced 2026-11-05 10:28:54 +00:00
* Add AI-generated sparkle indicator to post headers for mobile/web parity. Users on mobile could not tell when a post was AI-generated; this surfaces the same sparkle marker as web using post props and keeps headers visible for consecutive AI posts. Co-authored-by: Cursor <cursoragent@cursor.com> * Make AI-generated indicator accessible to screen readers. CodeRabbit flagged that accessibilityLabel alone is not announced on a standard View; set accessible and accessibilityRole so VoiceOver/TalkBack can surface the AI attribution label. Co-authored-by: Cursor <cursoragent@cursor.com> * ci: retrigger docs-impact-review workflow. Prior runs failed due to Claude Code SDK initialization errors unrelated to PR changes; retry to clear the flaky check. Co-authored-by: Cursor <cursoragent@cursor.com> * Address review nits for AI-generated post indicator. Compute isAiGenerated once and only check previousPost in areConsecutivePosts. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Mattermost Build <build@mattermost.com>
216 lines
5.0 KiB
TypeScript
216 lines
5.0 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
type PostTypesUserCreatable =
|
|
| ''
|
|
| 'burn_on_read';
|
|
|
|
type PostType = PostTypesUserCreatable
|
|
| 'system_add_remove'
|
|
| 'system_add_to_channel'
|
|
| 'system_add_to_team'
|
|
| 'system_channel_deleted'
|
|
| 'system_channel_restored'
|
|
| 'system_displayname_change'
|
|
| 'system_convert_channel'
|
|
| 'system_ephemeral'
|
|
| 'system_header_change'
|
|
| 'system_join_channel'
|
|
| 'system_join_leave'
|
|
| 'system_leave_channel'
|
|
| 'system_purpose_change'
|
|
| 'system_remove_from_channel'
|
|
| 'system_ephemeral_add_to_channel'
|
|
| 'system_guest_join_channel'
|
|
| 'system_add_guest_to_chan'
|
|
| 'system_join_team'
|
|
| 'system_leave_team'
|
|
| 'system_remove_from_team'
|
|
| 'system_combined_user_activity'
|
|
| 'system_shared_chan_state'
|
|
| 'add_bot_teams_channels'
|
|
| 'system_auto_responder'
|
|
| 'custom_calls'
|
|
| 'custom_calls_recording'
|
|
| 'custom_run_update'
|
|
| 'custom_llmbot'
|
|
| 'custom_llm_postback';
|
|
|
|
type PostEmbedType = 'image' | 'message_attachment' | 'opengraph' | 'permalink';
|
|
|
|
type PostAcknowledgement = {
|
|
post_id: string;
|
|
user_id: string;
|
|
acknowledged_at: number;
|
|
}
|
|
|
|
type PostPriority = {
|
|
priority: '' | 'urgent' | 'important';
|
|
requested_ack?: boolean;
|
|
persistent_notifications?: boolean;
|
|
};
|
|
|
|
// Matches the web client's PostInfo type (GET /api/v4/posts/{post_id}/info).
|
|
// Returns channel/team metadata for a post without requiring channel membership,
|
|
// unlike GET /api/v4/posts/{post_id} which requires ReadChannelContent permission.
|
|
type PostInfo = {
|
|
channel_id: string;
|
|
channel_type: ChannelType;
|
|
channel_display_name: string;
|
|
has_joined_channel: boolean;
|
|
team_id: string;
|
|
team_type: string;
|
|
team_display_name: string;
|
|
has_joined_team: boolean;
|
|
}
|
|
|
|
type PermalinkEmbedData = {
|
|
post_id: string;
|
|
post?: Post;
|
|
team_name: string;
|
|
channel_display_name: string;
|
|
channel_type: string;
|
|
channel_id: string;
|
|
};
|
|
|
|
type PostEmbed = {
|
|
type: PostEmbedType;
|
|
url: string;
|
|
data: Record<string, any>;
|
|
};
|
|
|
|
type PostImage = {
|
|
height: number;
|
|
width: number;
|
|
format?: string;
|
|
frame_count?: number;
|
|
};
|
|
|
|
type PostTranslationState = 'ready' | 'skipped' | 'unavailable' | 'processing';
|
|
type PostTranslation = {
|
|
object: {
|
|
message: string;
|
|
};
|
|
state: PostTranslationState;
|
|
source_lang?: string;
|
|
};
|
|
|
|
type PostMetadata = {
|
|
acknowledgements?: PostAcknowledgement[];
|
|
embeds?: PostEmbed[];
|
|
emojis?: CustomEmoji[];
|
|
files?: FileInfo[];
|
|
images?: Dictionary<PostImage | undefined>;
|
|
reactions?: Reaction[];
|
|
priority?: PostPriority;
|
|
expire_at?: number;
|
|
borConfig?: PostBoRConfig;
|
|
recipients?: string[];
|
|
translations?: Record<string, PostTranslation>;
|
|
};
|
|
|
|
type Post = {
|
|
id: string;
|
|
create_at: number;
|
|
update_at: number;
|
|
edit_at: number;
|
|
delete_at: number;
|
|
is_following?: boolean;
|
|
is_pinned: boolean;
|
|
user_id: string;
|
|
channel_id: string;
|
|
root_id: string;
|
|
original_id: string;
|
|
message: string;
|
|
message_source?: string;
|
|
type: PostType;
|
|
participants?: null | UserProfile[]|string[];
|
|
props: Record<string, unknown> | undefined;
|
|
hashtags: string;
|
|
pending_post_id: string;
|
|
reply_count: number;
|
|
file_ids?: any[];
|
|
metadata: PostMetadata;
|
|
last_reply_at?: number;
|
|
user_activity_posts?: Post[];
|
|
state?: 'DELETED';
|
|
prev_post_id?: string;
|
|
};
|
|
|
|
type PostProps = {
|
|
disable_group_highlight?: boolean;
|
|
mentionHighlightDisabled: boolean;
|
|
ai_generated_by?: string;
|
|
ai_generated_by_username?: string;
|
|
};
|
|
|
|
type PostResponse = {
|
|
order: string[];
|
|
posts: IDMappedObjects<Post>;
|
|
prev_post_id?: string;
|
|
};
|
|
|
|
type SearchMatches = {[key: $ID<Post>]: string[]};
|
|
|
|
type SearchPostResponse = PostResponse & {
|
|
matches?: SearchMatches;
|
|
}
|
|
|
|
type ProcessedPosts = {
|
|
order: string[];
|
|
posts: Post[];
|
|
previousPostId?: string;
|
|
}
|
|
|
|
type MessageAttachment = {
|
|
id?: number;
|
|
fallback?: string;
|
|
color?: string;
|
|
pretext?: string;
|
|
author_name?: string;
|
|
author_link?: string;
|
|
author_icon?: string;
|
|
title?: string;
|
|
title_link?: string;
|
|
text?: string;
|
|
fields?: MessageAttachmentField[];
|
|
image_url?: string;
|
|
thumb_url?: string;
|
|
footer?: string;
|
|
footer_icon?: string;
|
|
timestamp?: number | string;
|
|
actions?: PostAction[];
|
|
};
|
|
|
|
type MessageAttachmentField = {
|
|
title?: string;
|
|
value?: any;
|
|
short?: boolean;
|
|
}
|
|
|
|
type PostSearchParams = {
|
|
terms: string;
|
|
is_or_search: boolean;
|
|
include_deleted_channels?: boolean;
|
|
time_zone_offset?: number;
|
|
page?: number;
|
|
per_page?: number;
|
|
};
|
|
|
|
type FetchPaginatedThreadOptions = {
|
|
fetchThreads?: boolean;
|
|
collapsedThreads?: boolean;
|
|
collapsedThreadsExtended?: boolean;
|
|
direction?: 'up'|'down';
|
|
fetchAll?: boolean;
|
|
perPage?: number;
|
|
fromCreateAt?: number;
|
|
fromPost?: string;
|
|
}
|
|
|
|
type PostBoRConfig = {
|
|
enabled: boolean;
|
|
borDurationSeconds: number;
|
|
borMaximumTimeToLiveSeconds: number;
|
|
}
|