Fix invalid header creation for date separators

This commit is contained in:
Marvin W 2020-01-22 01:24:14 +01:00
parent 8c5957537c
commit 3b0a27e14b
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
5 changed files with 7 additions and 11 deletions

View file

@ -91,12 +91,12 @@ public abstract interface NotificationPopulator : Object {
public abstract class MetaConversationItem : Object { public abstract class MetaConversationItem : Object {
public virtual string populator_id { get; set; } public virtual string populator_id { get; set; }
public virtual Jid jid { get; set; } public virtual Jid? jid { get; set; default=null; }
public virtual bool dim { get; set; default=false; } public virtual bool dim { get; set; default=false; }
public virtual DateTime sort_time { get; set; default = new DateTime.now_utc(); } public virtual DateTime sort_time { get; set; default = new DateTime.now_utc(); }
public virtual long seccondary_sort_indicator { get; set; } public virtual long seccondary_sort_indicator { get; set; }
public virtual long tertiary_sort_indicator { get; set; } public virtual long tertiary_sort_indicator { get; set; }
public virtual DateTime display_time { get; set; default = new DateTime.now_utc(); } public virtual DateTime? display_time { get; set; default = null; }
public virtual Encryption encryption { get; set; default = Encryption.NONE; } public virtual Encryption encryption { get; set; default = Encryption.NONE; }
public virtual Entities.Message.Marked mark { get; set; default = Entities.Message.Marked.NONE; } public virtual Entities.Message.Marked mark { get; set; default = Entities.Message.Marked.NONE; }

View file

@ -89,7 +89,7 @@ private enum StateType {
} }
private class MetaChatStateItem : Plugins.MetaConversationItem { private class MetaChatStateItem : Plugins.MetaConversationItem {
public override Jid jid { get; set; } public override Jid? jid { get; set; }
public override bool dim { get; set; default=true; } public override bool dim { get; set; default=true; }
public override DateTime sort_time { get; set; default=new DateTime.now_utc().add_years(10); } public override DateTime sort_time { get; set; default=new DateTime.now_utc().add_years(10); }

View file

@ -67,9 +67,9 @@ public class ContentProvider : ContentItemCollection, Object {
} }
public class ContentMetaItem : Plugins.MetaConversationItem { public class ContentMetaItem : Plugins.MetaConversationItem {
public override Jid jid { get; set; } public override Jid? jid { get; set; }
public override DateTime sort_time { get; set; } public override DateTime sort_time { get; set; }
public override DateTime display_time { get; set; } public override DateTime? display_time { get; set; }
public override Encryption encryption { get; set; } public override Encryption encryption { get; set; }
public ContentItem content_item; public ContentItem content_item;

View file

@ -32,12 +32,8 @@ public class ConversationItemSkeleton : EventBox {
image.set_conversation_participant(stream_interactor, conversation, item.jid); image.set_conversation_participant(stream_interactor, conversation, item.jid);
image_content_box.add(image); image_content_box.add(image);
} }
if (item.display_time != null) { if (item.requires_header) {
metadata_header = new ItemMetaDataHeader(stream_interactor, conversation, item) { visible=true }; metadata_header = new ItemMetaDataHeader(stream_interactor, conversation, item) { visible=true };
if (!item.requires_header) {
metadata_header.name_label.visible = false;
metadata_header.dot_label.visible = false;
}
header_content_box.add(metadata_header); header_content_box.add(metadata_header);
} }

View file

@ -36,7 +36,7 @@ class DateSeparatorPopulator : Plugins.ConversationItemPopulator, Plugins.Conver
public void populate_timespan(Conversation conversation, DateTime after, DateTime before) { } public void populate_timespan(Conversation conversation, DateTime after, DateTime before) { }
private void on_inserted_item(Plugins.MetaConversationItem item) { private void on_inserted_item(Plugins.MetaConversationItem item) {
if (item.display_time == null) return; if (!(item is ContentMetaItem)) return;
DateTime time = item.sort_time.to_local(); DateTime time = item.sort_time.to_local();
DateTime msg_date = new DateTime.local(time.get_year(), time.get_month(), time.get_day_of_month(), 0, 0, 0); DateTime msg_date = new DateTime.local(time.get_year(), time.get_month(), time.get_day_of_month(), 0, 0, 0);