Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-qt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-qt
Commits
9195cb0b
Commit
9195cb0b
authored
2 years ago
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
replytorow: correctly update row if original post is editted
Change-Id: I2a76104b96d5eba554113e5aace1661170bbbb5d
parent
838591cb
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/app/commoncomponents/ReplyToRow.qml
+9
-10
9 additions, 10 deletions
src/app/commoncomponents/ReplyToRow.qml
src/libclient/messagelistmodel.cpp
+24
-8
24 additions, 8 deletions
src/libclient/messagelistmodel.cpp
src/libclient/messagelistmodel.h
+2
-1
2 additions, 1 deletion
src/libclient/messagelistmodel.h
with
35 additions
and
19 deletions
src/app/commoncomponents/ReplyToRow.qml
+
9
−
10
View file @
9195cb0b
...
...
@@ -28,7 +28,15 @@ Item {
visible
:
ReplyTo
!==
""
width
:
visible
?
replyToRow
.
width
:
0
height
:
replyToRow
.
height
+
replyToRow
.
anchors
.
topMargin
height
:
replyToRow
.
height
+
replyToRow
.
anchors
.
topMargin
Component.onCompleted
:
{
// Make sure we show the original post
// In the future, we may just want to load the previous interaction of the thread
// and not show it, but for now we can simplify.
if
(
ReplyTo
!==
""
)
MessagesAdapter
.
loadConversationUntil
(
ReplyTo
)
}
MouseArea
{
...
...
@@ -41,15 +49,6 @@ Item {
property
bool
isSelf
:
ReplyToAuthor
===
CurrentAccount
.
uri
||
ReplyToAuthor
===
""
onVisibleChanged
:
{
if
(
visible
)
{
// Make sure we show the original post
// In the future, we may just want to load the previous interaction of the thread
// and not show it, but for now we can simplify.
MessagesAdapter
.
loadConversationUntil
(
ReplyTo
)
}
}
Label
{
id
:
replyTo
...
...
This diff is collapsed.
Click to expand it.
src/libclient/messagelistmodel.cpp
+
24
−
8
View file @
9195cb0b
...
...
@@ -290,25 +290,31 @@ MessageListModel::moveMessage(const QString& msgId, const QString& parentId)
}
void
MessageListModel
::
insertMessage
(
int
index
,
item_t
&
message
)
MessageListModel
::
updateReplies
(
item_t
&
message
)
{
Q_EMIT
beginInsertRows
(
QModelIndex
(),
index
,
index
);
interactions_
.
insert
(
index
,
message
);
Q_EMIT
endInsertRows
();
auto
replyId
=
message
.
second
.
commit
[
"reply-to"
];
auto
commitId
=
message
.
second
.
commit
[
"id"
];
if
(
!
replyId
.
isEmpty
())
replyTo_
[
replyId
].
append
(
commitId
);
if
(
!
replyId
.
isEmpty
())
{
replyTo_
[
replyId
].
insert
(
commitId
);
}
for
(
const
auto
&
msgId
:
replyTo_
[
commitId
])
{
int
index
=
getIndexOfMessage
(
msgId
);
if
(
index
==
-
1
)
continue
;
QModelIndex
modelIndex
=
QAbstractListModel
::
index
(
index
,
0
);
Q_EMIT
dataChanged
(
modelIndex
,
modelIndex
,
{
Role
::
ReplyToAuthor
});
Q_EMIT
dataChanged
(
modelIndex
,
modelIndex
,
{
Role
::
ReplyToBody
});
Q_EMIT
dataChanged
(
modelIndex
,
modelIndex
,
{
Role
::
ReplyToAuthor
,
Role
::
ReplyToBody
});
}
}
void
MessageListModel
::
insertMessage
(
int
index
,
item_t
&
message
)
{
Q_EMIT
beginInsertRows
(
QModelIndex
(),
index
,
index
);
interactions_
.
insert
(
index
,
message
);
Q_EMIT
endInsertRows
();
updateReplies
(
message
);
}
iterator
MessageListModel
::
insertMessage
(
iterator
it
,
item_t
&
message
)
{
...
...
@@ -316,6 +322,7 @@ MessageListModel::insertMessage(iterator it, item_t& message)
Q_EMIT
beginInsertRows
(
QModelIndex
(),
index
,
index
);
auto
insertion
=
interactions_
.
insert
(
it
,
message
);
Q_EMIT
endInsertRows
();
updateReplies
(
message
);
return
insertion
;
}
...
...
@@ -591,6 +598,15 @@ MessageListModel::editMessage(const QString& msgId, interaction::Info& info)
info
.
body
=
it
->
rbegin
()
->
body
;
editedBodies_
.
erase
(
it
);
emitDataChanged
(
msgId
,
{
MessageList
::
Role
::
Body
,
MessageList
::
Role
::
PreviousBodies
});
// Body changed, replies should update
for
(
const
auto
&
replyId
:
replyTo_
[
msgId
])
{
int
index
=
getIndexOfMessage
(
replyId
);
if
(
index
==
-
1
)
continue
;
QModelIndex
modelIndex
=
QAbstractListModel
::
index
(
index
,
0
);
Q_EMIT
dataChanged
(
modelIndex
,
modelIndex
,
{
Role
::
ReplyToBody
});
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/libclient/messagelistmodel.h
+
2
−
1
View file @
9195cb0b
...
...
@@ -147,7 +147,8 @@ private:
// to allow quick access.
QMap
<
QString
,
QString
>
lastDisplayedMessageUid_
;
QMap
<
QString
,
QStringList
>
messageToReaders_
;
QMap
<
QString
,
QStringList
>
replyTo_
;
QMap
<
QString
,
QSet
<
QString
>>
replyTo_
;
void
updateReplies
(
item_t
&
message
);
QMap
<
QString
,
QVector
<
interaction
::
Body
>>
editedBodies_
;
void
moveMessage
(
const
QString
&
msgId
,
const
QString
&
parentId
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment