Miscellaneous website/moderation/notification fixes (#940)

This commit is contained in:
sudokoko 2023-10-30 13:46:05 -04:00 committed by GitHub
parent 0de5edca6e
commit 69855406f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 11 deletions

View file

@ -89,16 +89,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.";
StringBuilder builder = new();
// ReSharper disable once ForCanBeConvertedToForeach
// Suppressing this because we need to modify the list while iterating over it.
for (int i = 0; i < notifications.Count; i++)
foreach (NotificationEntity notification in notifications)
{
NotificationEntity n = notifications[i];
builder.AppendLine(LighthouseSerializer.Serialize(this.HttpContext.RequestServices,
GameNotification.CreateFromEntity(n)));
GameNotification.CreateFromEntity(notification)));
n.IsDismissed = true;
notification.IsDismissed = true;
}
await this.database.SaveChangesAsync();

View file

@ -43,7 +43,7 @@ public class SlotPage : BaseLayout
// Determine if user can view slot according to creator's privacy settings
this.CanViewSlot = slot.Creator.LevelVisibility.CanAccess(isAuthenticated, isOwner);
if ((slot.Hidden || slot.SubLevel && (this.User == null && this.User != slot.Creator)) && !(this.User?.IsModerator ?? false))
if ((slot.Hidden || slot.SubLevel && (this.User == null || this.User != slot.Creator)) && !(this.User?.IsModerator ?? false))
return this.NotFound();
string slotSlug = slot.GenerateSlug();

View file

@ -68,6 +68,7 @@ public class UserPage : BaseLayout
this.Slots = await this.Database.Slots.Include(p => p.Creator)
.OrderByDescending(s => s.LastUpdated)
.Where(p => p.CreatorId == userId)
.Where(p => p.Creator != null && (!p.SubLevel || p.Creator == this.User))
.Take(10)
.ToListAsync();

View file

@ -33,6 +33,9 @@ public class DismissExpiredCasesTask : IRepeatingTask
{
@case.DismissedAt = DateTime.UtcNow;
@case.DismisserUsername = "maintenance task";
@case.Processed = false;
Logger.Info($"Dismissed expired case {@case.CaseId}", LogArea.Maintenance);
}