Updating cards to display accurate latest change timestamp (#3201)

Updating cards to display accurate latest change timestamp
This commit is contained in:
Mike Ellan 2021-03-22 11:58:30 -07:00 committed by GitHub
parent fd46942a6f
commit 1052e2c489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -363,7 +363,18 @@ class WrapperHome extends React.PureComponent<Props, State> {
? apiSpec.modified
: workspaceModified;
let log = <TimeFromNow timestamp={modifiedLocally} />;
// Span spec, workspace and sync related timestamps for card last modified label and sort order
const lastModifiedFrom = [
workspace?.modified,
workspaceMeta?.modified,
apiSpec?.modified,
workspaceMeta?.cachedGitLastCommitTime,
];
const lastModifiedTimestamp = lastModifiedFrom
.filter(isNotNullOrUndefined)
.sort(descendingNumberSort)[0];
let log = <TimeFromNow timestamp={lastModifiedTimestamp} />;
let branch = lastActiveBranch;
if (
workspace.scope === WorkspaceScopeKeys.design &&
@ -429,16 +440,6 @@ class WrapperHome extends React.PureComponent<Props, State> {
return null;
}
const lastModifiedFrom = [
workspace?.modified,
workspaceMeta?.modified,
apiSpec?.modified,
workspaceMeta?.cachedGitLastCommitTime,
];
const lastModifiedTimestamp = lastModifiedFrom
.filter(isNotNullOrUndefined)
.sort(descendingNumberSort)[0];
const card = (
<Card
key={apiSpec._id}