Better account click handling in AccountView

This commit is contained in:
bleakgrey 2018-04-29 13:58:45 +03:00
parent 2188399b5f
commit 8533d87e96
3 changed files with 9 additions and 9 deletions

View File

@ -22,6 +22,10 @@ public class Tootle.Status{
this.reblogged = false;
this.favorited = false;
}
public Status get_formal (){
return reblog != null ? reblog : this;
}
public static Status parse(Json.Object obj) {
var id = int64.parse (obj.get_string_member ("id"));

View File

@ -88,7 +88,7 @@ public class Tootle.AccountView : Tootle.HomeView {
}
public override bool is_status_owned (Status status){
return status.account.id == account.id;
return status.get_formal ().account.id == account.id;
}
public override string get_url (){

View File

@ -130,8 +130,7 @@ public class Tootle.StatusWidget : Gtk.EventBox {
}
public void rebind (Status status = this.status){
var user_label = status.reblog != null ? status.reblog.account.display_name : status.account.display_name;
user.label = "<b>%s</b>".printf (user_label);
user.label = "<b>%s</b>".printf (status.get_formal ().account.display_name);
content.label = status.content;
content.mentions = status.mentions;
@ -143,20 +142,17 @@ public class Tootle.StatusWidget : Gtk.EventBox {
favorite.active = status.favorited;
favorite.sensitive = true;
var avatar_url = status.reblog != null ? status.reblog.account.avatar : status.account.avatar;
Tootle.cache.load_avatar (avatar_url, this.avatar, this.avatar_size);
Tootle.cache.load_avatar (status.get_formal ().account.avatar, this.avatar, this.avatar_size);
}
public bool on_avatar_clicked (){
var account = status.reblog != null ? status.reblog.account : status.account;
var view = new AccountView (account);
var view = new AccountView (status.get_formal ().account);
Tootle.window.open_secondary_view (view);
return true;
}
public bool open (){
var open_status = status.reblog != null ? status.reblog : status;
var view = new StatusView (open_status);
var view = new StatusView (status.get_formal ());
Tootle.window.open_secondary_view (view);
return false;
}