fix(@dekstop/chat): timestamp for `Fetch messages` is wrong
Fixes #4850
This commit is contained in:
parent
ec9a359a28
commit
40d10b0cbb
|
@ -215,6 +215,10 @@ method newMessagesLoaded*(self: Module, messages: seq[MessageDto], reactions: se
|
||||||
if m.editedAt != 0:
|
if m.editedAt != 0:
|
||||||
item.isEdited = true
|
item.isEdited = true
|
||||||
|
|
||||||
|
if(m.contentType.ContentType == ContentType.Gap):
|
||||||
|
item.gapFrom = m.gapParameters.`from`
|
||||||
|
item.gapTo = m.gapParameters.to
|
||||||
|
|
||||||
# messages are sorted from the most recent to the least recent one
|
# messages are sorted from the most recent to the least recent one
|
||||||
viewItems.add(item)
|
viewItems.add(item)
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,8 @@ proc initItem*(
|
||||||
result.isEdited = false
|
result.isEdited = false
|
||||||
result.links = links
|
result.links = links
|
||||||
result.transactionParameters = transactionParameters
|
result.transactionParameters = transactionParameters
|
||||||
|
result.gapFrom = 0
|
||||||
|
result.gapTo = 0
|
||||||
|
|
||||||
proc `$`*(self: Item): string =
|
proc `$`*(self: Item): string =
|
||||||
result = fmt"""Item(
|
result = fmt"""Item(
|
||||||
|
@ -265,4 +267,15 @@ proc isEdited*(self: Item): bool {.inline.} =
|
||||||
proc `isEdited=`*(self: Item, value: bool) {.inline.} =
|
proc `isEdited=`*(self: Item, value: bool) {.inline.} =
|
||||||
self.isEdited = value
|
self.isEdited = value
|
||||||
|
|
||||||
|
proc gapFrom*(self: Item): int64 {.inline.} =
|
||||||
|
self.gapFrom
|
||||||
|
|
||||||
|
proc `gapFrom=`*(self: Item, value: int64) {.inline.} =
|
||||||
|
self.gapFrom = value
|
||||||
|
|
||||||
|
proc gapTo*(self: Item): int64 {.inline.} =
|
||||||
|
self.gapTo
|
||||||
|
|
||||||
|
proc `gapTo=`*(self: Item, value: int64) {.inline.} =
|
||||||
|
self.gapTo = value
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ type
|
||||||
MessageType
|
MessageType
|
||||||
Sticker
|
Sticker
|
||||||
StickerPack
|
StickerPack
|
||||||
# GapFrom
|
GapFrom
|
||||||
# GapTo
|
GapTo
|
||||||
Pinned
|
Pinned
|
||||||
PinnedBy
|
PinnedBy
|
||||||
Reactions
|
Reactions
|
||||||
|
@ -94,8 +94,8 @@ QtObject:
|
||||||
ModelRole.MessageType.int:"messageType",
|
ModelRole.MessageType.int:"messageType",
|
||||||
ModelRole.Sticker.int:"sticker",
|
ModelRole.Sticker.int:"sticker",
|
||||||
ModelRole.StickerPack.int:"stickerPack",
|
ModelRole.StickerPack.int:"stickerPack",
|
||||||
# ModelRole.GapFrom.int:"gapFrom",
|
ModelRole.GapFrom.int:"gapFrom",
|
||||||
# ModelRole.GapTo.int:"gapTo",
|
ModelRole.GapTo.int:"gapTo",
|
||||||
ModelRole.Pinned.int:"pinned",
|
ModelRole.Pinned.int:"pinned",
|
||||||
ModelRole.PinnedBy.int:"pinnedBy",
|
ModelRole.PinnedBy.int:"pinnedBy",
|
||||||
ModelRole.Reactions.int:"reactions",
|
ModelRole.Reactions.int:"reactions",
|
||||||
|
@ -154,10 +154,10 @@ QtObject:
|
||||||
result = newQVariant(item.sticker)
|
result = newQVariant(item.sticker)
|
||||||
of ModelRole.StickerPack:
|
of ModelRole.StickerPack:
|
||||||
result = newQVariant(item.stickerPack)
|
result = newQVariant(item.stickerPack)
|
||||||
# of ModelRole.GapFrom:
|
of ModelRole.GapFrom:
|
||||||
# result = newQVariant(item.gapFrom)
|
result = newQVariant(item.gapFrom)
|
||||||
# of ModelRole.GapTo:
|
of ModelRole.GapTo:
|
||||||
# result = newQVariant(item.gapTo)
|
result = newQVariant(item.gapTo)
|
||||||
of ModelRole.Pinned:
|
of ModelRole.Pinned:
|
||||||
result = newQVariant(item.pinned)
|
result = newQVariant(item.pinned)
|
||||||
of ModelRole.PinnedBy:
|
of ModelRole.PinnedBy:
|
||||||
|
|
|
@ -272,6 +272,9 @@ Item {
|
||||||
linkUrls: model.links
|
linkUrls: model.links
|
||||||
transactionParams: model.transactionParameters
|
transactionParams: model.transactionParameters
|
||||||
|
|
||||||
|
gapFrom: model.gapFrom
|
||||||
|
gapTo: model.gapTo
|
||||||
|
|
||||||
// This is possible since we have all data loaded before we load qml.
|
// This is possible since we have all data loaded before we load qml.
|
||||||
// When we fetch messages to fulfill a gap we have to set them at once.
|
// When we fetch messages to fulfill a gap we have to set them at once.
|
||||||
// Also one important thing here is that messages are set in descending order
|
// Also one important thing here is that messages are set in descending order
|
||||||
|
|
|
@ -5,10 +5,16 @@ import utils 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property int gapFrom: 0
|
||||||
|
property int gapTo: 0
|
||||||
|
|
||||||
|
signal clicked()
|
||||||
|
|
||||||
height: childrenRect.height + Style.current.smallPadding * 2
|
height: childrenRect.height + Style.current.smallPadding * 2
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
signal clicked()
|
|
||||||
Separator {
|
Separator {
|
||||||
id: sep1
|
id: sep1
|
||||||
}
|
}
|
||||||
|
@ -35,9 +41,11 @@ Item {
|
||||||
anchors.top: fetchMoreButton.bottom
|
anchors.top: fetchMoreButton.bottom
|
||||||
anchors.topMargin: 3
|
anchors.topMargin: 3
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
width: parent.width
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
color: Style.current.secondaryText
|
color: Style.current.secondaryText
|
||||||
text: qsTrId("between--1-and--2").arg(new Date(gapFrom * 1000)).arg(new Date(gapTo * 1000))
|
text: qsTrId("between--1-and--2").arg(new Date(root.gapFrom * 1000)).arg(new Date(root.gapTo * 1000))
|
||||||
}
|
}
|
||||||
Separator {
|
Separator {
|
||||||
anchors.top: fetchDate.bottom
|
anchors.top: fetchDate.bottom
|
||||||
|
|
|
@ -48,6 +48,9 @@ Column {
|
||||||
property bool isInPinnedPopup: false // The pinned popup limits the number of buttons shown
|
property bool isInPinnedPopup: false // The pinned popup limits the number of buttons shown
|
||||||
property var transactionParams
|
property var transactionParams
|
||||||
|
|
||||||
|
property int gapFrom: 0
|
||||||
|
property int gapTo: 0
|
||||||
|
|
||||||
property int prevMessageIndex: -1
|
property int prevMessageIndex: -1
|
||||||
property var prevMessageAsJsonObj
|
property var prevMessageAsJsonObj
|
||||||
property int nextMessageIndex: -1
|
property int nextMessageIndex: -1
|
||||||
|
@ -118,8 +121,6 @@ Column {
|
||||||
property bool activityCenterMessage: false
|
property bool activityCenterMessage: false
|
||||||
property bool read: true
|
property bool read: true
|
||||||
property bool forceHoverHandler: false // Used to force the HoverHandler to be active (useful for messages in popups)
|
property bool forceHoverHandler: false // Used to force the HoverHandler to be active (useful for messages in popups)
|
||||||
property int gapFrom: 0
|
|
||||||
property int gapTo: 0
|
|
||||||
property string replaces: ""
|
property string replaces: ""
|
||||||
property bool isEdited: false
|
property bool isEdited: false
|
||||||
property bool stickersLoaded: false
|
property bool stickersLoaded: false
|
||||||
|
@ -255,6 +256,8 @@ Column {
|
||||||
Component {
|
Component {
|
||||||
id: gapComponent
|
id: gapComponent
|
||||||
GapComponent {
|
GapComponent {
|
||||||
|
gapFrom: root.gapFrom
|
||||||
|
gapTo: root.gapTo
|
||||||
onClicked: {
|
onClicked: {
|
||||||
messageStore.fillGaps(messageId)
|
messageStore.fillGaps(messageId)
|
||||||
root.visible = false;
|
root.visible = false;
|
||||||
|
|
Loading…
Reference in New Issue