mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #6154
bodwok (1): fix(chathistory): file transfers sometimes show wrong author name
This commit is contained in:
commit
c73cedf2a0
|
@ -215,13 +215,16 @@ void ChatHistory::onFileUpdated(const ToxPk& sender, const ToxFile& file)
|
||||||
if (canUseHistory()) {
|
if (canUseHistory()) {
|
||||||
switch (file.status) {
|
switch (file.status) {
|
||||||
case ToxFile::INITIALIZING: {
|
case ToxFile::INITIALIZING: {
|
||||||
|
auto selfPk = coreIdHandler.getSelfPublicKey();
|
||||||
|
QString username(selfPk == sender ? coreIdHandler.getUsername() : f.getDisplayedName());
|
||||||
|
|
||||||
// Note: There is some implcit coupling between history and the current
|
// Note: There is some implcit coupling between history and the current
|
||||||
// chat log. Both rely on generating a new id based on the state of
|
// chat log. Both rely on generating a new id based on the state of
|
||||||
// initializing. If this is changed in the session chat log we'll end up
|
// initializing. If this is changed in the session chat log we'll end up
|
||||||
// with a different order when loading from history
|
// with a different order when loading from history
|
||||||
history->addNewFileMessage(f.getPublicKey(), file.resumeFileId, file.fileName,
|
history->addNewFileMessage(f.getPublicKey(), file.resumeFileId, file.fileName,
|
||||||
file.filePath, file.filesize, sender,
|
file.filePath, file.filesize, sender,
|
||||||
QDateTime::currentDateTime(), f.getDisplayedName());
|
QDateTime::currentDateTime(), username);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ToxFile::CANCELED:
|
case ToxFile::CANCELED:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user