mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-23 03:25:07 +03:00
Compare commits
2 Commits
+8
-4
@@ -14,12 +14,16 @@ COPY . .
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ARG NODE_ENV=production
|
ARG NODE_ENV=production
|
||||||
|
# Overridable at build time. Must be a real http(s) URL — never a compose ${...} stub.
|
||||||
ARG VITE_API_BASE_URL=https://api.fromchat.ru
|
ARG VITE_API_BASE_URL=https://api.fromchat.ru
|
||||||
ENV NODE_ENV=production
|
|
||||||
ENV VITE_API_BASE_URL=${VITE_API_BASE_URL}
|
|
||||||
|
|
||||||
# 1.3. Build production assets
|
# Fail the build if the arg is not a real URL (e.g. unexpanded Compose ${...}).
|
||||||
RUN npm run frontend:build
|
RUN if ! printf "%s" "${VITE_API_BASE_URL}" | grep -Eq '^https?://'; then \
|
||||||
|
echo "ERROR: VITE_API_BASE_URL must be an http(s) URL, got: ${VITE_API_BASE_URL}" >&2; \
|
||||||
|
exit 1; \
|
||||||
|
fi && \
|
||||||
|
export NODE_ENV=production VITE_API_BASE_URL && \
|
||||||
|
npm run frontend:build
|
||||||
|
|
||||||
|
|
||||||
# 2. Production web static server
|
# 2. Production web static server
|
||||||
|
|||||||
@@ -22,6 +22,16 @@ export function isDeletedPeer(user: {
|
|||||||
return isDeletedUser(user) || isDeletedAccountUsername(user.username);
|
return isDeletedUser(user) || isDeletedAccountUsername(user.username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Peers should treat suspended accounts like deleted (no PII). */
|
||||||
|
export function isRedactedPeer(user: {
|
||||||
|
id?: number;
|
||||||
|
deleted?: boolean;
|
||||||
|
suspended?: boolean;
|
||||||
|
username?: string | null;
|
||||||
|
}): boolean {
|
||||||
|
return isDeletedPeer(user) || isSuspendedUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
export const DELETED_ACCOUNT_LABEL = "Deleted account";
|
export const DELETED_ACCOUNT_LABEL = "Deleted account";
|
||||||
|
|
||||||
export function deletedUserLabel(): string {
|
export function deletedUserLabel(): string {
|
||||||
@@ -33,8 +43,9 @@ export function displayNameForUser(user: {
|
|||||||
display_name?: string | null;
|
display_name?: string | null;
|
||||||
username?: string | null;
|
username?: string | null;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
suspended?: boolean;
|
||||||
}): string {
|
}): string {
|
||||||
if (isDeletedPeer(user)) {
|
if (isRedactedPeer(user)) {
|
||||||
return deletedUserLabel();
|
return deletedUserLabel();
|
||||||
}
|
}
|
||||||
return user.display_name?.trim() || user.username?.trim() || "";
|
return user.display_name?.trim() || user.username?.trim() || "";
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { onlineStatusManager } from "@/core/onlineStatusManager";
|
|||||||
import { OnlineIndicator } from "@/pages/chat/ui/right/OnlineIndicator";
|
import { OnlineIndicator } from "@/pages/chat/ui/right/OnlineIndicator";
|
||||||
import defaultAvatar from "@/images/default-avatar.png";
|
import defaultAvatar from "@/images/default-avatar.png";
|
||||||
import { MaterialBadge, MaterialCircularProgress, MaterialIcon, MaterialList, MaterialListItem } from "@/utils/material";
|
import { MaterialBadge, MaterialCircularProgress, MaterialIcon, MaterialList, MaterialListItem } from "@/utils/material";
|
||||||
import { displayNameForUser, isDeletedPeer } from "@/core/userDisplay";
|
import { displayNameForUser, isRedactedPeer } from "@/core/userDisplay";
|
||||||
import { DeletedUserAvatar } from "@/core/DeletedUserAvatar";
|
import { DeletedUserAvatar } from "@/core/DeletedUserAvatar";
|
||||||
import styles from "@/pages/chat/css/left-panel.module.scss";
|
import styles from "@/pages/chat/css/left-panel.module.scss";
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ export function UnifiedChatsList() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const isDeletedDm = isDeletedPeer(chat);
|
const isDeletedDm = isRedactedPeer(chat);
|
||||||
const displayName = displayNameForUser({ ...chat, id: chat.id });
|
const displayName = displayNameForUser({ ...chat, id: chat.id });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { useImmer } from "use-immer";
|
|||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
import { parseProfileLink } from "@/core/profileLinks";
|
import { parseProfileLink } from "@/core/profileLinks";
|
||||||
import { MaterialCircularProgress, MaterialIconButton, MaterialList, MaterialListItem } from "@/utils/material";
|
import { MaterialCircularProgress, MaterialIconButton, MaterialList, MaterialListItem } from "@/utils/material";
|
||||||
import { displayNameForUser, isDeletedPeer } from "@/core/userDisplay";
|
import { displayNameForUser, isRedactedPeer } from "@/core/userDisplay";
|
||||||
import { DeletedUserAvatar } from "@/core/DeletedUserAvatar";
|
import { DeletedUserAvatar } from "@/core/DeletedUserAvatar";
|
||||||
import styles from "@/pages/chat/css/Message.module.scss";
|
import styles from "@/pages/chat/css/Message.module.scss";
|
||||||
import replyPreviewStyles from "@/pages/chat/css/reply-preview.module.scss";
|
import replyPreviewStyles from "@/pages/chat/css/reply-preview.module.scss";
|
||||||
@@ -519,7 +519,7 @@ export function Message({ message, isAuthor, onContextMenu, onReactionClick, isD
|
|||||||
return messageText.length > 0 && emojiRegex.test(messageText) && messageText.length <= 4; // Most emojis are 1-4 characters
|
return messageText.length > 0 && emojiRegex.test(messageText) && messageText.length <= 4; // Most emojis are 1-4 characters
|
||||||
}, [messageText]);
|
}, [messageText]);
|
||||||
|
|
||||||
const isDeletedSender = isDeletedPeer({ id: message.user_id, username: message.username });
|
const isDeletedSender = isRedactedPeer({ id: message.user_id, username: message.username });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user