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

[#1917] Commits view: sort everything in reverse chronological order #2024

Merged
merged 5 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,12 @@ describe('hide all commit messages ', () => {

// commit body of the merge commit should be visible
cy.get('#tab-zoom .commit-message .body')
.eq(1)
.eq(0)
.should('be.visible');

// commit body of the md commit should not be visible
cy.get('#tab-zoom .commit-message .body')
.eq(0)
.eq(1)
.should('not.be.visible');

// commit body of the java commit should be visible
Expand Down
19 changes: 18 additions & 1 deletion frontend/src/views/c-zoom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,24 @@ export default defineComponent({
).sort(this.sortingFunction);
}

return new User(filteredUser);
const tempUser: User = { ...filteredUser };
tempUser.commits = [];
filteredUser.commits.forEach((commit) => {
const newCommit = { ...commit };
newCommit.commitResults = [];

if (this.commitsSortType === CommitsSortType.Time) {
newCommit.commitResults = this.toReverseSortedCommits
? commit.commitResults.slice().reverse()
: commit.commitResults.slice();
} else {
const cResultsSortingFunction = (a: CommitResult, b: CommitResult) => (this.toReverseSortedCommits ? -1 : 1)
* window.comparator((cResult: CommitResult) => cResult.insertions)(a, b);
newCommit.commitResults = commit.commitResults.slice().sort(cResultsSortingFunction);
}
tempUser.commits.push(newCommit);
});
return new User(tempUser);
},

selectedCommits(): Commit[] {
Expand Down
Loading