Initial Poll message receive support

This commit is contained in:
yash-signal
2025-09-18 11:06:43 -05:00
committed by GitHub
parent 976a3135e5
commit 93ae2a4c48
15 changed files with 1072 additions and 6 deletions

View File

@@ -96,6 +96,10 @@ import { isPaymentNotificationEvent } from '../../types/Payment.js';
import type { AnyPaymentEvent } from '../../types/Payment.js';
import { getPaymentEventDescription } from '../../messages/helpers.js';
import { PanelType } from '../../types/Panels.js';
import {
type PollMessageAttribute,
isPollReceiveEnabled,
} from '../../types/Polls.js';
import { openLinkInWebBrowser } from '../../util/openLinkInWebBrowser.js';
import { RenderLocation } from './MessageTextRenderer.js';
import { UserText } from '../UserText.js';
@@ -301,6 +305,7 @@ export type PropsData = {
attachments?: ReadonlyArray<AttachmentForUIType>;
giftBadge?: GiftBadgeType;
payment?: AnyPaymentEvent;
poll?: PollMessageAttribute;
quote?: {
conversationColor: ConversationColorType;
conversationTitle: string;
@@ -2074,6 +2079,23 @@ export class Message extends React.PureComponent<Props, State> {
);
}
public renderPoll(): JSX.Element | null {
const { poll, direction } = this.props;
if (!poll || !isPollReceiveEnabled()) {
return null;
}
return (
<div
className={classNames(
'module-message__text',
`module-message__text--${direction}`
)}
>
<pre>{JSON.stringify(poll, null, 2)}</pre>
</div>
);
}
#doubleCheckMissingQuoteReference = () => {
return this.props.doubleCheckMissingQuoteReference(this.props.id);
};
@@ -2973,6 +2995,7 @@ export class Message extends React.PureComponent<Props, State> {
{this.renderPreview()}
{this.renderAttachmentTooBig()}
{this.renderPayment()}
{this.renderPoll()}
{this.renderEmbeddedContact()}
{this.renderText()}
{this.renderUndownloadableTextAttachment()}