1
0
Fork 0
forked from forgejo/forgejo

Refactor all .length === 0 patterns in JS (#30045)

This pattern comes of often during review, so let's fix it once and for
all. Did not test, but changes are trivial enough imho.

(cherry picked from commit 8fe26fb314f1710139728d9118b455fc6a16cce2)
This commit is contained in:
silverwind 2024-03-25 19:37:55 +01:00 committed by Earl Warren
parent c5745f9d24
commit c55e30ff13
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
14 changed files with 31 additions and 40 deletions

View file

@ -103,7 +103,7 @@ export default {
this.menuVisible = !this.menuVisible;
// load our commits when the menu is not yet visible (it'll be toggled after loading)
// and we got no commits
if (this.commits.length === 0 && this.menuVisible && !this.isLoading) {
if (!this.commits.length && this.menuVisible && !this.isLoading) {
this.isLoading = true;
try {
await this.fetchCommits();
@ -216,7 +216,7 @@ export default {
<div
v-if="lastReviewCommitSha != null" role="menuitem"
class="vertical item"
:class="{disabled: commitsSinceLastReview === 0}"
:class="{disabled: !commitsSinceLastReview}"
@keydown.enter="changesSinceLastReviewClick()"
@click="changesSinceLastReviewClick()"
>