snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
import type { IMessage } from '@rocket.chat/core-typings';
|
||||
import type { KeyboardEvent, MouseEvent } from 'react';
|
||||
import { createContext, useContext } from 'react';
|
||||
|
||||
import type { useFormatDate } from '../../../hooks/useFormatDate';
|
||||
import type { useFormatDateAndTime } from '../../../hooks/useFormatDateAndTime';
|
||||
import type { useFormatTime } from '../../../hooks/useFormatTime';
|
||||
|
||||
export type MessageListContextValue = {
|
||||
autoTranslate: {
|
||||
showAutoTranslate: (message: IMessage) => boolean;
|
||||
autoTranslateLanguage?: string;
|
||||
autoTranslateEnabled: boolean;
|
||||
};
|
||||
autoLinkDomains: string;
|
||||
useShowStarred: ({ message }: { message: IMessage }) => boolean;
|
||||
useShowFollowing: ({ message }: { message: IMessage }) => boolean;
|
||||
useMessageDateFormatter: () => (date: Date) => string;
|
||||
useUserHasReacted: (message: IMessage) => (reaction: string) => boolean;
|
||||
useOpenEmojiPicker: (message: IMessage) => (event: MouseEvent | KeyboardEvent) => void;
|
||||
showRoles: boolean;
|
||||
showRealName: boolean;
|
||||
showUsername: boolean;
|
||||
highlights?: {
|
||||
highlight: string;
|
||||
regex: RegExp;
|
||||
urlRegex: RegExp;
|
||||
}[];
|
||||
katex?: {
|
||||
dollarSyntaxEnabled: boolean;
|
||||
parenthesisSyntaxEnabled: boolean;
|
||||
};
|
||||
autoTranslateLanguage?: string;
|
||||
showColors: boolean;
|
||||
jumpToMessageParam?: string;
|
||||
username: string | undefined;
|
||||
apiEmbedEnabled: boolean;
|
||||
readReceipts: {
|
||||
enabled: boolean;
|
||||
storeUsers: boolean;
|
||||
};
|
||||
formatDateAndTime: ReturnType<typeof useFormatDateAndTime>;
|
||||
formatTime: ReturnType<typeof useFormatTime>;
|
||||
formatDate: ReturnType<typeof useFormatDate>;
|
||||
};
|
||||
|
||||
export const messageListContextDefaultValue: MessageListContextValue = {
|
||||
autoTranslate: {
|
||||
showAutoTranslate: () => false,
|
||||
autoTranslateLanguage: undefined,
|
||||
autoTranslateEnabled: false,
|
||||
},
|
||||
useShowStarred: () => false,
|
||||
useShowFollowing: () => false,
|
||||
useUserHasReacted: () => (): boolean => false,
|
||||
useMessageDateFormatter:
|
||||
() =>
|
||||
(date: Date): string =>
|
||||
date.toString(),
|
||||
useOpenEmojiPicker: () => (): void => undefined,
|
||||
showRoles: false,
|
||||
showRealName: false,
|
||||
showUsername: false,
|
||||
showColors: false,
|
||||
username: undefined,
|
||||
apiEmbedEnabled: false,
|
||||
readReceipts: {
|
||||
enabled: false,
|
||||
storeUsers: false,
|
||||
},
|
||||
autoLinkDomains: '',
|
||||
formatDateAndTime: () => '',
|
||||
formatTime: () => '',
|
||||
formatDate: () => '',
|
||||
};
|
||||
|
||||
export const MessageListContext = createContext<MessageListContextValue>(messageListContextDefaultValue);
|
||||
|
||||
export const useShowTranslated: MessageListContextValue['autoTranslate']['showAutoTranslate'] = (...args) =>
|
||||
useContext(MessageListContext).autoTranslate.showAutoTranslate(...args);
|
||||
export const useShowStarred: MessageListContextValue['useShowStarred'] = (...args) =>
|
||||
useContext(MessageListContext).useShowStarred(...args);
|
||||
export const useShowFollowing: MessageListContextValue['useShowFollowing'] = (...args) =>
|
||||
useContext(MessageListContext).useShowFollowing(...args);
|
||||
export const useMessageDateFormatter: MessageListContextValue['useMessageDateFormatter'] = (...args) =>
|
||||
useContext(MessageListContext).useMessageDateFormatter(...args);
|
||||
export const useMessageListShowRoles = (): MessageListContextValue['showRoles'] => useContext(MessageListContext).showRoles;
|
||||
export const useMessageListShowRealName = (): MessageListContextValue['showRealName'] => useContext(MessageListContext).showRealName;
|
||||
export const useMessageListShowUsername = (): MessageListContextValue['showUsername'] => useContext(MessageListContext).showUsername;
|
||||
export const useMessageListHighlights = (): MessageListContextValue['highlights'] => useContext(MessageListContext).highlights;
|
||||
export const useMessageListJumpToMessageParam = (): MessageListContextValue['jumpToMessageParam'] =>
|
||||
useContext(MessageListContext).jumpToMessageParam;
|
||||
|
||||
export const useUserHasReacted: MessageListContextValue['useUserHasReacted'] = (message: IMessage) =>
|
||||
useContext(MessageListContext).useUserHasReacted(message);
|
||||
export const useOpenEmojiPicker: MessageListContextValue['useOpenEmojiPicker'] = (...args) =>
|
||||
useContext(MessageListContext).useOpenEmojiPicker(...args);
|
||||
|
||||
export const useMessageListShowColors = (): MessageListContextValue['showColors'] => useContext(MessageListContext).showColors;
|
||||
|
||||
export const useMessageListKatex = (): MessageListContextValue['katex'] => useContext(MessageListContext).katex;
|
||||
|
||||
export const useMessageListReadReceipts = (): MessageListContextValue['readReceipts'] => useContext(MessageListContext).readReceipts;
|
||||
|
||||
export const useMessageListAutoTranslate = (): MessageListContextValue['autoTranslate'] => useContext(MessageListContext).autoTranslate;
|
||||
|
||||
export const useMessageListOembedEnabled = (): MessageListContextValue['apiEmbedEnabled'] => useContext(MessageListContext).apiEmbedEnabled;
|
||||
|
||||
export const useMessageListAutoLinkDomains = (): MessageListContextValue['autoLinkDomains'] =>
|
||||
useContext(MessageListContext).autoLinkDomains;
|
||||
|
||||
export const useMessageListFormatDateAndTime = (): MessageListContextValue['formatDateAndTime'] =>
|
||||
useContext(MessageListContext).formatDateAndTime;
|
||||
|
||||
export const useMessageListFormatTime = (): MessageListContextValue['formatTime'] => useContext(MessageListContext).formatTime;
|
||||
export const useMessageListFormatDate = (): MessageListContextValue['formatDate'] => useContext(MessageListContext).formatDate;
|
||||
Reference in New Issue
Block a user