Layout.fillWidth: true
Layout.minimumHeight: Style.minActivityHeight
- showDismissButton: model.links.length > 0 && model.linksForActionButtons.length === 0
+ showDismissButton: model.links.length > 0
activityData: model
adjustedHeaderColor: root.adjustedHeaderColor
- onTriggerAction: activityModel.slotTriggerAction(model.index, actionIndex)
+ onTriggerAction: activityModel.slotTriggerAction(model.activityIndex, actionIndex)
onShowReplyField: root.isTalkReplyOptionVisible = true
}
}
return;
}
- const auto activityLinks = _finalList[activityIndex]._links;
-
- const auto foundActivityLinkIt = std::find_if(std::cbegin(activityLinks), std::cend(activityLinks), [](const ActivityLink &link) {
- return link._verb == QStringLiteral("DELETE");
- });
-
- if (foundActivityLinkIt == std::cend(activityLinks)) {
- qCWarning(lcActivity) << "Couldn't find dismiss action in activity at index" << activityIndex
- << " links.size() " << activityLinks.size();
- return;
- }
-
- const auto actionIndex = static_cast<int>(std::distance(activityLinks.begin(), foundActivityLinkIt));
-
- if (actionIndex < 0 || actionIndex > activityLinks.size()) {
- qCWarning(lcActivity) << "Couldn't find dismiss action in activity at index" << activityIndex
- << " actionIndex found " << actionIndex;
- return;
- }
+ constexpr auto deleteVerb = "DELETE";
+ const auto activity = _finalList[activityIndex];
- slotTriggerAction(activityIndex, actionIndex);
+ emit sendNotificationRequest(activity._accName, Utility::concatUrlPath(accountState()->account()->url(), "ocs/v2.php/apps/notifications/api/v2/notifications/" + QString::number(activity._id)).toString(), deleteVerb, activityIndex);
}
AccountState *ActivityListModel::accountState() const
}
a._link = link;
- // Add another action to dismiss notification on server
- // https://github.com/owncloud/notifications/blob/master/docs/ocs-endpoint-v1.md#deleting-a-notification-for-a-user
- constexpr auto deleteVerb = "DELETE";
- const auto itLink = std::find_if(std::cbegin(a._links), std::cend(a._links), [deleteVerb](const ActivityLink& link) {
- Q_UNUSED(deleteVerb)
- return link._verb == deleteVerb;
- });
- if (itLink == std::cend(a._links)) {
- ActivityLink al;
- al._label = tr("Dismiss");
- al._link = Utility::concatUrlPath(ai->account()->url(), notificationsPath + "/" + QString::number(a._id)).toString();
- al._verb = deleteVerb;
- al._primary = false;
- a._links.append(al);
- }
-
list.append(a);
}
emit newNotificationList(list);