Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/30868: Incorrect group displayed #31424

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7804843
fix incorrect group displayed
DylanDylann Nov 16, 2023
4f5a617
fix merge main
DylanDylann Nov 21, 2023
2252f7c
fix merge main
DylanDylann Nov 23, 2023
cb0782f
fix does not update timestamp with empty report
DylanDylann Nov 27, 2023
c32c0c9
fix merge conflict
DylanDylann Nov 28, 2023
7988973
fix lint
DylanDylann Nov 28, 2023
87f5f0e
fix add comment
DylanDylann Nov 30, 2023
cadc716
fix add comment
DylanDylann Nov 30, 2023
dd11d73
Merge branch 'Expensify:main' into fix/30868-difference-group-chat-ap…
DylanDylann Dec 1, 2023
87c8aae
fix merge main
DylanDylann Dec 1, 2023
410e3d4
fix add comments to logic
DylanDylann Dec 1, 2023
5a89b41
fix additional space
DylanDylann Dec 1, 2023
3355279
fix try to fix performance issue
DylanDylann Dec 1, 2023
a41c14c
Merge branch 'main' into fix/30868-difference-group-chat-appear-when-…
DylanDylann Dec 2, 2023
1ed435f
fix merge main
DylanDylann Dec 5, 2023
6ac934c
fix try to fix performance regression
DylanDylann Dec 5, 2023
9ae4d5b
fix remove space
DylanDylann Dec 5, 2023
8423ed6
fix update when going back
DylanDylann Dec 5, 2023
7cd02ab
fix jest test 1
DylanDylann Dec 5, 2023
4da0520
fix jest test 1
DylanDylann Dec 5, 2023
07f8ea5
fix disable update timestamp when back
DylanDylann Dec 5, 2023
37f11e5
fix performance regression
DylanDylann Dec 5, 2023
34dc79f
fix reassure error
DylanDylann Dec 6, 2023
32400c4
fix reassure regression
DylanDylann Dec 6, 2023
df2ab5e
fix merge main
DylanDylann Dec 12, 2023
83d3864
fix merge main
DylanDylann Dec 15, 2023
b80d70e
fix merge main
DylanDylann Dec 15, 2023
e64c615
fix remove console log
DylanDylann Dec 15, 2023
1f8552c
fix remove comment
DylanDylann Dec 15, 2023
17a67d7
fix lint
DylanDylann Dec 15, 2023
fe8dfde
Merge branch 'main' into fix/30868-difference-group-chat-appear-when-…
DylanDylann Dec 20, 2023
06dfd19
fix filter function
DylanDylann Dec 21, 2023
3959145
fix sort function
DylanDylann Dec 21, 2023
9feb1d2
fix lint issue
DylanDylann Dec 21, 2023
3240264
fix comment
DylanDylann Dec 26, 2023
d9dd286
fix add comment to prop
DylanDylann Dec 29, 2023
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
4 changes: 4 additions & 0 deletions src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ function isReportApproved(report) {
*/
function sortReportsByLastRead(reports) {
return _.chain(reports)
.map((report) => {
const lastReadTime = lodashGet(report, 'lastVisitTime') || lodashGet(report, 'lastReadTime');
return {...report, lastReadTime};
})
.toArray()
.filter((report) => report && report.reportID && report.lastReadTime)
.sortBy('lastReadTime')
Expand Down
12 changes: 12 additions & 0 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -2506,6 +2506,17 @@ function searchInServer(searchInput) {
debouncedSearchInServer(searchInput);
}

/**
* @param {String} reportID
*/

DylanDylann marked this conversation as resolved.
Show resolved Hide resolved
function updateLastVisitTime(reportID) {
if (!ReportUtils.isValidReportIDFromPath(reportID)) {
return;
}
Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, {lastVisitTime: DateUtils.getDBTime()});
}

export {
searchInServer,
addComment,
Expand Down Expand Up @@ -2567,4 +2578,5 @@ export {
openRoomMembersPage,
savePrivateNotesDraft,
getDraftPrivateNote,
updateLastVisitTime,
};
8 changes: 8 additions & 0 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ function ReportScreen({
const [listHeight, setListHeight] = useState(0);

const reportID = getReportID(route);

useEffect(() => {
if (!reportID) {
return;
}
Report.updateLastVisitTime(reportID);
}, [reportID]);

DylanDylann marked this conversation as resolved.
Show resolved Hide resolved
const {addWorkspaceRoomOrChatPendingAction, addWorkspaceRoomOrChatErrors} = ReportUtils.getReportOfflinePendingActionAndErrors(report);
const screenWrapperStyle = [styles.appContent, styles.flex1, {marginTop: viewportOffsetTop}];

Expand Down
Loading