forked from Sarah/Lieb-Website
Added signed up options for role reminder
Added option to opt out of reminders
This commit is contained in:
parent
64ce169094
commit
c88bf5b133
18 changed files with 911 additions and 99 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue