mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:33:22 +08:00
Merge pull request #30848 from Joehuu/dicord-fix-beatmap-button-visibility
Fix discord "view beatmap" button being shown when editing and hide identifiable information is set
This commit is contained in:
commit
e0fdcaf523
@ -175,7 +175,7 @@ namespace osu.Desktop
|
|||||||
presence.State = clampLength(activity.Value.GetStatus(hideIdentifiableInformation));
|
presence.State = clampLength(activity.Value.GetStatus(hideIdentifiableInformation));
|
||||||
presence.Details = clampLength(activity.Value.GetDetails(hideIdentifiableInformation) ?? string.Empty);
|
presence.Details = clampLength(activity.Value.GetDetails(hideIdentifiableInformation) ?? string.Empty);
|
||||||
|
|
||||||
if (getBeatmapID(activity.Value) is int beatmapId && beatmapId > 0)
|
if (activity.Value.GetBeatmapID(hideIdentifiableInformation) is int beatmapId && beatmapId > 0)
|
||||||
{
|
{
|
||||||
presence.Buttons = new[]
|
presence.Buttons = new[]
|
||||||
{
|
{
|
||||||
@ -333,20 +333,6 @@ namespace osu.Desktop
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int? getBeatmapID(UserActivity activity)
|
|
||||||
{
|
|
||||||
switch (activity)
|
|
||||||
{
|
|
||||||
case UserActivity.InGame game:
|
|
||||||
return game.BeatmapID;
|
|
||||||
|
|
||||||
case UserActivity.EditingBeatmap edit:
|
|
||||||
return edit.BeatmapID;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
if (multiplayerClient.IsNotNull())
|
if (multiplayerClient.IsNotNull())
|
||||||
|
@ -41,6 +41,12 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker;
|
public virtual Color4 GetAppropriateColour(OsuColour colours) => colours.GreenDarker;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the ID of the beatmap involved in this activity, if applicable and/or available.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hideIdentifiableInformation"></param>
|
||||||
|
public virtual int? GetBeatmapID(bool hideIdentifiableInformation = false) => null;
|
||||||
|
|
||||||
[MessagePackObject]
|
[MessagePackObject]
|
||||||
public class ChoosingBeatmap : UserActivity
|
public class ChoosingBeatmap : UserActivity
|
||||||
{
|
{
|
||||||
@ -76,6 +82,7 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
public override string GetStatus(bool hideIdentifiableInformation = false) => RulesetPlayingVerb;
|
public override string GetStatus(bool hideIdentifiableInformation = false) => RulesetPlayingVerb;
|
||||||
public override string GetDetails(bool hideIdentifiableInformation = false) => BeatmapDisplayTitle;
|
public override string GetDetails(bool hideIdentifiableInformation = false) => BeatmapDisplayTitle;
|
||||||
|
public override int? GetBeatmapID(bool hideIdentifiableInformation = false) => BeatmapID;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MessagePackObject]
|
[MessagePackObject]
|
||||||
@ -156,6 +163,11 @@ namespace osu.Game.Users
|
|||||||
// For now let's assume that showing the beatmap a user is editing could reveal unwanted information.
|
// For now let's assume that showing the beatmap a user is editing could reveal unwanted information.
|
||||||
? string.Empty
|
? string.Empty
|
||||||
: BeatmapDisplayTitle;
|
: BeatmapDisplayTitle;
|
||||||
|
|
||||||
|
public override int? GetBeatmapID(bool hideIdentifiableInformation = false) => hideIdentifiableInformation
|
||||||
|
// For now let's assume that showing the beatmap a user is editing could reveal unwanted information.
|
||||||
|
? null
|
||||||
|
: BeatmapID;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MessagePackObject]
|
[MessagePackObject]
|
||||||
|
Loading…
Reference in New Issue
Block a user