diff options
Diffstat (limited to 'libdino')
-rw-r--r-- | libdino/src/service/content_item_store.vala | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libdino/src/service/content_item_store.vala b/libdino/src/service/content_item_store.vala index 0b89e288..1886236c 100644 --- a/libdino/src/service/content_item_store.vala +++ b/libdino/src/service/content_item_store.vala @@ -82,7 +82,15 @@ public class ContentItemStore : StreamInteractionModule, Object { return item.size > 0 ? item[0] : null; } - public Gee.List<ContentItem> get_latest(Conversation conversation, int count) { + public ContentItem? get_latest(Conversation conversation) { + Gee.List<ContentItem> items = get_n_latest(conversation, 1); + if (items.size > 0) { + return items.get(0); + } + return null; + } + + public Gee.List<ContentItem> get_n_latest(Conversation conversation, int count) { QueryBuilder select = db.content_item.select() .with(db.content_item.conversation_id, "=", conversation.id) .with(db.content_item.hide, "=", false) |