[FIX] MessagesView duplicating content (#2307)
* Fix Pagination duplicacy * Fix MessageView Duplicate Content * [FIX] Return fetch func Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com>
This commit is contained in:
parent
52b82e5809
commit
42df5ddbc1
|
@ -78,9 +78,7 @@ class MessagesView extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
defineMessagesViewContent = (name) => {
|
defineMessagesViewContent = (name) => {
|
||||||
const { messages } = this.state;
|
|
||||||
const { user, baseUrl, theme } = this.props;
|
const { user, baseUrl, theme } = this.props;
|
||||||
|
|
||||||
const renderItemCommonProps = item => ({
|
const renderItemCommonProps = item => ({
|
||||||
item,
|
item,
|
||||||
baseUrl,
|
baseUrl,
|
||||||
|
@ -101,6 +99,7 @@ class MessagesView extends React.Component {
|
||||||
Files: {
|
Files: {
|
||||||
name: I18n.t('Files'),
|
name: I18n.t('Files'),
|
||||||
fetchFunc: async() => {
|
fetchFunc: async() => {
|
||||||
|
const { messages } = this.state;
|
||||||
const result = await RocketChat.getFiles(this.rid, this.t, messages.length);
|
const result = await RocketChat.getFiles(this.rid, this.t, messages.length);
|
||||||
return { ...result, messages: result.files };
|
return { ...result, messages: result.files };
|
||||||
},
|
},
|
||||||
|
@ -125,12 +124,15 @@ class MessagesView extends React.Component {
|
||||||
// Mentions Messages Screen
|
// Mentions Messages Screen
|
||||||
Mentions: {
|
Mentions: {
|
||||||
name: I18n.t('Mentions'),
|
name: I18n.t('Mentions'),
|
||||||
fetchFunc: () => RocketChat.getMessages(
|
fetchFunc: () => {
|
||||||
|
const { messages } = this.state;
|
||||||
|
return RocketChat.getMessages(
|
||||||
this.rid,
|
this.rid,
|
||||||
this.t,
|
this.t,
|
||||||
{ 'mentions._id': { $in: [user.id] } },
|
{ 'mentions._id': { $in: [user.id] } },
|
||||||
messages.length
|
messages.length
|
||||||
),
|
);
|
||||||
|
},
|
||||||
noDataMsg: I18n.t('No_mentioned_messages'),
|
noDataMsg: I18n.t('No_mentioned_messages'),
|
||||||
testID: 'mentioned-messages-view',
|
testID: 'mentioned-messages-view',
|
||||||
renderItem: item => (
|
renderItem: item => (
|
||||||
|
@ -144,12 +146,15 @@ class MessagesView extends React.Component {
|
||||||
// Starred Messages Screen
|
// Starred Messages Screen
|
||||||
Starred: {
|
Starred: {
|
||||||
name: I18n.t('Starred'),
|
name: I18n.t('Starred'),
|
||||||
fetchFunc: () => RocketChat.getMessages(
|
fetchFunc: () => {
|
||||||
|
const { messages } = this.state;
|
||||||
|
return RocketChat.getMessages(
|
||||||
this.rid,
|
this.rid,
|
||||||
this.t,
|
this.t,
|
||||||
{ 'starred._id': { $in: [user.id] } },
|
{ 'starred._id': { $in: [user.id] } },
|
||||||
messages.length
|
messages.length
|
||||||
),
|
);
|
||||||
|
},
|
||||||
noDataMsg: I18n.t('No_starred_messages'),
|
noDataMsg: I18n.t('No_starred_messages'),
|
||||||
testID: 'starred-messages-view',
|
testID: 'starred-messages-view',
|
||||||
renderItem: item => (
|
renderItem: item => (
|
||||||
|
@ -166,7 +171,10 @@ class MessagesView extends React.Component {
|
||||||
// Pinned Messages Screen
|
// Pinned Messages Screen
|
||||||
Pinned: {
|
Pinned: {
|
||||||
name: I18n.t('Pinned'),
|
name: I18n.t('Pinned'),
|
||||||
fetchFunc: () => RocketChat.getMessages(this.rid, this.t, { pinned: true }, messages.length),
|
fetchFunc: () => {
|
||||||
|
const { messages } = this.state;
|
||||||
|
return RocketChat.getMessages(this.rid, this.t, { pinned: true }, messages.length);
|
||||||
|
},
|
||||||
noDataMsg: I18n.t('No_pinned_messages'),
|
noDataMsg: I18n.t('No_pinned_messages'),
|
||||||
testID: 'pinned-messages-view',
|
testID: 'pinned-messages-view',
|
||||||
renderItem: item => (
|
renderItem: item => (
|
||||||
|
|
Loading…
Reference in New Issue