mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 20:45:51 +03:00
Fix 'Reply' action primary property.
Primary is set to true when object type is 'room' or 'chat' and it set to false when object type is 'call'. Signed-off-by: Camila <hello@camila.codes>
This commit is contained in:
parent
cbe22d8c1e
commit
7633cc490d
3 changed files with 18 additions and 13 deletions
|
@ -782,11 +782,7 @@ QVariantList ActivityListModel::convertLinksToActionButtons(const Activity &acti
|
|||
}
|
||||
|
||||
for (const auto &activityLink : activity._links) {
|
||||
if (activityLink._primary
|
||||
|| activityLink._verb == QStringLiteral("DELETE")
|
||||
|| activityLink._verb == QStringLiteral("WEB")) {
|
||||
customList << ActivityListModel::convertLinkToActionButton(activityLink);
|
||||
}
|
||||
customList << ActivityListModel::convertLinkToActionButton(activityLink);
|
||||
}
|
||||
|
||||
return customList;
|
||||
|
|
|
@ -110,27 +110,36 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j
|
|||
if (a._objectType == "chat" || a._objectType == "call" || a._objectType == "room") {
|
||||
const auto objectId = json.value("object_id").toString();
|
||||
const auto objectIdData = objectId.split("/");
|
||||
|
||||
ActivityLink al;
|
||||
al._label = tr("Reply");
|
||||
al._verb = "REPLY";
|
||||
al._primary = true;
|
||||
|
||||
a._talkNotificationData.conversationToken = objectIdData.first();
|
||||
|
||||
if (a._objectType == "chat" && objectIdData.size() > 1) {
|
||||
a._talkNotificationData.messageId = objectIdData.last();
|
||||
} else {
|
||||
qCInfo(lcServerNotification) << "Replying directly to Talk conversation" << a._talkNotificationData.conversationToken << "will not be possible because the notification doesn't contain the message ID.";
|
||||
}
|
||||
|
||||
ActivityLink al;
|
||||
al._label = tr("Reply");
|
||||
al._verb = "REPLY";
|
||||
al._primary = true;
|
||||
a._links.insert(0, al);
|
||||
if (a._subjectRichParameters.contains("user")) {
|
||||
|
||||
// callback then it is the primary action
|
||||
if (a._objectType == "call") {
|
||||
al._primary = false;
|
||||
}
|
||||
|
||||
if(a._subjectRichParameters.contains("user")) {
|
||||
a._talkNotificationData.userAvatar = ai->account()->url().toString() + QStringLiteral("/index.php/avatar/") + a._subjectRichParameters["user"].id + QStringLiteral("/128");
|
||||
}
|
||||
|
||||
// We want to serve incoming call dialogs to the user for calls that
|
||||
if(a._objectType == "call" && a._dateTime.secsTo(QDateTime::currentDateTime()) < 120) {
|
||||
if (a._objectType == "call" && a._dateTime.secsTo(QDateTime::currentDateTime()) < 120) {
|
||||
callList.append(a);
|
||||
}
|
||||
|
||||
a._links.insert(al._primary? 0 : a._links.size(), al);
|
||||
}
|
||||
|
||||
QUrl link(json.value("link").toString());
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
replyAction.insert(QStringLiteral("label"), QStringLiteral("Reply"));
|
||||
replyAction.insert(QStringLiteral("link"), QStringLiteral(""));
|
||||
replyAction.insert(QStringLiteral("type"), QStringLiteral("REPLY"));
|
||||
replyAction.insert(QStringLiteral("primary"), true);
|
||||
replyAction.insert(QStringLiteral("primary"), false);
|
||||
actionsArray.push_back(replyAction);
|
||||
|
||||
QJsonObject primaryAction;
|
||||
|
|
Loading…
Reference in a new issue