* 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,
"console": "internalConsole"
},
{
"name": "Launch Frontend",
"type": "pwa-node",
"request": "launch",
"runtimeExecutable": "yarn",
"cwd": "${workspaceFolder}/ClientApp",
"runtimeArgs": ["start"],
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
],
},
{
"name": "ng serve",
"type": "chrome",

@ -17,6 +17,6 @@ export class MobileService extends ServiceHelpers {
}
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;
}
public class RemoveUserModel
{
public string UserId { get; set; }
}
[HttpPost]
[ApiExplorerSettings(IgnoreApi = true)]
[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
{
await _notification.DeleteRange(user.NotificationUserIds);

Loading…
Cancel
Save