Skip to content

Commit

Permalink
[IMPROVE] System messages consistency (#4461)
Browse files Browse the repository at this point in the history
* fix sys messages

* update snapshot

* update snapshot

* add username

* wip

* wip

* change to switch and fix types

* wip

* new translations

* update snapshot

* Update app/containers/message/utils.ts

Co-authored-by: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com>

* fix types and return

* remove unused translation

* fix types

* remove unused params

* minor tweak

* update story

Co-authored-by: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com>
Co-authored-by: Reinaldo Neto <reinaldonetof@hotmail.com>
  • Loading branch information
3 people authored Oct 21, 2022
1 parent 761aef2 commit 16e11c7
Show file tree
Hide file tree
Showing 19 changed files with 273 additions and 412 deletions.

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions app/containers/message/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import I18n from '../../i18n';
import styles from './styles';
import Markdown, { MarkdownPreview } from '../markdown';
import User from './User';
import { SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME, getInfoMessage } from './utils';
import { messageHaveAuthorName, getInfoMessage } from './utils';
import MessageContext from './Context';
import { IMessageContent } from './interfaces';
import { useTheme } from '../../theme';
import { themes } from '../../lib/constants';
import { MessageTypesValues } from '../../definitions';

const Content = React.memo(
(props: IMessageContent) => {
Expand All @@ -26,8 +27,7 @@ const Content = React.memo(
{infoMessage}
</Text>
);

if (SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME.includes(props.type)) {
if (messageHaveAuthorName(props.type as MessageTypesValues)) {
return (
<Text>
<User {...props} /> {renderMessageContent}
Expand Down
7 changes: 3 additions & 4 deletions app/containers/message/User.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useTheme } from '../../theme';
import sharedStyles from '../../views/Styles';
import messageStyles from './styles';
import MessageContext from './Context';
import { SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME } from './utils';
import { MessageType, SubscriptionType } from '../../definitions';
import { messageHaveAuthorName } from './utils';
import { MessageType, MessageTypesValues, SubscriptionType } from '../../definitions';
import { IRoomInfoParam } from '../../views/SearchMessagesView';
import RightIcons from './Components/RightIcons';

Expand Down Expand Up @@ -88,8 +88,7 @@ const User = React.memo(
{aliasUsername}
</>
);

if (SYSTEM_MESSAGE_TYPES_WITH_AUTHOR_NAME.includes(type)) {
if (messageHaveAuthorName(type as MessageTypesValues)) {
return (
<Text
style={[styles.usernameInfoMessage, { color: themes[theme].titleText }]}
Expand Down
Loading

0 comments on commit 16e11c7

Please sign in to comment.