tootle-linux-client/src/API/Conversation.vala

31 lines
736 B
Vala
Raw Normal View History

2020-08-01 17:40:56 +02:00
public class Tootle.API.Conversation : Entity, Widgetizable {
2020-06-03 17:06:11 +02:00
2020-08-01 23:47:22 +02:00
public string id { get; set; }
public Gee.ArrayList<API.Account> accounts { get; set; }
2020-06-03 17:06:11 +02:00
public bool unread { get; set; default = false; }
2020-08-01 23:47:22 +02:00
public API.Status? last_status { get; set; default = null; }
public override Gtk.Widget to_widget () {
return new Widgets.Conversation (this);
}
public override void open () {
var view = new Views.Thread (last_status.formal);
2021-07-23 13:41:03 +02:00
app.main_window.open_view (view);
2020-08-01 23:47:22 +02:00
if (unread)
mark_read ();
}
public void mark_read () {
new Request.POST (@"/api/v1/conversations/$id/read")
.with_account (Tootle.accounts.active)
.then (() => {
unread = false;
})
.on_error (() => {})
.exec ();
}
2020-06-03 17:06:11 +02:00
}