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;
};
export type TAnyMessageModel = TMessageModel | TThreadModel | TThreadMessageModel;
export type TAnyMessage = IMessage | IThread | IThreadMessage;
export type TTypeMessages = IMessageFromServer | ILoadMoreMessage | IMessage;

View File

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

View File

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