` +
@@ -241,6 +241,9 @@ export function MessageForwardInternal({
original_timestamp: mEvent.getTs(),
original_event_private: true,
} satisfies ForwardMeta,
+ 'com.famedly.app.forwarded': {
+ origin_server_ts: mEvent.getTs(),
+ } satisfies MSC2723ForwardMeta,
};
} else {
content = {
@@ -261,7 +264,6 @@ export function MessageForwardInternal({
'com.famedly.app.forwarded': {
event_id: eventId,
room_id: room.roomId,
- sender: null, // we won't set this field, as a design decision to avoid potential privacy issues and since the sender can be inferred from the event_id and room_id if needed
origin_server_ts: mEvent.getTs(),
} satisfies MSC2723ForwardMeta,
};
@@ -285,15 +287,16 @@ export function MessageForwardInternal({
setIsForwardSuccess(true);
})
.catch((err: unknown) => {
+ const message = err instanceof Error ? err.message : String(err);
debugLog.error('ui', 'Message forward failed', {
sourceRoomId: room.roomId,
targetRoomId: targetRoom.roomId,
- error: err instanceof Error ? err.message : String(err),
+ error: message,
});
Sentry.metrics.count('sable.message.forward.error', 1);
setIsForwarding(false);
setIsForwardSuccess(false);
- setIsForwardError(true);
+ setForwardError(message);
});
};
@@ -348,9 +351,9 @@ export function MessageForwardInternal({
Forward to {getRoom(targetRoomId)?.name}
)}
- {isForwardError && (
+ {forwardError && (
- Failed to forward message. Please try again.
+ Failed to forward: {forwardError}
)}
diff --git a/src/app/components/room-card/RoomCard.tsx b/src/app/components/room-card/RoomCard.tsx
index afd66d3c..7f9046d7 100644
--- a/src/app/components/room-card/RoomCard.tsx
+++ b/src/app/components/room-card/RoomCard.tsx
@@ -1,5 +1,5 @@
import { ReactNode, useCallback, useRef, useState } from 'react';
-import { MatrixError, Room } from '$types/matrix-sdk';
+import { JoinRule, MatrixError, Room } from '$types/matrix-sdk';
import {
Avatar,
Badge,
@@ -21,7 +21,6 @@ import classNames from 'classnames';
import FocusTrap from 'focus-trap-react';
import { getMxIdLocalPart, mxcUrlToHttp } from '$utils/matrix';
import { nameInitials } from '$utils/common';
-import { millify } from '$plugins/millify';
import { useMatrixClient } from '$hooks/useMatrixClient';
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
import { onEnterOrSpace, stopPropagation } from '$utils/keyboard';
@@ -31,7 +30,9 @@ import { useElementSizeObserver } from '$hooks/useElementSizeObserver';
import { getRoomAvatarUrl, getStateEvent } from '$utils/room';
import { useStateEventCallback } from '$hooks/useStateEventCallback';
import { useMediaAuthentication } from '$hooks/useMediaAuthentication';
+import { KnockRoomPrompt } from '$components/knock-room-prompt';
import { RoomAvatar } from '$components/room-avatar';
+import { formatCompactNumber } from '$utils/formatCompactNumber';
import * as css from './style.css';
type GridColumnCount = '1' | '2' | '3';
@@ -143,6 +144,7 @@ type RoomCardProps = {
topic?: string;
memberCount?: number;
roomType?: string;
+ joinRule?: JoinRule;
viaServers?: string[];
onView?: (roomId: string) => void;
renderTopicViewer: (name: string, topic: string, requestClose: () => void) => ReactNode;
@@ -158,6 +160,7 @@ export const RoomCard = as<'div', RoomCardProps>(
topic,
memberCount,
roomType,
+ joinRule,
viaServers,
onView,
renderTopicViewer,
@@ -172,7 +175,7 @@ export const RoomCard = as<'div', RoomCardProps>(
const [topicEvent, setTopicEvent] = useState(() =>
joinedRoom ? getStateEvent(joinedRoom, StateEvent.RoomTopic) : undefined
);
-
+ const [knocking, setKnocking] = useState(false);
const fallbackName = getMxIdLocalPart(roomIdOrAlias) ?? roomIdOrAlias;
const fallbackTopic = roomIdOrAlias;
@@ -256,7 +259,7 @@ export const RoomCard = as<'div', RoomCardProps>(
{typeof joinedMemberCount === 'number' && (
- {`${millify(joinedMemberCount)} Members`}
+ {`${formatCompactNumber(joinedMemberCount)} Members`}
)}
{typeof joinedRoomId === 'string' && (
@@ -271,19 +274,38 @@ export const RoomCard = as<'div', RoomCardProps>(
)}
- {typeof joinedRoomId !== 'string' && joinState.status !== AsyncStatus.Error && (
-
}
- >
-
- {joining ? 'Joining' : 'Join'}
-
-
- )}
+ {typeof joinedRoomId !== 'string' &&
+ joinState.status !== AsyncStatus.Error &&
+ (joinRule === JoinRule.Knock ? (
+ <>
+
+
+ {knocking && (
+
setKnocking(false)}
+ onCancel={() => setKnocking(false)}
+ />
+ )}
+ >
+ ) : (
+ }
+ >
+
+ {joining ? 'Joining' : 'Join'}
+
+
+ ))}
{typeof joinedRoomId !== 'string' && joinState.status === AsyncStatus.Error && (
{reordering && (