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