mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-05 21:01:28 +00:00
User settings, level settings, language and timezone selection and more. (#471)
* Initial work for user settings page * Finish user setting and slot setting pages * Don't show slot upload date on home page and fix team pick redirection * Fix upload image button alignment on mobile * Fix image upload on iPhone * Remove unused css and add selected button color * Fix login email check and bump ChromeDriver to 105 * Remove duplicated code and allow users to leave fields empty * Add unpublish button on level settings and move settings button position * Don't show edit button on mini card * Self review bug fixes and users can no longer use an in-use email
This commit is contained in:
parent
9073a8266f
commit
f6a7fe6283
53 changed files with 973 additions and 118 deletions
|
@ -25,6 +25,27 @@ public class SlotPageController : ControllerBase
|
|||
this.database = database;
|
||||
}
|
||||
|
||||
[HttpGet("unpublish")]
|
||||
public async Task<IActionResult> UnpublishSlot([FromRoute] int id)
|
||||
{
|
||||
WebToken? token = this.database.WebTokenFromRequest(this.Request);
|
||||
if (token == null) return this.Redirect("~/login");
|
||||
|
||||
Slot? targetSlot = await this.database.Slots.Include(s => s.Location).FirstOrDefaultAsync(s => s.SlotId == id);
|
||||
if (targetSlot == null) return this.Redirect("~/slots/0");
|
||||
|
||||
if (targetSlot.Location == null) throw new ArgumentNullException();
|
||||
|
||||
if (targetSlot.CreatorId != token.UserId) return this.Redirect("~/slot/" + id);
|
||||
|
||||
this.database.Locations.Remove(targetSlot.Location);
|
||||
this.database.Slots.Remove(targetSlot);
|
||||
|
||||
await this.database.SaveChangesAsync();
|
||||
|
||||
return this.Redirect("~/slots/0");
|
||||
}
|
||||
|
||||
[HttpGet("rateComment")]
|
||||
public async Task<IActionResult> RateComment([FromRoute] int id, [FromQuery] int commentId, [FromQuery] int rating)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue