From def9c02a2dfb14e7df9ef3c6ecbaffcef70a2344 Mon Sep 17 00:00:00 2001 From: alex-z Date: Tue, 12 Sep 2023 13:32:36 +0200 Subject: [PATCH] HAS ASSERTgit add src/git add src/git add src/git add src/! Bring activities requiring interaction on top. Signed-off-by: alex-z --- src/gui/tray/sortedactivitylistmodel.cpp | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/gui/tray/sortedactivitylistmodel.cpp b/src/gui/tray/sortedactivitylistmodel.cpp index d62ad4985bfae..f51250428d487 100644 --- a/src/gui/tray/sortedactivitylistmodel.cpp +++ b/src/gui/tray/sortedactivitylistmodel.cpp @@ -74,6 +74,43 @@ bool SortedActivityListModel::lessThan(const QModelIndex &sourceLeft, const QMod return leftIsErrorFileItemStatus; } + auto leftActivityNeedsPostInteraction = false; + auto rightActivityNeedsPostInteraction = false; + + auto leftActivityNeedsReplyInteraction = false; + auto rightActivityNeedsReplyInteraction = false; + + auto leftActivityNeedsWebInteraction = false; + auto rightActivityNeedsWebInteraction = false; + + for (const auto &link : leftActivity._links) { + if (link._verb == QByteArrayLiteral("POST")) { + leftActivityNeedsPostInteraction = true; + } else if (link._verb == QByteArrayLiteral("REPLY")) { + leftActivityNeedsReplyInteraction = true; + } else if (link._verb == QByteArrayLiteral("WEB")) { + leftActivityNeedsWebInteraction = true; + } + } + + for (const auto &link : rightActivity._links) { + if (link._verb == QByteArrayLiteral("POST")) { + rightActivityNeedsPostInteraction = true; + } else if (link._verb == QByteArrayLiteral("REPLY")) { + rightActivityNeedsReplyInteraction = true; + } else if (link._verb == QByteArrayLiteral("WEB")) { + rightActivityNeedsWebInteraction = true; + } + } + + if (leftActivityNeedsPostInteraction && !rightActivityNeedsPostInteraction) { + return true; + } else if (leftActivityNeedsReplyInteraction && !rightActivityNeedsReplyInteraction) { + return true; + } else if (leftActivityNeedsWebInteraction && !rightActivityNeedsWebInteraction) { + return true; + } + // Let's go back to more broadly comparing by type if (const auto rightType = rightActivity._type; leftType != rightType) { return leftType < rightType;