diff --git a/osu.Game/Localisation/OnlinePlayStrings.cs b/osu.Game/Localisation/OnlinePlayStrings.cs index 1853cb753a..1918519d36 100644 --- a/osu.Game/Localisation/OnlinePlayStrings.cs +++ b/osu.Game/Localisation/OnlinePlayStrings.cs @@ -14,6 +14,16 @@ namespace osu.Game.Localisation /// public static LocalisableString SupporterOnlyDurationNotice => new TranslatableString(getKey(@"supporter_only_duration_notice"), @"Playlist durations longer than 2 weeks require an active osu!supporter tag."); + /// + /// "Can't invite this user as you have blocked them or they have blocked you." + /// + public static LocalisableString InviteFailedUserBlocked => new TranslatableString(getKey(@"cant_invite_this_user_as"), @"Can't invite this user as you have blocked them or they have blocked you."); + + /// + /// "Can't invite this user as they have opted out of non-friend communications." + /// + public static LocalisableString InviteFailedUserOptOut => new TranslatableString(getKey(@"cant_invite_this_user_as1"), @"Can't invite this user as they have opted out of non-friend communications."); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs index 08e82f2ad3..20ec030eac 100644 --- a/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/OnlineMultiplayerClient.cs @@ -13,6 +13,7 @@ using osu.Framework.Bindables; using osu.Game.Online.API; using osu.Game.Online.Rooms; using osu.Game.Overlays.Notifications; +using osu.Game.Localisation; namespace osu.Game.Online.Multiplayer { @@ -124,17 +125,11 @@ namespace osu.Game.Online.Multiplayer switch (exception.GetHubExceptionMessage()) { case UserBlockedException.MESSAGE: - PostNotification?.Invoke(new SimpleErrorNotification - { - Text = "User cannot be invited by someone they have blocked or are blocked by." - }); + PostNotification?.Invoke(new SimpleErrorNotification { Text = OnlinePlayStrings.InviteFailedUserBlocked }); break; case UserBlocksPMsException.MESSAGE: - PostNotification?.Invoke(new SimpleErrorNotification - { - Text = "User cannot be invited because they cannot receive private messages from people not on their friends list." - }); + PostNotification?.Invoke(new SimpleErrorNotification { Text = OnlinePlayStrings.InviteFailedUserOptOut }); break; } } diff --git a/osu.Game/Online/Multiplayer/UserBlockedException.cs b/osu.Game/Online/Multiplayer/UserBlockedException.cs index f2b69411c7..e964b13c75 100644 --- a/osu.Game/Online/Multiplayer/UserBlockedException.cs +++ b/osu.Game/Online/Multiplayer/UserBlockedException.cs @@ -10,7 +10,7 @@ namespace osu.Game.Online.Multiplayer [Serializable] public class UserBlockedException : HubException { - public const string MESSAGE = "User cannot be invited by someone they have blocked or are blocked by."; + public const string MESSAGE = @"Cannot perform action due to user being blocked."; public UserBlockedException() : base(MESSAGE) diff --git a/osu.Game/Online/Multiplayer/UserBlocksPMsException.cs b/osu.Game/Online/Multiplayer/UserBlocksPMsException.cs index 0fd4e1f0c1..14ed6fc212 100644 --- a/osu.Game/Online/Multiplayer/UserBlocksPMsException.cs +++ b/osu.Game/Online/Multiplayer/UserBlocksPMsException.cs @@ -10,7 +10,7 @@ namespace osu.Game.Online.Multiplayer [Serializable] public class UserBlocksPMsException : HubException { - public const string MESSAGE = "User cannot be invited because they have disabled private messages."; + public const string MESSAGE = "Cannot perform action because user has disabled non-friend communications."; public UserBlocksPMsException() : base(MESSAGE)