[plasma/discover] discover/qml: Submit usefulness for the right review regardless of how the list is sorted

Nate Graham <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit d0ffa18aa2cff1c2c023b01cfc2f018bde7232f1 by Nate Graham, on behalf of Taras Oleksyn.
Committed on 31/07/2026 at 13:36.
Pushed by ngraham into branch 'master'.

Submit usefulness for the right review regardless of how the list is sorted

This fixes a bug where `ReviewsModel.markUseful()` was expecting a row in the
source model, but `index` was a row in the `sortModel`, causing votes to be
submitted for the wrong review.

M  +4    -1    discover/qml/ReviewsPage.qml

https://invent.kde.org/plasma/discover/-/commit/d0ffa18aa2cff1c2c023b01cfc2f018bde7232f1

diff --git a/discover/qml/ReviewsPage.qml b/discover/qml/ReviewsPage.qml
index 28b6a909e..558d09338 100644
--- a/discover/qml/ReviewsPage.qml
+++ b/discover/qml/ReviewsPage.qml
@@ -210,8 +210,11 @@ Kirigami.OverlaySheet {
             width: ListView.view.width
             separator: index !== ListView.view.count - 1
             onMarkUseful: useful => {
-                page.model.markUseful(index, useful);
+                const modelIndex = sortModel.index(index, 0);
+                const sourceIndex = sortModel.mapToSource(modelIndex);
+                page.model.markUseful(sourceIndex.row, useful);
             }
+
         }
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.