mattermost-mobile-upstream/types/api/channels.d.ts
cursor[bot] 0869dc8eab
[MM-62038] Fix urgent mention badge colors (#10119)
* [MM-62038] Fix urgent mention badge colors

Persist urgent mention counts and use them to render channel list badges with the urgent color treatment.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* Address CodeRabbit feedback on urgent mention count persistence

Skip unread updates when fetchMyChannel fails so persisted urgent
counts are not cleared, and preserve urgentMentionCount on partial
MyChannel transformer updates.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* Use should... names for urgent mention transformer tests

CodeRabbit requested the parameterized transformMyChannelRecord cases
start with should, matching the repo test-name guideline.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* Address PR feedback: 1 answered, 1 resolved, 0 declined

Persist urgent mention counts on the native killed-app push path
so in-app channel list badges stay urgent-colored after a cold start.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* Persist computed is_unread on iOS MyChannel update path

CodeRabbit flagged isUnreadCol <- isUnreadCol, which is a no-op.
Write the computed isUnread value so native push updates store
recalculated unread state, matching the insert path and Android.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* Address PR feedback: 2 answered, 1 resolved, 0 declined

Use the active theme's buttonColor for urgent mention badge text
instead of hardcoded Denim.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

* Address PR feedback: 1 answered, 1 resolved, 0 declined

Treat omitted urgent_mention_count as 0 in transformMyChannelRecord.

Co-authored-by: mattermost-code <matty-code@mattermost.com>

---------

Co-authored-by: Matty Code <mattycode@mattycode-3.com>
Co-authored-by: mattermost-code <matty-code@mattermost.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-09-14 14:03:53 -04:00

193 lines
4.8 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
type ChannelType = 'O' | 'P' | 'D' | 'G' | 'BO' | 'BP';
type ChannelStats = {
channel_id: string;
guest_count: number;
member_count: number;
pinnedpost_count: number;
files_count: number;
};
type NotificationLevel = 'default' | 'all' | 'mention' | 'none';
type ChannelNotifyProps = {
desktop: NotificationLevel;
email: NotificationLevel;
mark_unread: 'all' | 'mention';
push: NotificationLevel;
ignore_channel_mentions: 'default' | 'off' | 'on';
channel_auto_follow_threads: 'on' | 'off';
push_threads: 'all' | 'mention';
};
type Channel = {
id: string;
create_at: number;
update_at: number;
delete_at: number;
team_id: string;
type: ChannelType;
display_name: string;
name: string;
header: string;
purpose: string;
last_post_at: number;
last_root_post_at?: number;
total_msg_count: number;
total_msg_count_root?: number;
extra_update_at: number;
creator_id: string;
scheme_id: string|null;
isCurrent?: boolean;
teammate_id?: string;
status?: string;
fake?: boolean;
group_constrained: boolean|null;
shared: boolean;
banner_info?: ChannelBannerInfo;
autotranslation?: boolean;
/** Whether the channel has Attribute-Based Access Control (ABAC) policy enforcement enabled, controlling access based on user attributes */
policy_enforced?: boolean;
};
type ChannelPatch = {
name?: string;
display_name?: string;
header?: string;
purpose?: string;
group_constrained?: boolean|null;
autotranslation?: boolean;
};
type ChannelWithTeamData = Channel & {
team_display_name: string;
team_name: string;
team_update_at: number;
}
type ChannelMember = {
id?: string;
channel_id: string;
user_id: string;
scheme_admin?: boolean;
}
type ChannelMembership = {
id?: string;
channel_id: string;
user_id: string;
roles: string;
last_viewed_at: number;
msg_count: number;
msg_count_root?: number;
mention_count: number;
mention_count_root?: number;
notify_props: Partial<ChannelNotifyProps>;
last_post_at?: number;
last_root_post_at?: number;
last_update_at: number;
scheme_user?: boolean;
scheme_admin?: boolean;
post_root_id?: string;
is_unread?: boolean;
manually_unread?: boolean;
autotranslation_disabled?: boolean;
urgent_mention_count?: number;
};
type ChannelUnread = {
channel_id: string;
user_id: string;
team_id: string;
msg_count: number;
mention_count: number;
last_viewed_at: number;
deltaMsgs: number;
};
type ChannelsState = {
currentChannelId: string;
channels: IDMappedObjects<Channel>;
channelsInTeam: RelationOneToMany<Team, Channel>;
myMembers: RelationOneToOne<Channel, ChannelMembership>;
membersInChannel: RelationOneToOne<Channel, UserIDMappedObjects<ChannelMembership>>;
stats: RelationOneToOne<Channel, ChannelStats>;
groupsAssociatedToChannel: any;
totalCount: number;
manuallyUnread: RelationOneToOne<Channel, boolean>;
channelMemberCountsByGroup: RelationOneToOne<Channel, ChannelMemberCountsByGroup>;
};
type ChannelModeration = {
name: string;
roles: {
guests?: {
value: boolean;
enabled: boolean;
};
members: {
value: boolean;
enabled: boolean;
};
};
};
type ChannelModerationPatch = {
name: string;
roles: {
guests?: boolean;
members?: boolean;
};
};
type ChannelMemberCountByGroup = {
group_id: string;
channel_member_count: number;
channel_member_timezones_count: number;
};
type ChannelMemberCountsByGroup = Record<string, ChannelMemberCountByGroup>;
type ChannelBookmarkType = 'link' | 'file';
type ChannelBookmark = {
id: string;
create_at: number;
update_at: number;
delete_at: number;
channel_id: string;
owner_id: string;
file_id?: string;
display_name: string;
sort_order: number;
link_url?: string;
image_url?: string;
emoji?: string;
type: ChannelBookmarkType;
original_id?: string;
parent_id?: string;
}
type ChannelBookmarkWithFileInfo = ChannelBookmark & {
file?: FileInfo;
}
type UpdateChannelBookmarkResponse = {
updated: ChannelBookmarkWithFileInfo;
deleted?: ChannelBookmarkWithFileInfo;
}
type ChannelBannerInfo = {
enabled?: boolean;
text?: string;
background_color?: string;
}
type ChannelAccessControlAttributes = Record<string, string[]>;
/** Connected workspace (remote cluster) for shared channels */
type RemoteClusterInfo = {
remote_id: string;
name: string;
display_name: string;
create_at: number;
delete_at: number;
last_ping_at: number;
site_url?: string;
};