@page "/admin/users" @using Iceshrimp.Backend.Components.Admin @using Iceshrimp.Backend.Core.Configuration @using Iceshrimp.Backend.Core.Database.Tables @using Microsoft.EntityFrameworkCore @using Microsoft.Extensions.Options @inherits AdminComponentBase @foreach (var user in _users) { }
Username Status Actions
@@@user.Username @{ var text = "Active"; if (user.IsSuspended) text = "Suspended"; if (user.IsAdmin) text += ", Administrator"; if (user.IsModerator) text += ", Moderator"; } @text @if (user.Id == AuthUser.Id) { It's you! } else { if (!user.IsSuspended) { Suspend } else { Unsuspend } | Purge | Delete }
@if (_users is []) {

No users found.

} else {

Listing @_count local users. @if (Options.Value.Registrations == Enums.Registrations.Invite) { Registrations are invite-only. Generate invite! } else if (Options.Value.Registrations == Enums.Registrations.Open) { Registrations are open. } else { Registrations are closed. }

} @if (Offset is > 0) { } else { } @if (_users.Length == 50) { } else { } @code { [Inject] public required IOptionsSnapshot Options { get; set; } [CascadingParameter] public required User AuthUser { get; set; } [SupplyParameterFromQuery] public int? Offset { get; set; } private User[] _users = []; private int _count; protected override async Task OnGet() { var query = Database.Users.Where(p => p.IsLocalUser && !p.IsSystemUser); _users = await query.OrderBy(p => p.Id).Skip(Offset ?? 0).Take(50).ToArrayAsync(); _count = await query.CountAsync(); } }