feat(Timeline): handle delete events

This commit is contained in:
Evangelos Paterakis 2023-02-17 17:59:26 +02:00
parent 0086c12bbc
commit 512a1bb37b
No known key found for this signature in database
GPG Key ID: FE5185F095BFC8C9
1 changed files with 18 additions and 2 deletions

View File

@ -154,7 +154,23 @@ public class Tooth.Views.Timeline : AccountHolder, Streamable, Views.ContentBase
}
public virtual void on_delete_post (Streamable.Event ev) {
//TODO: This
}
try {
var status_id = ev.get_string ();
for (uint i = 0; i < model.get_n_items(); i++) {
var status_obj = (API.Status)model.get_item(i);
// Not sure if there can be both the original
// and a boost of it at the same time.
if (status_obj.id == status_id || status_obj.formal.id == status_id) {
model.remove(i);
// If there can be both the original
// and boosts at the same time, then
// it shouldn't stop at the first find.
break;
}
}
} catch (Error e) {
warning (@"Error getting String from json: $(e.message)");
}
}
}