Remove TAnyMessageModel completely

This commit is contained in:
Diego Mello 2022-11-29 14:57:30 -03:00
parent c0b3daa225
commit 4ca5e3a0a7
3 changed files with 7 additions and 8 deletions

View File

@ -151,7 +151,6 @@ export type TMessageModel = IMessage &
asPlain: () => IMessage; asPlain: () => IMessage;
}; };
export type TAnyMessageModel = TMessageModel | TThreadModel | TThreadMessageModel;
export type TAnyMessage = IMessage | IThread | IThreadMessage; export type TAnyMessage = IMessage | IThread | IThreadMessage;
export type TTypeMessages = IMessageFromServer | ILoadMoreMessage | IMessage; export type TTypeMessages = IMessageFromServer | ILoadMoreMessage | IMessage;

View File

@ -5,7 +5,7 @@ import { IItem } from '../views/TeamChannelsView';
import { IOptionsField } from '../views/NotificationPreferencesView/options'; import { IOptionsField } from '../views/NotificationPreferencesView/options';
import { IServer } from '../definitions/IServer'; import { IServer } from '../definitions/IServer';
import { IAttachment } from '../definitions/IAttachment'; import { IAttachment } from '../definitions/IAttachment';
import { IMessage, TAnyMessageModel, TMessageModel } from '../definitions/IMessage'; import { IMessage, TAnyMessage, TMessageModel } from '../definitions/IMessage';
import { ISubscription, SubscriptionType, TSubscriptionModel } from '../definitions/ISubscription'; import { ISubscription, SubscriptionType, TSubscriptionModel } from '../definitions/ISubscription';
import { ICannedResponse } from '../definitions/ICannedResponse'; import { ICannedResponse } from '../definitions/ICannedResponse';
import { TDataSelect } from '../definitions/IDataSelect'; import { TDataSelect } from '../definitions/IDataSelect';
@ -37,7 +37,7 @@ export type ChatsStackParamList = {
roomUserId?: string | null; roomUserId?: string | null;
usedCannedResponse?: string; usedCannedResponse?: string;
status?: string; status?: string;
replyInDM?: TAnyMessageModel; replyInDM?: TAnyMessage;
} }
| undefined; // Navigates back to RoomView already on stack | undefined; // Navigates back to RoomView already on stack
RoomActionsView: { RoomActionsView: {

View File

@ -27,7 +27,7 @@ import {
SubscriptionType, SubscriptionType,
IAttachment, IAttachment,
IMessage, IMessage,
TAnyMessageModel, TAnyMessage,
IUrl, IUrl,
TGetCustomEmoji, TGetCustomEmoji,
ICustomEmoji ICustomEmoji
@ -160,7 +160,7 @@ class MessagesView extends React.Component<IMessagesViewProps, IMessagesViewStat
defineMessagesViewContent = (name: string) => { defineMessagesViewContent = (name: string) => {
const { user, baseUrl, theme, useRealName } = this.props; const { user, baseUrl, theme, useRealName } = this.props;
const renderItemCommonProps = (item: TAnyMessageModel) => ({ const renderItemCommonProps = (item: TAnyMessage) => ({
item, item,
baseUrl, baseUrl,
user, user,
@ -219,7 +219,7 @@ class MessagesView extends React.Component<IMessagesViewProps, IMessagesViewStat
}, },
noDataMsg: I18n.t('No_mentioned_messages'), noDataMsg: I18n.t('No_mentioned_messages'),
testID: 'mentioned-messages-view', testID: 'mentioned-messages-view',
renderItem: (item: TAnyMessageModel) => <Message {...renderItemCommonProps(item)} msg={item.msg} theme={theme} /> renderItem: (item: TAnyMessage) => <Message {...renderItemCommonProps(item)} msg={item.msg} theme={theme} />
}, },
// Starred Messages Screen // Starred Messages Screen
Starred: { Starred: {
@ -230,7 +230,7 @@ class MessagesView extends React.Component<IMessagesViewProps, IMessagesViewStat
}, },
noDataMsg: I18n.t('No_starred_messages'), noDataMsg: I18n.t('No_starred_messages'),
testID: 'starred-messages-view', testID: 'starred-messages-view',
renderItem: (item: TAnyMessageModel) => ( renderItem: (item: TAnyMessage) => (
<Message {...renderItemCommonProps(item)} msg={item.msg} onLongPress={() => this.onLongPress(item)} theme={theme} /> <Message {...renderItemCommonProps(item)} msg={item.msg} onLongPress={() => this.onLongPress(item)} theme={theme} />
), ),
action: (message: IMessage) => ({ action: (message: IMessage) => ({
@ -249,7 +249,7 @@ class MessagesView extends React.Component<IMessagesViewProps, IMessagesViewStat
}, },
noDataMsg: I18n.t('No_pinned_messages'), noDataMsg: I18n.t('No_pinned_messages'),
testID: 'pinned-messages-view', testID: 'pinned-messages-view',
renderItem: (item: TAnyMessageModel) => ( renderItem: (item: TAnyMessage) => (
<Message {...renderItemCommonProps(item)} msg={item.msg} onLongPress={() => this.onLongPress(item)} theme={theme} /> <Message {...renderItemCommonProps(item)} msg={item.msg} onLongPress={() => this.onLongPress(item)} theme={theme} />
), ),
action: () => ({ title: I18n.t('Unpin'), icon: 'pin', onPress: this.handleActionPress }), action: () => ({ title: I18n.t('Unpin'), icon: 'pin', onPress: this.handleActionPress }),