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(media): change media sorting to addedTime descending #1019

Merged
merged 2 commits into from
Nov 10, 2023

Conversation

dcshzj
Copy link
Contributor

@dcshzj dcshzj commented Nov 7, 2023

Problem

The ordering of the media files should be by the addedTime in descending order.

Solution

Breaking Changes

  • Yes - this PR contains breaking changes
  • No - this PR is backwards compatible with ALL of the following feature flags in this doc

Improvements:

  • The media files are now sorted by the addedTime in descending order for users on GGS (i.e. email-login users).
    • Unfortunately, it is very expensive to get the addedTime for each file from the GitHub API, as there is no concept of creation timestamp (since it is entirely based on commits). We currently do get this information when individual files are requested, but it would get very expensive if we do this for all files at once.
    • Hence, we are retaining the existing behaviour of sorting by the file name for GitHub-login users, but we will let email-login users have the sorting by addedTime.

Tests

Unit tests, smoke tests on the frontend.

  • Navigate to any site and visit the images workspace as an email-login user
  • Verify that the images are sorted by their added time in descending order
  • Navigate to any site and visit the images workspace as a GitHub-login user
  • Verify that the images are still sorted by their file names in ascending order

Deploy Notes

None

@dcshzj dcshzj requested a review from a team November 7, 2023 03:30
Copy link
Contributor

@seaerchin seaerchin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double checking - we only sort by recency for email users? for github users still sort by name

@@ -927,6 +927,7 @@ export default class GitFileSystemService {
sha,
path,
size: type === "dir" ? 0 : stats.size,
addedTime: stats.birthtimeMs,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we not need this for github?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, why not use stats.mtimeMs (last modified time - see here)

Copy link
Contributor

@seaerchin seaerchin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw write up

@dcshzj dcshzj merged commit 3151d07 into develop Nov 10, 2023
20 checks passed
@mergify mergify bot deleted the fix/change-media-orderby branch November 10, 2023 05:18
@harishv7 harishv7 mentioned this pull request Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants