Added signed up options for role reminder

Added option to opt out of reminders
This commit is contained in:
Sarah Faey 2022-12-09 22:26:16 +01:00
parent 64ce169094
commit c88bf5b133
18 changed files with 911 additions and 99 deletions

View file

@ -95,6 +95,7 @@ namespace Lieb.Data
context.RoleAssignments.Add(roleAssignment);
await context.SaveChangesAsync();
}
await _discordService.SendReminderOptOutMessage(newUser.Id);
}
public async Task EditUser(LiebUser user)
@ -343,5 +344,17 @@ namespace Lieb.Data
}
}
}
public async Task<bool> ReminderOptOut(ulong userId)
{
using var context = _contextFactory.CreateDbContext();
LiebUser? user = await context.LiebUsers
.FirstOrDefaultAsync(u => u.Id == userId);
if(user == null) return false;
user.ReminderSubscription = false;
await context.SaveChangesAsync();
return true;
}
}
}