|
26 | 26 | using osu.Game.Online.API.Requests; |
27 | 27 | using osu.Game.Online.Metadata; |
28 | 28 | using osu.Game.Online.Multiplayer; |
| 29 | +using osu.Game.Overlays.Dialog; |
29 | 30 | using osu.Game.Overlays.Notifications; |
30 | 31 | using osu.Game.Screens; |
31 | 32 | using osu.Game.Screens.Play; |
@@ -68,6 +69,9 @@ protected UserPanel(APIUser user) |
68 | 69 | [Resolved] |
69 | 70 | private ChatOverlay? chatOverlay { get; set; } |
70 | 71 |
|
| 72 | + [Resolved] |
| 73 | + private IDialogOverlay? dialogOverlay { get; set; } |
| 74 | + |
71 | 75 | [Resolved] |
72 | 76 | protected OverlayColourProvider? ColourProvider { get; private set; } |
73 | 77 |
|
@@ -163,9 +167,15 @@ public MenuItem[] ContextMenuItems |
163 | 167 | chatOverlay?.Show(); |
164 | 168 | })); |
165 | 169 |
|
166 | | - items.Add(isUserBlocked() |
167 | | - ? new OsuMenuItem(UsersStrings.BlocksButtonUnblock, MenuItemType.Standard, () => toggleBlock(false)) |
168 | | - : new OsuMenuItem(UsersStrings.BlocksButtonBlock, MenuItemType.Destructive, () => toggleBlock(true))); |
| 170 | + items.Add(!isUserBlocked() |
| 171 | + ? new OsuMenuItem(UsersStrings.BlocksButtonBlock, MenuItemType.Destructive, () => |
| 172 | + { |
| 173 | + dialogOverlay?.Push(new ConfirmBlockActionDialog(ContextMenuStrings.ConfirmBlockUser(User.Username), () => toggleBlock(true))); |
| 174 | + }) |
| 175 | + : new OsuMenuItem(UsersStrings.BlocksButtonUnblock, MenuItemType.Standard, () => |
| 176 | + { |
| 177 | + dialogOverlay?.Push(new ConfirmBlockActionDialog(ContextMenuStrings.ConfirmUnblockUser(User.Username), () => toggleBlock(false))); |
| 178 | + })); |
169 | 179 |
|
170 | 180 | if (isUserOnline()) |
171 | 181 | { |
@@ -228,5 +238,14 @@ public bool MatchingFilter |
228 | 238 | } |
229 | 239 |
|
230 | 240 | public bool FilteringActive { get; set; } |
| 241 | + |
| 242 | + private partial class ConfirmBlockActionDialog : DangerousActionDialog |
| 243 | + { |
| 244 | + public ConfirmBlockActionDialog(LocalisableString text, Action? action = null) |
| 245 | + { |
| 246 | + BodyText = text; |
| 247 | + DangerousAction = action; |
| 248 | + } |
| 249 | + } |
231 | 250 | } |
232 | 251 | } |
0 commit comments