Fix sent messages sometimes being displayed twice
This commit is contained in:
parent
ea7efd6399
commit
0f57191bea
|
@ -26,7 +26,6 @@ public class ContentItemStore : StreamInteractionModule, Object {
|
|||
this.stream_interactor = stream_interactor;
|
||||
this.db = db;
|
||||
|
||||
stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect((message, conversation) => insert_message(message, conversation));
|
||||
stream_interactor.get_module(FileManager.IDENTITY).received_file.connect(insert_file_transfer);
|
||||
}
|
||||
|
||||
|
@ -180,7 +179,6 @@ public abstract class ContentItem : Object {
|
|||
public string type_ { get; set; }
|
||||
public Jid? jid { get; set; default=null; }
|
||||
public DateTime? sort_time { get; set; default=null; }
|
||||
public double seccondary_sort_indicator { get; set; }
|
||||
public DateTime? display_time { get; set; default=null; }
|
||||
public Encryption? encryption { get; set; default=null; }
|
||||
public Entities.Message.Marked? mark { get; set; default=null; }
|
||||
|
@ -190,7 +188,6 @@ public abstract class ContentItem : Object {
|
|||
this.type_ = ty;
|
||||
this.jid = jid;
|
||||
this.sort_time = sort_time;
|
||||
this.seccondary_sort_indicator = id;
|
||||
this.display_time = display_time;
|
||||
this.encryption = encryption;
|
||||
this.mark = mark;
|
||||
|
@ -202,7 +199,7 @@ public abstract class ContentItem : Object {
|
|||
res = a.display_time.compare(b.display_time);
|
||||
}
|
||||
if (res == 0) {
|
||||
res = a.seccondary_sort_indicator - b.seccondary_sort_indicator > 0 ? 1 : -1;
|
||||
res = a.id - b.id > 0 ? 1 : -1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class ContentMetaItem : Plugins.MetaConversationItem {
|
|||
public ContentMetaItem(ContentItem content_item, ContentItemWidgetFactory widget_factory) {
|
||||
this.jid = content_item.jid;
|
||||
this.sort_time = content_item.sort_time;
|
||||
this.seccondary_sort_indicator = content_item.seccondary_sort_indicator;
|
||||
this.seccondary_sort_indicator = content_item.id;
|
||||
this.display_time = content_item.display_time;
|
||||
this.encryption = content_item.encryption;
|
||||
this.mark = content_item.mark;
|
||||
|
|
|
@ -160,7 +160,7 @@ class GlobalSearch : Overlay {
|
|||
|
||||
string display_name = Util.get_conversation_display_name(stream_interactor, item.conversation);
|
||||
string title = item.message.type_ == Message.Type.GROUPCHAT ? _("In %s").printf(display_name) : _("With %s").printf(display_name);
|
||||
Box header_box = new Box(Orientation.HORIZONTAL, 10) { margin_left=7, visible=true };
|
||||
Box header_box = new Box(Orientation.HORIZONTAL, 10) { margin_start=7, visible=true };
|
||||
header_box.add(new Label(@"<b>$(Markup.escape_text(title))</b>") { ellipsize=EllipsizeMode.END, xalign=0, use_markup=true, visible=true });
|
||||
header_box.add(date_label);
|
||||
|
||||
|
@ -223,7 +223,7 @@ class GlobalSearch : Overlay {
|
|||
|
||||
private Grid get_context_message_widget(MessageItem item) {
|
||||
Grid grid = get_skeleton(item);
|
||||
grid.margin_left = 7;
|
||||
grid.margin_start = 7;
|
||||
Label label = new Label(item.message.body.replace("\n", "").replace("\r", "")) { ellipsize=EllipsizeMode.MIDDLE, xalign=0, visible=true };
|
||||
grid.attach(label, 1, 1, 1, 1);
|
||||
grid.opacity = 0.55;
|
||||
|
@ -231,7 +231,7 @@ class GlobalSearch : Overlay {
|
|||
}
|
||||
|
||||
private Grid get_skeleton(MessageItem item) {
|
||||
AvatarImage image = new AvatarImage() { height=32, width=32, margin_right=7, valign=Align.START, visible=true, allow_gray = false };
|
||||
AvatarImage image = new AvatarImage() { height=32, width=32, margin_end=7, valign=Align.START, visible=true, allow_gray = false };
|
||||
image.set_jid(stream_interactor, item.jid, item.message.account);
|
||||
Grid grid = new Grid() { row_homogeneous=false, visible=true };
|
||||
grid.attach(image, 0, 0, 1, 2);
|
||||
|
|
Loading…
Reference in a new issue