Skip to content

Commit

Permalink
Hide message entry when previewing a direct chat
Browse files Browse the repository at this point in the history
  • Loading branch information
megrogan committed Jul 10, 2024
1 parent 709a992 commit df31840
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 4 deletions.
3 changes: 2 additions & 1 deletion frontend/app/src/components/home/CurrentChatHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
$: selectedChatId = client.selectedChatId;
$: selectedCommunity = client.selectedCommunity;
$: chatListScope = client.chatListScope;
$: anonUser = client.anonUser;
function clearSelection() {
dispatch("clearSelection");
Expand Down Expand Up @@ -203,7 +204,7 @@
</div>
</div>
<ActiveVideoCallResume />
{#if !readonly}
{#if !readonly && !$anonUser}
<CurrentChatMenu
bind:showSuspendUserModal
{hasPinned}
Expand Down
12 changes: 9 additions & 3 deletions frontend/app/src/components/home/MessageEntry.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
.map((t) => t.symbol.toLowerCase())
.join("|");
$: tokenMatchRegex = new RegExp(`^\/(${tokens}) *(\\d*[.,]?\\d*)$`);
$: canSendAny = client.canSendMessage(chat.id, mode);
$: anonUser = client.anonUser;
$: canSendAny = !$anonUser && client.canSendMessage(chat.id, mode);
$: permittedMessages = client.permittedMessages(chat.id, mode);
$: canEnterText =
(permittedMessages.get("text") ?? false) ||
Expand Down Expand Up @@ -561,7 +561,13 @@
{:else if !canSendAny}
<div class="disabled">
<Translatable
resourceKey={i18nKey(mode === "thread" ? "readOnlyThread" : "readOnlyChat")} />
resourceKey={i18nKey(
$anonUser
? "sendMessageDisabledAnon"
: mode === "thread"
? "readOnlyThread"
: "readOnlyChat",
)} />
</div>
{:else if $throttleDeadline > 0}
<ThrottleCountdown deadline={$throttleDeadline} />
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "发送动图",
"sendMessage": "发信息",
"sendTextDisabled": "短信已禁用",
"sendMessageDisabledAnon": "请登录以发送消息",
"sendTo": "发给...",
"sessionExpired": "登录状态已过期",
"sessionExpiredBlurb": "请重新登录",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "GIFs senden",
"sendMessage": "Nachricht senden",
"sendTextDisabled": "Textnachrichten sind deaktiviert",
"sendMessageDisabledAnon": "Bitte melden Sie sich an, um eine Nachricht zu senden",
"sendTo": "Senden an...",
"sessionExpired": "Sitzung abgelaufen",
"sessionExpiredBlurb": "Bitte neu anmelden",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "Send gif",
"sendMessage": "Send message",
"sendTextDisabled": "Text messages are disabled",
"sendMessageDisabledAnon": "Please sign-in to send a message",
"sendTo": "Send to...",
"sessionExpired": "Session Expired",
"sessionExpiredBlurb": "Please sign in again",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "Enviar gif",
"sendMessage": "Enviar mensaje",
"sendTextDisabled": "Los mensajes de texto están deshabilitados",
"sendMessageDisabledAnon": "Por favor inicia sesión para enviar un mensaje",
"sendTo": "Enviar a...",
"sessionExpired": "La sesión ha expirado",
"sessionExpiredBlurb": "Inicia sesión de nuevo",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "Envoyer un GIF",
"sendMessage": "Envoyer le message",
"sendTextDisabled": "Les messages texte sont désactivés",
"sendMessageDisabledAnon": "Veuillez vous connecter pour envoyer un message",
"sendTo": "Envoyer à...",
"sessionExpired": "La session a expiré",
"sessionExpiredBlurb": "Veuillez vous reconnecter",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "जीआईएफ भेजें",
"sendMessage": "मेसेज भेजें",
"sendTextDisabled": "पाठ संदेश अक्षम हैं",
"sendMessageDisabledAnon": "एक संदेश भेजने के लिए साइन इन करें",
"sendTo": "भेजना...",
"sessionExpired": "सत्र समाप्त हुआ",
"sessionExpiredBlurb": "कृपया पुनः साइन इन करें",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "Invia gif",
"sendMessage": "Invia messaggio",
"sendTextDisabled": "I messaggi di testo sono disabilitati",
"sendMessageDisabledAnon": "Accedi per inviare un messaggio",
"sendTo": "Inviare a...",
"sessionExpired": "Sessione scaduta",
"sessionExpiredBlurb": "Accedi di nuovo",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/iw.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "שלח GIF",
"sendMessage": "לשלוח הודעה",
"sendTextDisabled": "הודעות טקסט מושבתות",
"sendMessageDisabledAnon": "אנא היכנס כדי לשלוח הודעה",
"sendTo": "לשלוח ל...",
"sessionExpired": "פג תוקף ההפעלה",
"sessionExpiredBlurb": "נא להיכנס שוב",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/jp.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "gifを送信",
"sendMessage": "メッセージを送る",
"sendTextDisabled": "テキストメッセージが無効になっています",
"sendMessageDisabledAnon": "メッセージを送信するにはサインインしてください",
"sendTo": "に送る...",
"sessionExpired": "セッションは終了しました",
"sessionExpiredBlurb": "再度サインインしてください",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "Отправить гифку",
"sendMessage": "Отправить сообщение",
"sendTextDisabled": "Текстовые сообщения отключены",
"sendMessageDisabledAnon": "Пожалуйста авторизируйтесь, чтобы отправить сообщение",
"sendTo": "Отправить...",
"sessionExpired": "Сессия истекла",
"sessionExpiredBlurb": "Пожалуйста, войдите еще раз",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "Надіслати gif",
"sendMessage": "Відправити повідомлення",
"sendTextDisabled": "Текстові повідомлення вимкнено",
"sendMessageDisabledAnon": "Будь ласка, увійдіть, щоб надіслати повідомлення",
"sendTo": "Відправити...",
"sessionExpired": "Сеанс закінчився",
"sessionExpiredBlurb": "Увійдіть знову",
Expand Down
1 change: 1 addition & 0 deletions frontend/app/src/i18n/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@
"sendGif": "Gửi gif",
"sendMessage": "Gửi tin nhắn",
"sendTextDisabled": "Tin nhắn văn bản bị vô hiệu hóa",
"sendMessageDisabledAnon": "Vui lòng đăng nhập để gửi tin nhắn",
"sendTo": "Gửi đến...",
"sessionExpired": "Phiên sử dụng đã hết hạn",
"sessionExpiredBlurb": "Xin đăng nhập lại",
Expand Down

0 comments on commit df31840

Please sign in to comment.