Filter out invalid content in lists
ClosedPublic

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

Details

Summary

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

Repository
R304 KNewStuff
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
leinir created this revision.Thu, Feb 7, 1:54 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptThu, Feb 7, 1:54 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
leinir requested review of this revision.Thu, Feb 7, 1:54 PM

I guess the patch makes sense overall.

src/attica/atticaprovider.cpp
277

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

leinir marked an inline comment as done.Fri, Feb 8, 11:45 AM
leinir added inline comments.
src/attica/atticaprovider.cpp
277

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.Fri, Feb 8, 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.Fri, Feb 8, 2:08 PM

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

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