1
0
forked from blue/squawk

now you can't edit messages with attachments: no other client actually allowes that, and if I edit they don't handle it properly anyway

This commit is contained in:
Blue 2022-04-02 15:34:36 +03:00
parent 1fcd403dba
commit 62f02c18d7
Signed by untrusted user: blue
GPG Key ID: 9B203B252A63EE38

View File

@ -513,8 +513,9 @@ void Conversation::onFeedContext(const QPoint& pos)
});
}
bool hasAttach = item->getAttachPath() > 0 || item->getOutOfBandUrl() > 0;
//the only mandatory condition - is for the message to be outgoing, the rest is just a good intention on the server
if (item->getOutgoing() && index.row() < 100 && item->getTime().daysTo(QDateTime::currentDateTimeUtc()) < 20) {
if (item->getOutgoing() && !hasAttach && index.row() < 100 && item->getTime().daysTo(QDateTime::currentDateTimeUtc()) < 20) {
showMenu = true;
QAction* edit = contextMenu->addAction(Shared::icon("edit-rename"), tr("Edit"));
connect(edit, &QAction::triggered, this, std::bind(&Conversation::onMessageEditRequested, this, id));
@ -549,6 +550,10 @@ void Conversation::onMessageEditRequested(const QString& id)
m_ui->currentActionBadge->setText(tr("Editing message..."));
currentAction = CurrentAction::edit;
m_ui->messageEditor->setText(msg.getBody());
QString path = msg.getAttachPath();
if (path.size() > 0) {
addAttachedFile(path);
}
} catch (const Models::MessageFeed::NotFound& e) {
qDebug() << "The message requested to be edited was not found" << e.getMessage().c_str();