Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions app/lib/methods/helpers/mergeSubscriptionsRooms.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ export const merge = (subscription, room) => {
if (room) {
if (room._updatedAt) {
subscription.lastMessage = normalizeMessage(room.lastMessage);
if (subscription.lastMessage) {
subscription.roomUpdatedAt = subscription.lastMessage.ts;
} else {
subscription.roomUpdatedAt = room._updatedAt;
}
const updatedAt = room?._updatedAt ? new Date(room._updatedAt) : null;
const lastMessageTs = subscription?.lastMessage?.ts ? new Date(subscription.lastMessage.ts) : null;
subscription.roomUpdatedAt = Math.max(updatedAt, lastMessageTs);
subscription.description = room.description;
subscription.topic = room.topic;
subscription.announcement = room.announcement;
Expand Down
3 changes: 0 additions & 3 deletions app/presentation/RoomItem/RoomItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const RoomItem = ({
tunread,
tunreadUser,
tunreadGroup,
roomUpdatedAt,
testID,
swipeEnabled,
onPress,
Expand Down Expand Up @@ -88,7 +87,6 @@ const RoomItem = ({
alert={alert}
/>
<UpdatedAt
roomUpdatedAt={roomUpdatedAt}
date={date}
theme={theme}
hideUnreadStatus={hideUnreadStatus}
Expand Down Expand Up @@ -175,7 +173,6 @@ RoomItem.propTypes = {
tunread: PropTypes.array,
tunreadUser: PropTypes.array,
tunreadGroup: PropTypes.array,
roomUpdatedAt: PropTypes.instanceOf(Date),
swipeEnabled: PropTypes.bool,
toggleFav: PropTypes.func,
toggleRead: PropTypes.func,
Expand Down
5 changes: 2 additions & 3 deletions app/presentation/RoomItem/UpdatedAt.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { themes } from '../../constants/colors';
import { capitalize } from '../../utils/room';

const UpdatedAt = React.memo(({
roomUpdatedAt, date, theme, hideUnreadStatus, alert
date, theme, hideUnreadStatus, alert
}) => {
if (!roomUpdatedAt) {
if (!date) {
return null;
}
return (
Expand Down Expand Up @@ -39,7 +39,6 @@ const UpdatedAt = React.memo(({
});

UpdatedAt.propTypes = {
roomUpdatedAt: PropTypes.instanceOf(Date),
date: PropTypes.string,
theme: PropTypes.string,
hideUnreadStatus: PropTypes.bool,
Expand Down
3 changes: 1 addition & 2 deletions app/presentation/RoomItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class RoomItemContainer extends React.Component {
const name = getRoomTitle(item);
const avatar = getRoomAvatar(item);
const isRead = getIsRead(item);
const date = item.lastMessage?.ts && formatDate(item.lastMessage.ts);
const date = item.roomUpdatedAt && formatDate(item.roomUpdatedAt);
const alert = (item.alert || item.tunread?.length);

let accessibilityLabel = name;
Expand Down Expand Up @@ -178,7 +178,6 @@ class RoomItemContainer extends React.Component {
status={status}
hideUnreadStatus={item.hideUnreadStatus}
alert={alert}
roomUpdatedAt={item.roomUpdatedAt}
lastMessage={item.lastMessage}
showLastMessage={showLastMessage}
username={username}
Expand Down
3 changes: 1 addition & 2 deletions storybook/stories/RoomItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ const lastMessage = {
msg: longText
};
const updatedAt = {
date: '10:00',
roomUpdatedAt: new Date('2020-01-01')
date: '10:00'
};

const RoomItem = props => (
Expand Down