Skip to content

Commit ac9dc7b

Browse files
authored
Don't block duplicate slot uploads on republishes (#1120)
* Don't block duplicate slot uploads on republishes * Change publisher check to use user id instead of slot creator id * Add check to /publish
1 parent 43c79b6 commit ac9dc7b

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

ProjectLighthouse.Servers.GameServer/Controllers/Slots/PublishController.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ await this.database.SendNotification(user.UserId,
7474
return this.BadRequest();
7575
}
7676

77+
// Prevent duplicate slot uploads unless the original slot creator is the new creator
7778
if (!ServerConfiguration.Instance.UserGeneratedContentLimits.DuplicateSlotUploadingEnabled
78-
&& await this.database.Slots.AnyAsync(s => s.RootLevel == slot.RootLevel))
79+
&& await this.database.Slots.AnyAsync(s => s.RootLevel == slot.RootLevel && s.CreatorId != user.UserId))
7980
{
8081
Logger.Warn("Rejecting level upload, rootlevel is duplicate", LogArea.Publish);
8182
await this.database.SendNotification(user.UserId,
@@ -149,6 +150,16 @@ await this.database.SendNotification(user.UserId,
149150
$"{slot.Name} failed to publish. (LH-PUB-0003)");
150151
return this.BadRequest();
151152
}
153+
154+
if (!ServerConfiguration.Instance.UserGeneratedContentLimits.DuplicateSlotUploadingEnabled
155+
&& await this.database.Slots.AnyAsync(s => s.RootLevel == slot.RootLevel && s.CreatorId != user.UserId))
156+
{
157+
Logger.Warn("Rejecting level upload, rootlevel is duplicate", LogArea.Publish);
158+
await this.database.SendNotification(user.UserId,
159+
$"{slot.Name} failed to publish. (LH-PUB-0011)");
160+
return this.BadRequest();
161+
}
162+
152163
// Yes Rider, this isn't null
153164
Debug.Assert(slot.Resources != null, "slot.ResourceList != null");
154165

0 commit comments

Comments
 (0)