Handle links correctly and don't re-open profile if the user is same.

This commit is contained in:
naoey 2018-02-26 00:58:20 +05:30
parent bb40919f9c
commit 75fdca928e
No known key found for this signature in database
GPG Key ID: 3908EC682A3E19C7
3 changed files with 9 additions and 6 deletions

View File

@ -210,13 +210,13 @@ public static Message FormatMessage(Message inputMessage)
return inputMessage;
}
public static List<Link> GetLinks(string text)
public static MessageFormatterResult FormatText(string text)
{
var result = format(text);
result.Links.Sort();
return result.Links;
return result;
}
public class MessageFormatterResult

View File

@ -34,8 +34,8 @@ public DrawableRecentActivity(RecentActivity activity, User user)
this.activity = activity;
this.user = user;
userLinkTemplate = $"[{activity.User?.Username}]({urlToAbsolute(activity.User?.Url)})";
beatmapLinkTemplate = $"[{activity.Beatmap?.Title}]({urlToAbsolute(activity.Beatmap?.Url)})";
userLinkTemplate = $"[{urlToAbsolute(activity.User?.Url)} {activity.User?.Username}]";
beatmapLinkTemplate = $"[{urlToAbsolute(activity.Beatmap?.Url)} {activity.Beatmap?.Title}]";
}
[BackgroundDependencyLoader]
@ -59,9 +59,9 @@ private void load(APIAccess api)
Colour = OsuColour.Gray(0xAA),
});
string text = activityToString();
var formatted = MessageFormatter.FormatText(activityToString());
content.AddLinks(text, MessageFormatter.GetLinks(text));
content.AddLinks(formatted.Text, formatted.Links);
}
protected override Drawable CreateLeftVisual()

View File

@ -75,6 +75,9 @@ protected override void PopOut()
public void ShowUser(long userId)
{
if (userId == Header.User.Id)
return;
ShowUser(new User { Id = userId }, true);
}