diff --git a/MixItUp.Base/Model/Actions/ModerationActionModel.cs b/MixItUp.Base/Model/Actions/ModerationActionModel.cs index 00cc7d92f..b74e47f3f 100644 --- a/MixItUp.Base/Model/Actions/ModerationActionModel.cs +++ b/MixItUp.Base/Model/Actions/ModerationActionModel.cs @@ -84,10 +84,12 @@ protected override async Task PerformInternal(CommandParametersModel parameters) } else if (this.ActionType == ModerationActionTypeEnum.ModUser) { + targetUser.Roles.Add(User.UserRoleEnum.Moderator); await ServiceManager.Get().ModUser(targetUser); } else if (this.ActionType == ModerationActionTypeEnum.UnmodUser) { + targetUser.Roles.Remove(User.UserRoleEnum.Moderator); await ServiceManager.Get().UnmodUser(targetUser); } else if (this.ActionType == ModerationActionTypeEnum.AddModerationStrike) diff --git a/MixItUp.Base/Model/Actions/TwitchActionModel.cs b/MixItUp.Base/Model/Actions/TwitchActionModel.cs index 75fb503e9..16daa3f93 100644 --- a/MixItUp.Base/Model/Actions/TwitchActionModel.cs +++ b/MixItUp.Base/Model/Actions/TwitchActionModel.cs @@ -1,7 +1,9 @@ using MixItUp.Base.Model.Commands; +using MixItUp.Base.Model.User.Platform; using MixItUp.Base.Services; using MixItUp.Base.Services.Twitch; using MixItUp.Base.Util; +using MixItUp.Base.ViewModel.User; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; @@ -315,29 +317,29 @@ protected override async Task PerformInternal(CommandParametersModel parameters) } else if (this.ActionType == TwitchActionType.VIPUser || this.ActionType == TwitchActionType.UnVIPUser) { - string targetUsername = null; + UserV2ViewModel targetUser = null; if (!string.IsNullOrEmpty(this.Username)) { - targetUsername = await ReplaceStringWithSpecialModifiers(this.Username, parameters); + string targetUsername = await ReplaceStringWithSpecialModifiers(this.Username, parameters); + targetUser = await ServiceManager.Get().GetUserByPlatformUsername(StreamingPlatformTypeEnum.Twitch, targetUsername, performPlatformSearch: true); } else { - targetUsername = parameters.User.Username; + targetUser = parameters.User; } - if (!string.IsNullOrEmpty(targetUsername)) + if (targetUser != null) { - UserModel targetUser = await ServiceManager.Get().UserConnection.GetNewAPIUserByLogin(targetUsername); - if (targetUser != null) + UserModel twitchUser = targetUser.GetPlatformData(StreamingPlatformTypeEnum.Twitch).GetTwitchNewAPIUserModel(); + if (this.ActionType == TwitchActionType.VIPUser) { - if (this.ActionType == TwitchActionType.VIPUser) - { - await ServiceManager.Get().UserConnection.VIPUser(ServiceManager.Get().User, targetUser); - } - else if (this.ActionType == TwitchActionType.UnVIPUser) - { - await ServiceManager.Get().UserConnection.UnVIPUser(ServiceManager.Get().User, targetUser); - } + targetUser.Roles.Add(User.UserRoleEnum.TwitchVIP); + await ServiceManager.Get().UserConnection.VIPUser(ServiceManager.Get().User, twitchUser); + } + else if (this.ActionType == TwitchActionType.UnVIPUser) + { + targetUser.Roles.Remove(User.UserRoleEnum.TwitchVIP); + await ServiceManager.Get().UserConnection.UnVIPUser(ServiceManager.Get().User, twitchUser); } } }