Skip to content

Commit 56ad99b

Browse files
authored
Merge branch 'main' into show-own-reuploads-as-real-publisher
2 parents 58eb3b0 + b81f609 commit 56ad99b

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

‎Refresh.Database/GameDatabaseContext.Levels.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ public void ApplyLevelMetadataFromAttributes(GameLevel level, bool save = false)
646646
Dictionary<string, string> levelAttributes = LevelPrefixes.ExtractAttributes(level.Description);
647647

648648
// Get original publisher from ?op.{username} or ?op:{username} otherwise Unknown
649-
level.OriginalPublisher = levelAttributes.GetValueOrDefault("op") ?? SystemUsers.UnknownUserName;
649+
level.OriginalPublisher = levelAttributes.GetValueOrDefault("op");
650650
}
651651

652652
if (save)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Microsoft.EntityFrameworkCore.Infrastructure;
2+
using Microsoft.EntityFrameworkCore.Migrations;
3+
4+
#nullable disable
5+
6+
namespace Refresh.Database.Migrations
7+
{
8+
[DbContext(typeof(GameDatabaseContext))]
9+
[Migration("20250725200929_FixIncorrectOpAttributeBehavior")]
10+
/// <inheritdoc />
11+
public partial class FixIncorrectOpAttributeBehavior : Migration
12+
{
13+
/// <inheritdoc />
14+
protected override void Up(MigrationBuilder migrationBuilder)
15+
{
16+
migrationBuilder.Sql("UPDATE \"GameLevels\" SET \"OriginalPublisher\" = null WHERE \"OriginalPublisher\" = '!Unknown'");
17+
}
18+
19+
/// <inheritdoc />
20+
protected override void Down(MigrationBuilder migrationBuilder)
21+
{
22+
// no-op, this is part of a bugfix
23+
}
24+
}
25+
}

‎RefreshTests.GameServer/Tests/Levels/ReuploadDetectionTests.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void ReuploadDetectedInTitle(string suffix)
3535
using (Assert.EnterMultipleScope())
3636
{
3737
Assert.That(level.IsReUpload, Is.True);
38-
Assert.That(level.OriginalPublisher, Is.EqualTo(SystemUsers.UnknownUserName));
38+
Assert.That(level.OriginalPublisher, Is.Null);
3939
}
4040
}
4141

0 commit comments

Comments
 (0)