mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: show correct user count when MAX_USERS is unlimited
MAX_USERS defaults to 0 (unlimited) but the People section displayed "1 / 0 users". Now shows "1 user" when no limit is configured.
This commit is contained in:
@@ -774,7 +774,7 @@ function PeopleSection() {
|
|||||||
u.username.toLowerCase().includes(search.toLowerCase()),
|
u.username.toLowerCase().includes(search.toLowerCase()),
|
||||||
);
|
);
|
||||||
|
|
||||||
const atLimit = users.length >= maxUsers;
|
const atLimit = maxUsers > 0 && users.length >= maxUsers;
|
||||||
|
|
||||||
const handleAddUser = useCallback(
|
const handleAddUser = useCallback(
|
||||||
async (e: React.FormEvent) => {
|
async (e: React.FormEvent) => {
|
||||||
@@ -886,7 +886,9 @@ function PeopleSection() {
|
|||||||
|
|
||||||
{/* User count */}
|
{/* User count */}
|
||||||
<p className="text-sm text-muted-foreground">
|
<p className="text-sm text-muted-foreground">
|
||||||
{users.length} / {maxUsers} users
|
{maxUsers > 0
|
||||||
|
? `${users.length} / ${maxUsers} users`
|
||||||
|
: `${users.length} ${users.length === 1 ? "user" : "users"}`}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* Action message */}
|
{/* Action message */}
|
||||||
|
|||||||
Reference in New Issue
Block a user