Filter out invalid content in lists

Authored by leinir on Feb 7 2019, 1:54 PM.



Prior to this change, if the ocs server being queried returned a list of entries containing invalid entries (such as happened a few days ago for the otherwise empty Akonadi email providers category), the listing function would faithfully return that list of entries verbatim, which led consumers of that list to insist there were more entries to fetch, and then try again, and again, and again. With this patch, only valid entries get forwarded as results to the consumers (be they knewstuff's own dialogues, or others, such as Discover or Peruse).

This change is in KNewStuff rather than Attica, because Attica by design does not apply heuristics of any sort to its functions. That, again by design, is what KNewStuff is for.

Diff Detail

R304 KNewStuff
Lint Skipped
Unit Tests Skipped
leinir created this revision.Feb 7 2019, 1:54 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 7 2019, 1:54 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
leinir requested review of this revision.Feb 7 2019, 1:54 PM
apol added a subscriber: apol.Feb 8 2019, 10:44 AM

I guess the patch makes sense overall.


Maybe it would be easier to read if we had a if (!content.isValid()) continue; ....

leinir marked an inline comment as done.Feb 8 2019, 11:45 AM
leinir added inline comments.

Hmm... the patch certainly would, i'll swap that around a bit. Generally don't like negations too much if i can avoid them, hunting exclamation marks just gets tiring after a while, but yeah, smaller patch is good anyway :)

leinir updated this revision to Diff 51169.Feb 8 2019, 11:46 AM
leinir marked an inline comment as done.

Swap the logic around a bit, makes for an easier to read patch and whatnot.

ngraham added a subscriber: ngraham.Feb 8 2019, 2:08 PM

Conceptually this makes sense, provided we can rely on content.isValid() returning valid results. :)

ngraham accepted this revision.Feb 8 2019, 6:28 PM
This revision is now accepted and ready to land.Feb 8 2019, 6:28 PM
This revision was automatically updated to reflect the committed changes.