* Fixed not being able to remove legacy mobile users #3968

pull/3970/head
tidusjar 4 years ago
parent b4b80165b9
commit 0936354df5

@ -12,6 +12,18 @@
"stopAtEntry": false, "stopAtEntry": false,
"console": "internalConsole" "console": "internalConsole"
}, },
{
"name": "Launch Frontend",
"type": "pwa-node",
"request": "launch",
"runtimeExecutable": "yarn",
"cwd": "${workspaceFolder}/ClientApp",
"runtimeArgs": ["start"],
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
],
},
{ {
"name": "ng serve", "name": "ng serve",
"type": "chrome", "type": "chrome",

@ -17,6 +17,6 @@ export class MobileService extends ServiceHelpers {
} }
public deleteUser(userId: string): Observable<boolean> { public deleteUser(userId: string): Observable<boolean> {
return this.http.post<boolean>(`${this.url}remove/`, userId, {headers: this.headers}); return this.http.post<boolean>(`${this.url}`, { userId: userId }, {headers: this.headers});
} }
} }

@ -83,12 +83,16 @@ namespace Ombi.Controllers.V1
return vm; return vm;
} }
public class RemoveUserModel
{
public string UserId { get; set; }
}
[HttpPost] [HttpPost]
[ApiExplorerSettings(IgnoreApi = true)] [ApiExplorerSettings(IgnoreApi = true)]
[Admin] [Admin]
public async Task<bool> RemoveUser([FromBody] string userId) public async Task<bool> RemoveUser([FromBody] RemoveUserModel userId)
{ {
var user = await _userManager.Users.Include(x => x.NotificationUserIds).FirstOrDefaultAsync(x => x.Id.Equals(userId, StringComparison.InvariantCultureIgnoreCase)); var user = await _userManager.Users.Include(x => x.NotificationUserIds).FirstOrDefaultAsync(x => x.Id.Equals(userId.UserId, StringComparison.InvariantCultureIgnoreCase));
try try
{ {
await _notification.DeleteRange(user.NotificationUserIds); await _notification.DeleteRange(user.NotificationUserIds);

Loading…
Cancel
Save