From 7690d96b73126eb95ee4341e846d89a1f784ca0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 13 Jun 2025 13:48:29 +0200 Subject: [PATCH] Add block / unblock option to chat --- osu.Game/Overlays/Chat/DrawableChatUsername.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Overlays/Chat/DrawableChatUsername.cs b/osu.Game/Overlays/Chat/DrawableChatUsername.cs index 57338dde9f..bd39cf0253 100644 --- a/osu.Game/Overlays/Chat/DrawableChatUsername.cs +++ b/osu.Game/Overlays/Chat/DrawableChatUsername.cs @@ -28,6 +28,7 @@ using osu.Game.Online.Multiplayer; using osu.Game.Resources.Localisation.Web; using osu.Game.Screens; using osu.Game.Screens.Play; +using osu.Game.Users; using osuTK; using osuTK.Graphics; using ChatStrings = osu.Game.Localisation.ChatStrings; @@ -92,6 +93,9 @@ namespace osu.Game.Overlays.Chat [Resolved] private Bindable? currentChannel { get; set; } + [Resolved] + private IDialogOverlay? dialogOverlay { get; set; } + private readonly APIUser user; private readonly OsuSpriteText drawableText; @@ -208,6 +212,9 @@ namespace osu.Game.Overlays.Chat items.Add(new OsuMenuItemSpacer()); items.Add(new OsuMenuItem(UsersStrings.ReportButtonText, MenuItemType.Destructive, ReportRequested)); + items.Add(api.Blocks.Any(b => b.TargetID == user.OnlineID) + ? new OsuMenuItem(UsersStrings.BlocksButtonUnblock, MenuItemType.Standard, () => dialogOverlay?.Push(ConfirmBlockActionDialog.Unblock(user))) + : new OsuMenuItem(UsersStrings.BlocksButtonBlock, MenuItemType.Destructive, () => dialogOverlay?.Push(ConfirmBlockActionDialog.Block(user)))); return items.ToArray(); }