Hide nicknames and notes on note to self

This commit is contained in:
Jamie Kyle 2024-03-28 15:28:50 -07:00 committed by GitHub
parent c14f5c4712
commit fc65917fc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 6 deletions

View file

@ -12,7 +12,10 @@ import { UserText } from '../UserText';
import { SharedGroupNames } from '../SharedGroupNames';
import { About } from './About';
import { Intl } from '../Intl';
import { areNicknamesEnabled } from '../../util/nicknames';
import {
areNicknamesEnabled,
canHaveNicknameAndNote,
} from '../../util/nicknames';
function muted(parts: Array<string | JSX.Element>) {
return (
@ -146,7 +149,7 @@ export function AboutContactModal({
<div className="AboutContactModal__row">
<i className="AboutContactModal__row__icon AboutContactModal__row__icon--profile" />
{areNicknamesEnabled() &&
{canHaveNicknameAndNote(conversation) &&
conversation.nicknameGivenName &&
conversation.titleNoNickname ? (
<span>

View file

@ -25,7 +25,7 @@ import { UserText } from '../UserText';
import { Button, ButtonIconType, ButtonVariant } from '../Button';
import { isInSystemContacts } from '../../util/isInSystemContacts';
import { InContactsIcon } from '../InContactsIcon';
import { areNicknamesEnabled } from '../../util/nicknames';
import { canHaveNicknameAndNote } from '../../util/nicknames';
export type PropsDataType = {
areWeASubscriber: boolean;
@ -306,7 +306,7 @@ export function ContactModal({
)}
<div className="ContactModal__divider" />
<div className="ContactModal__button-container">
{areNicknamesEnabled() && !contact.isMe && (
{canHaveNicknameAndNote(contact) && (
<button
type="button"
className="ContactModal__button ContactModal__block"

View file

@ -64,7 +64,7 @@ import {
import { formatDate, formatTime } from '../../../util/timestamp';
import { NavTab } from '../../../state/ducks/nav';
import { ContextMenu } from '../../ContextMenu';
import { areNicknamesEnabled } from '../../../util/nicknames';
import { canHaveNicknameAndNote } from '../../../util/nicknames';
function describeCallHistory(
i18n: LocalizerType,
@ -566,7 +566,7 @@ export function ConversationDetails({
}
/>
) : null}
{areNicknamesEnabled() && !isGroup && (
{canHaveNicknameAndNote(conversation) && (
<PanelRow
icon={
<ConversationDetailsIcon

View file

@ -2,7 +2,20 @@
// SPDX-License-Identifier: AGPL-3.0-only
import * as RemoteConfig from '../RemoteConfig';
import type { ConversationType } from '../state/ducks/conversations';
import { isSignalConnection } from './getSignalConnections';
export function areNicknamesEnabled(): boolean {
return RemoteConfig.getValue('desktop.nicknames') === 'TRUE';
}
export function canHaveNicknameAndNote(
conversation: ConversationType
): boolean {
return (
areNicknamesEnabled() &&
conversation.type === 'group' &&
!isSignalConnection(conversation) &&
!conversation.isMe
);
}