Skip to content

Introduce the concept of Contacts.Chunk

Niels De Graef requested to merge nielsdg/chunks into main

This commit introduces a new class Contacts.Chunk. Just like libfolks, we see a contact as a collection of data, or to word it differently: a collection built up from "chunks" of information.

The net result of adding this concept adds quite a bit of lines of code, but it does have some major benefits:

  • Rather than stuffing new properties into yet another if-else spread out over multiple places in contacts-utils (and quite a bit of other files), we can create a new subclass of Contacts.Chunk
  • This also goes for property-specific logic, which we can consolidate within their appropriate classes/files.
  • All of our logic is now unit-testable
  • We fix a few longstanding bugs related to property saving

In the future, this would allow for more cleanups/features:

  • We can put the serialization code for each property inside the Contacts.Chunk
  • We can extend ContactSheet to show a vCard's information, before actually importing it into a Folks.Individual.
  • We can write unit tests on the set of chunks, rather than flipping the table whenever we have to deal with yet another regression in the birthday editor.

Fixes #33 (closed) Fixes #124 (closed) Fixes #232 (closed) Fixes #248 (closed)

Edited by Niels De Graef

Merge request reports