mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 22:27:25 +08:00
Merge pull request #1371 from peppy/fix-duplicate-user
Fix beatmap author being stored in two different places
This commit is contained in:
commit
838e1ccd25
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
Artist = @"Unknown",
|
||||
Title = @"Sample Beatmap",
|
||||
Author = @"peppy",
|
||||
AuthorString = @"peppy",
|
||||
},
|
||||
},
|
||||
ControlPointInfo = controlPointInfo
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.AreEqual("Soleily", meta.Artist);
|
||||
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
||||
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
||||
Assert.AreEqual("Gamu", meta.Author);
|
||||
Assert.AreEqual("Gamu", meta.AuthorString);
|
||||
Assert.AreEqual("machinetop_background.jpg", meta.BackgroundFile);
|
||||
Assert.AreEqual(164471, meta.PreviewTime);
|
||||
Assert.AreEqual(string.Empty, meta.Source);
|
||||
@ -143,4 +143,4 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
Assert.AreEqual("Soleily", meta.Artist);
|
||||
Assert.AreEqual("Soleily", meta.ArtistUnicode);
|
||||
Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
|
||||
Assert.AreEqual("Deif", meta.Author);
|
||||
Assert.AreEqual("Deif", meta.AuthorString);
|
||||
Assert.AreEqual("machinetop_background.jpg", meta.BackgroundFile);
|
||||
Assert.AreEqual(164471, meta.PreviewTime);
|
||||
Assert.AreEqual(string.Empty, meta.Source);
|
||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
Artist = @"Unknown",
|
||||
Title = @"Unknown",
|
||||
Author = @"Unknown Creator",
|
||||
AuthorString = @"Unknown Creator",
|
||||
},
|
||||
Version = @"Normal",
|
||||
Difficulty = new BeatmapDifficulty()
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Users;
|
||||
using SQLite.Net.Attributes;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
@ -19,8 +20,21 @@ namespace osu.Game.Beatmaps
|
||||
public string Artist { get; set; }
|
||||
public string ArtistUnicode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Helper property to deserialize a username to <see cref="User"/>.
|
||||
/// </summary>
|
||||
[JsonProperty(@"creator")]
|
||||
public string Author { get; set; }
|
||||
[Column("Author")]
|
||||
public string AuthorString
|
||||
{
|
||||
get { return Author?.Username; }
|
||||
set { Author = new User { Username = value }; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The author of the beatmaps in this set.
|
||||
/// </summary>
|
||||
public User Author;
|
||||
|
||||
public string Source { get; set; }
|
||||
|
||||
@ -32,7 +46,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public string[] SearchableTerms => new[]
|
||||
{
|
||||
Author,
|
||||
Author?.Username,
|
||||
Artist,
|
||||
ArtistUnicode,
|
||||
Title,
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
@ -12,11 +11,6 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public class BeatmapSetOnlineInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The author of the beatmaps in this set.
|
||||
/// </summary>
|
||||
public User Author;
|
||||
|
||||
/// <summary>
|
||||
/// The date this beatmap set was submitted to the online listing.
|
||||
/// </summary>
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
Artist = "please load a beatmap!",
|
||||
Title = "no beatmaps available!",
|
||||
Author = "no one",
|
||||
AuthorString = "no one",
|
||||
},
|
||||
BeatmapSet = new BeatmapSetInfo(),
|
||||
Difficulty = new BeatmapDifficulty
|
||||
|
@ -171,7 +171,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
metadata.ArtistUnicode = pair.Value;
|
||||
break;
|
||||
case @"Creator":
|
||||
metadata.Author = pair.Value;
|
||||
metadata.AuthorString = pair.Value;
|
||||
break;
|
||||
case @"Version":
|
||||
beatmap.BeatmapInfo.Version = pair.Value;
|
||||
|
@ -6,7 +6,6 @@ using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
@ -27,11 +26,10 @@ namespace osu.Game.Online.API.Requests
|
||||
[JsonProperty(@"id")]
|
||||
private int onlineId { get; set; }
|
||||
|
||||
[JsonProperty(@"creator")]
|
||||
private string creatorUsername { get; set; }
|
||||
|
||||
[JsonProperty(@"user_id")]
|
||||
private long creatorId = 1;
|
||||
private long creatorId {
|
||||
set { Author.Id = value; }
|
||||
}
|
||||
|
||||
[JsonProperty(@"beatmaps")]
|
||||
private IEnumerable<GetBeatmapSetsBeatmapResponse> beatmaps { get; set; }
|
||||
@ -44,11 +42,6 @@ namespace osu.Game.Online.API.Requests
|
||||
Metadata = this,
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Author = new User
|
||||
{
|
||||
Id = creatorId,
|
||||
Username = creatorUsername,
|
||||
},
|
||||
Covers = covers,
|
||||
Preview = preview,
|
||||
PlayCount = playCount,
|
||||
|
@ -36,12 +36,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
var i = BeatmapSet.OnlineInfo;
|
||||
|
||||
avatar.User = i.Author;
|
||||
avatar.User = BeatmapSet.Metadata.Author;
|
||||
clickableArea.Action = () => profile?.ShowUser(avatar.User);
|
||||
|
||||
fields.Children = new Drawable[]
|
||||
{
|
||||
new Field("made by", i.Author.Username, @"Exo2.0-RegularItalic"),
|
||||
new Field("made by", BeatmapSet.Metadata.Author.Username, @"Exo2.0-RegularItalic"),
|
||||
new Field("submitted on", i.Submitted.ToString(@"MMM d, yyyy"), @"Exo2.0-Bold")
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
|
@ -130,7 +130,7 @@ namespace osu.Game.Overlays.Direct
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = SetInfo.Metadata.Author,
|
||||
Text = SetInfo.Metadata.Author.Username,
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-SemiBoldItalic",
|
||||
Shadow = false,
|
||||
|
@ -128,7 +128,7 @@ namespace osu.Game.Overlays.Direct
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = SetInfo.Metadata.Author,
|
||||
Text = SetInfo.Metadata.Author.Username,
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-SemiBoldItalic",
|
||||
},
|
||||
|
@ -248,7 +248,7 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
},
|
||||
new MetadataLine("Mapper", metadata.Author)
|
||||
new MetadataLine("Mapper", metadata.Author.Username)
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
|
@ -210,7 +210,7 @@ namespace osu.Game.Screens.Select
|
||||
new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-Bold",
|
||||
Text = metadata.Author,
|
||||
Text = metadata.Author.Username,
|
||||
TextSize = 15,
|
||||
},
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Select
|
||||
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Title, y.BeatmapSet.Metadata.Title, StringComparison.InvariantCultureIgnoreCase));
|
||||
break;
|
||||
case SortMode.Author:
|
||||
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author, y.BeatmapSet.Metadata.Author, StringComparison.InvariantCultureIgnoreCase));
|
||||
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Author.Username, y.BeatmapSet.Metadata.Author.Username, StringComparison.InvariantCultureIgnoreCase));
|
||||
break;
|
||||
case SortMode.Difficulty:
|
||||
groups.Sort((x, y) => x.BeatmapSet.MaxStarDifficulty.CompareTo(y.BeatmapSet.MaxStarDifficulty));
|
||||
@ -59,4 +59,4 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,11 @@ namespace osu.Game.Tests.Visual
|
||||
Artist = @"Kaneko Chiharu",
|
||||
Source = @"SOUND VOLTEX III GRAVITY WARS",
|
||||
Tags = @"sdvx grace the 5th kac original song contest konami bemani",
|
||||
Author = new User
|
||||
{
|
||||
Username = @"Fresh Chicken",
|
||||
Id = 3984370,
|
||||
},
|
||||
},
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
@ -48,11 +53,6 @@ namespace osu.Game.Tests.Visual
|
||||
Submitted = new DateTime(2016, 2, 10),
|
||||
Ranked = new DateTime(2016, 6, 19),
|
||||
BPM = 236,
|
||||
Author = new User
|
||||
{
|
||||
Username = @"Fresh Chicken",
|
||||
Id = 3984370,
|
||||
},
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/415886/covers/cover.jpg?1465651778",
|
||||
@ -213,6 +213,11 @@ namespace osu.Game.Tests.Visual
|
||||
Title = @"Soumatou Labyrinth",
|
||||
Artist = @"Yunomi with Momobako&miko",
|
||||
Tags = @"mmbk.com yuzu__rinrin charlotte",
|
||||
Author = new User
|
||||
{
|
||||
Username = @"komasy",
|
||||
Id = 1980256,
|
||||
},
|
||||
},
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
@ -222,11 +227,6 @@ namespace osu.Game.Tests.Visual
|
||||
Submitted = new DateTime(2016, 6, 11),
|
||||
Ranked = new DateTime(2016, 7, 12),
|
||||
BPM = 160,
|
||||
Author = new User
|
||||
{
|
||||
Username = @"komasy",
|
||||
Id = 1980256,
|
||||
},
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/625493/covers/cover.jpg?1499167472",
|
||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
Title = @"OrVid",
|
||||
Artist = @"An",
|
||||
Author = @"RLC",
|
||||
AuthorString = @"RLC",
|
||||
Source = @"",
|
||||
Tags = @"acuticnotes an-fillnote revid tear tearvid encrpted encryption axi axivid quad her hervid recoll",
|
||||
},
|
||||
@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
Title = @"tiny lamp",
|
||||
Artist = @"fhana",
|
||||
Author = @"Sotarks",
|
||||
AuthorString = @"Sotarks",
|
||||
Source = @"ぎんぎつね",
|
||||
Tags = @"lantis junichi sato yuxuki waga kevin mitsunaga towana gingitsune opening op full ver version kalibe collab collaboration",
|
||||
},
|
||||
@ -110,7 +110,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
Title = @"At Gwanghwamun",
|
||||
Artist = @"KYUHYUN",
|
||||
Author = @"Cerulean Veyron",
|
||||
AuthorString = @"Cerulean Veyron",
|
||||
Source = @"",
|
||||
Tags = @"soul ballad kh super junior sj suju 슈퍼주니어 kt뮤직 sm엔터테인먼트 s.m.entertainment kt music 1st mini album ep",
|
||||
},
|
||||
@ -157,7 +157,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
Title = @"RHAPSODY OF BLUE SKY",
|
||||
Artist = @"fhana",
|
||||
Author = @"[Kamiya]",
|
||||
AuthorString = @"[Kamiya]",
|
||||
Source = @"小林さんちのメイドラゴン",
|
||||
Tags = @"kobayashi san chi no maidragon aozora no opening anime maid dragon oblivion karen dynamix imoutosan pata-mon gxytcgxytc",
|
||||
},
|
||||
|
@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual
|
||||
// Create random metadata, then we can check if sorting works based on these
|
||||
Artist = "MONACA " + RNG.Next(0, 9),
|
||||
Title = "Black Song " + RNG.Next(0, 9),
|
||||
Author = "Some Guy " + RNG.Next(0, 9),
|
||||
AuthorString = "Some Guy " + RNG.Next(0, 9),
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>(new[]
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
Title = @"Platina",
|
||||
Artist = @"Maaya Sakamoto",
|
||||
Author = @"uwutm8",
|
||||
AuthorString = @"uwutm8",
|
||||
},
|
||||
BeatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
@ -104,7 +104,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
Title = @"FREEDOM DIVE",
|
||||
Artist = @"xi",
|
||||
Author = @"Nakagawa-Kanon",
|
||||
AuthorString = @"Nakagawa-Kanon",
|
||||
},
|
||||
BeatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
|
@ -645,6 +645,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-frame
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=NAMESPACE_005FALIAS/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FFIELD/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:String x:Key="/Default/CodeStyle/Naming/XamlNaming/UserRules/=XAML_005FRESOURCE/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAlwaysTreatStructAsNotReorderableMigration/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
|
||||
|
Loading…
Reference in New Issue
Block a user