Fix the reaction content type and the fixable lint sites. [skip build]
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
EventTimeline,
|
||||
EventTimelineSet,
|
||||
EventTimelineSetHandlerMap,
|
||||
EventType,
|
||||
IContent,
|
||||
MatrixClient,
|
||||
MatrixEvent,
|
||||
@@ -1529,7 +1530,7 @@ export function RoomTimeline({ room, eventId, roomInputRef, editor }: RoomTimeli
|
||||
(reactions.find(eventWithShortcode)?.getContent().shortcode as string | undefined);
|
||||
mx.sendEvent(
|
||||
room.roomId,
|
||||
MessageEvent.Reaction as any,
|
||||
EventType.Reaction,
|
||||
getReactionContent(targetEventId, key, rShortcode),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -50,7 +50,8 @@ export const RoomViewTyping = as<'div', RoomViewTypingProps>(
|
||||
// One verb for everyone keeps the joined form; mixed verbs need a clause per person
|
||||
const firstVerb = verbs[typers[0].userId];
|
||||
const sameVerb = typers.every((typer) => verbs[typer.userId] === firstVerb);
|
||||
const clauses = entries.map((entry) => ({
|
||||
const clauses = entries.map((entry, index) => ({
|
||||
key: entry.plural ? 'others' : typers[index].userId,
|
||||
name: entry.name,
|
||||
suffix: `${entry.plural ? 'are' : 'is'} ${entry.verb ?? DEFAULT_VERB}`,
|
||||
}));
|
||||
@@ -81,7 +82,7 @@ export const RoomViewTyping = as<'div', RoomViewTypingProps>(
|
||||
<TypingIndicator />
|
||||
<Text className={css.TypingText} size="T300" truncate>
|
||||
{clauses.map((clause, index) => (
|
||||
<React.Fragment key={index}>
|
||||
<React.Fragment key={clause.key}>
|
||||
{index > 0 && (index === clauses.length - 1 ? ' and ' : ', ')}
|
||||
<b>{clause.name}</b>
|
||||
{!sharedSuffix && ` ${clause.suffix}`}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useMemo, useRef } from 'react';
|
||||
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { EmojiConfettiBurst } from './types';
|
||||
import {
|
||||
@@ -238,7 +238,7 @@ function LocalBurstCanvas({ burst, primaryEmoji, onComplete }: BurstCanvasProps)
|
||||
[burst.origin.maskRadius, canvasSize],
|
||||
);
|
||||
|
||||
const updateLayerPosition = () => {
|
||||
const updateLayerPosition = useCallback(() => {
|
||||
const layer = layerRef.current;
|
||||
if (!layer) return false;
|
||||
|
||||
@@ -249,7 +249,7 @@ function LocalBurstCanvas({ burst, primaryEmoji, onComplete }: BurstCanvasProps)
|
||||
layer.style.left = `${rect.left + rect.width / 2 - canvasSize / 2}px`;
|
||||
layer.style.top = `${rect.top + rect.height / 2 - canvasSize / 2}px`;
|
||||
return true;
|
||||
};
|
||||
}, [burst.targetEventId, canvasSize]);
|
||||
|
||||
useEffect(() => {
|
||||
const onScrollOrResize = () => {
|
||||
@@ -263,7 +263,7 @@ function LocalBurstCanvas({ burst, primaryEmoji, onComplete }: BurstCanvasProps)
|
||||
window.removeEventListener('scroll', onScrollOrResize, true);
|
||||
window.removeEventListener('resize', onScrollOrResize);
|
||||
};
|
||||
}, [burst.targetEventId, canvasSize]);
|
||||
}, [burst.targetEventId, canvasSize, updateLayerPosition]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!canvasRef.current || spawnedRef.current) return undefined;
|
||||
@@ -348,7 +348,7 @@ function LocalBurstCanvas({ burst, primaryEmoji, onComplete }: BurstCanvasProps)
|
||||
window.clearInterval(retry);
|
||||
frameCleanup?.();
|
||||
};
|
||||
}, [burst.id, burst.targetEventId, canvasSize, localOrigin, primaryEmoji]);
|
||||
}, [burst.id, burst.targetEventId, canvasSize, localOrigin, primaryEmoji, updateLayerPosition]);
|
||||
|
||||
return createPortal(
|
||||
<div
|
||||
|
||||
@@ -23,12 +23,12 @@ export const useSpaceFeedSelected = (): boolean => {
|
||||
return /\/feed\/?$/.test(pathname);
|
||||
};
|
||||
|
||||
export const useSpaceLobbySelected = (_spaceIdOrAlias?: string): boolean => {
|
||||
export const useSpaceLobbySelected = (): boolean => {
|
||||
const { pathname } = useLocation();
|
||||
return /\/lobby\/?$/.test(pathname);
|
||||
};
|
||||
|
||||
export const useSpaceSearchSelected = (_spaceIdOrAlias?: string): boolean => {
|
||||
export const useSpaceSearchSelected = (): boolean => {
|
||||
const { pathname } = useLocation();
|
||||
return /\/search\/?$/.test(pathname);
|
||||
};
|
||||
|
||||
@@ -113,7 +113,7 @@ async function getStatus(matrixClient: MatrixClient) {
|
||||
/**
|
||||
* Toggle microphone mute
|
||||
*/
|
||||
async function toggleMute(matrixClient: MatrixClient) {
|
||||
async function toggleMute() {
|
||||
const callService = getCallService();
|
||||
|
||||
if (!callService) {
|
||||
@@ -173,7 +173,7 @@ async function setMute(matrixClient: MatrixClient, muted: boolean) {
|
||||
/**
|
||||
* Toggle deafen (mute speakers)
|
||||
*/
|
||||
async function toggleDeafen(matrixClient: MatrixClient) {
|
||||
async function toggleDeafen() {
|
||||
const callService = getCallService();
|
||||
|
||||
if (!callService) {
|
||||
@@ -590,7 +590,7 @@ export function initPaarrotAPI(matrixClient: MatrixClient) {
|
||||
break;
|
||||
|
||||
case 'toggle-mute':
|
||||
result = await toggleMute(matrixClient);
|
||||
result = await toggleMute();
|
||||
break;
|
||||
|
||||
case 'set-mute':
|
||||
@@ -598,7 +598,7 @@ export function initPaarrotAPI(matrixClient: MatrixClient) {
|
||||
break;
|
||||
|
||||
case 'toggle-deafen':
|
||||
result = await toggleDeafen(matrixClient);
|
||||
result = await toggleDeafen();
|
||||
break;
|
||||
|
||||
case 'set-deafen':
|
||||
|
||||
@@ -323,8 +323,8 @@ export function Space() {
|
||||
const tombstoneEvent = useStateEvent(space, StateEvent.RoomTombstone);
|
||||
|
||||
const selectedRoomId = useSelectedRoom();
|
||||
const lobbySelected = useSpaceLobbySelected(spaceIdOrAlias);
|
||||
const searchSelected = useSpaceSearchSelected(spaceIdOrAlias);
|
||||
const lobbySelected = useSpaceLobbySelected();
|
||||
const searchSelected = useSpaceSearchSelected();
|
||||
|
||||
const [closedCategories, setClosedCategories] = useAtom(useClosedNavCategoriesAtom());
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
RoomMember,
|
||||
} from 'matrix-js-sdk';
|
||||
import { CryptoBackend } from 'matrix-js-sdk/lib/common-crypto/CryptoBackend';
|
||||
import type { ReactionEventContent } from 'matrix-js-sdk/lib/@types/events';
|
||||
import { IconName, IconSrc } from '../components/icons';
|
||||
import { AccountDataEvent } from '../../types/matrix/accountData';
|
||||
import {
|
||||
@@ -486,11 +487,15 @@ export const decryptAllTimelineEvent = async (mx: MatrixClient, timeline: EventT
|
||||
await Promise.allSettled(decryptionPromises);
|
||||
};
|
||||
|
||||
export const getReactionContent = (eventId: string, key: string, shortcode?: string) => ({
|
||||
export const getReactionContent = (
|
||||
eventId: string,
|
||||
key: string,
|
||||
shortcode?: string,
|
||||
): ReactionEventContent & { shortcode?: string } => ({
|
||||
'm.relates_to': {
|
||||
event_id: eventId,
|
||||
key,
|
||||
rel_type: 'm.annotation',
|
||||
rel_type: RelationType.Annotation,
|
||||
},
|
||||
shortcode,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user