fix (backend): return null (instead of 0) if following/followers count is unavailable

This commit is contained in:
naskya 2024-03-17 02:03:27 +09:00
parent 517022f9b2
commit 75f277f461
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
3 changed files with 5 additions and 2 deletions

View file

@ -4,6 +4,7 @@ Breaking changes are indicated by the :warning: icon.
## Unreleased
- :warning: `followingCount` and `followersCount` in `users/show` will be `null` (instead of 0) if these values are unavailable.
- :warning: `admin/search/index-all` is removed since posts are now indexed automatically.
- New optional parameters are added to `notes/search` endpoint:
- `sinceDate`

View file

@ -513,8 +513,8 @@ export const UserRepository = db.getRepository(User).extend({
location: profile!.location,
birthday: profile!.birthday,
fields: profile!.fields,
followersCount: followersCount || 0,
followingCount: followingCount || 0,
followersCount: followersCount ?? null,
followingCount: followingCount ?? null,
notesCount: user.notesCount,
pinnedNoteIds: pins.map((pin) => pin.noteId),
pinnedNotes: Notes.packMany(

View file

@ -311,6 +311,7 @@
<span>{{ i18n.ts.notes }}</span>
</MkA>
<MkA
v-if="user.followingCount != null"
v-click-anime
:to="userPage(user, 'following')"
:class="{ active: page === 'following' }"
@ -319,6 +320,7 @@
<span>{{ i18n.ts.following }}</span>
</MkA>
<MkA
v-if="user.followersCount != null"
v-click-anime
:to="userPage(user, 'followers')"
:class="{ active: page === 'followers' }"