feat: enhance profile editing with avatar support and UI adjustments

- Added AvatarPath to ProfileEditResult for user profile updates.
- Updated ProfileEditDialog to include avatar selection with a browse button.
- Increased dialog height to accommodate new avatar input fields.
- Implemented avatar file path handling in the profile edit dialog.

feat: introduce moderation features and user roles

- Added ServerRole enum to define user roles (Member, Mod, Admin, Owner).
- Extended User model to include role, mute, and ban status.
- Created ModerationController for user role assignment, kicking, banning, and muting.
- Implemented methods in IChatBroadcaster and SignalRBroadcaster for user moderation actions.
- Updated database schema with new columns for user roles and moderation states.

fix: ensure muted users cannot send messages

- Added mute status checks in ChatService to prevent message sending for muted users.
- Updated user presence and status handling to reflect role changes and moderation actions.

chore: update constants for ASCII art rendering

- Introduced AsciiArtHeightHalfBlock constant for improved ASCII art rendering.
This commit is contained in:
HueByte
2026-02-19 17:47:10 +01:00
parent 257ac34224
commit b4c3ebd254
28 changed files with 1457 additions and 73 deletions
+22 -4
View File
@@ -72,7 +72,8 @@ public class ChatService : IChatService
user.DisplayName,
user.NicknameColor,
UserStatus.Invisible,
user.StatusMessage);
user.StatusMessage,
user.Role);
await BroadcastToAllAsync(b => b.SendUserStatusChangedAsync(channelsBeforeDisconnect, presence));
}
@@ -139,6 +140,21 @@ public class ChatService : IChatService
var sender = await db.Users.FindAsync(userId);
// Check mute status
if (sender is not null && sender.IsMuted)
{
if (sender.MutedUntil.HasValue && sender.MutedUntil.Value <= DateTimeOffset.UtcNow)
{
sender.IsMuted = false;
sender.MutedUntil = null;
await db.SaveChangesAsync();
}
else
{
return "You are muted and cannot send messages.";
}
}
var message = new Message
{
Id = Guid.NewGuid(),
@@ -203,7 +219,8 @@ public class ChatService : IChatService
user.DisplayName,
user.NicknameColor,
status,
statusMessage);
statusMessage,
user.Role);
var channels = _presenceTracker.GetChannelsForUser(username);
await BroadcastToAllAsync(b => b.SendUserStatusChangedAsync(channels, presence));
@@ -226,7 +243,8 @@ public class ChatService : IChatService
u.DisplayName,
u.NicknameColor,
u.Status,
u.StatusMessage))
u.StatusMessage,
u.Role))
.ToListAsync();
}
@@ -264,7 +282,7 @@ public class ChatService : IChatService
return new UserProfileDto(
user.Id, user.Username, user.DisplayName, user.Bio,
user.NicknameColor, user.AvatarAscii, user.Status,
user.StatusMessage, user.CreatedAt, user.LastSeenAt);
user.StatusMessage, user.Role, user.CreatedAt, user.LastSeenAt);
}
public async Task<(string? Topic, bool Exists)> GetChannelTopicAsync(string channelName)