Skip to content

Commit

Permalink
HAS ASSERTgit add src/git add src/git add src/git add src/! Bring act…
Browse files Browse the repository at this point in the history
…ivities requiring interaction on top.

Signed-off-by: alex-z <blackslayer4@gmail.com>
  • Loading branch information
allexzander committed Sep 12, 2023
1 parent 2d8c68d commit def9c02
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/gui/tray/sortedactivitylistmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit def9c02

Please sign in to comment.