Skip to content

Contact column type #3442

Todo
Todo

Description

@rubenvdlinde

Is your feature request related to a problem? Please describe.

  • Rows often relate to a person outside the instance, such as an applicant or a supplier.
Why this is needed
  • A case or an order relates to a person outside the instance, such as an applicant or a supplier. Today their name and address are typed into text columns, apart from the address book, and the usergroup column only points at accounts and groups on the instance.
  • buildiq parity: the "Nextcloud integrations" widget group (files, calendar, people) is missing in Tables and needs no OpenRegister (section 3 of the feature comparison). Proposal P11 decides that contacts are a column type through OCP\Contacts.
  • No plan item depends on it. It is the first place Tables stores a vCard UID, which the linking concept also uses as the identity of a contact.

Describe the solution you'd like

  • A column type whose cell points at a contact in an address book, through the server's OCP\Contacts interface. The cell stores the contact's uid; the contacts app edits the contact.
Diagram
erDiagram
    TABLE ||--o{ COLUMN : has
    TABLE ||--o{ ROW : has
    COLUMN ||--o{ CELL : "type contact"
    ROW ||--o{ CELL : holds
    CELL }o--|| CONTACT : "stores the UID"
    ADDRESS_BOOK ||--o{ CONTACT : holds
    CELL {
        string value "vCard UID"
    }
    CONTACT {
        string uid
        string displayName
    }
Loading
Acceptance Criteria
  • A contact column can be created on api/1 and api/2 and appears in the OpenAPI document.
  • The cell stores a uid; reading the row returns the display name when the reader may see the contact.
  • The cell editor searches the reader's address books.
  • Unit tests against the contacts interface.
  • Creating and changing the column: the route declares its permission with #[RequirePermission] (manage on the table) using a fixed node type (table), and the service checks the same right before it writes (as agreed on UUIDs for rows #3093 and in the review of feat(contexts): give applications a menu with its own API #3135). A test runs every write as a reader and expects 403, or 404 where the reader may not know the object exists. A user can only put a contact in a cell that they can read themselves.
  • The UID is stored as text. If the type gets its own cell table (question 1): nullable columns, no empty-string defaults, since Oracle stores '' as NULL (as raised on Technical name for tables and applications, CRUD routes by application and table #3094), the version in appinfo/info.xml is bumped with the migration (as raised on feat(rows): add persistent UUIDv7 identifiers to rows #3229).
  • Deleting the column deletes its cells in the same transaction, as for every column type. A contact deleted in Contacts leaves its UID, shown as unavailable.
  • The cell editor uses NcSelect with the same contact search as the Contacts menu. Usable at 360 px wide: nothing cut off, no horizontal scroll of the page. Every action works by keyboard.
Out of scope
  • Creating or editing contacts from Tables: the contacts app edits the contact.
  • Accounts and groups on the instance: the usergroup column covers those.
  • A people widget, and a reference provider for contacts (the later phase of Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468).
  • Proposed slicing, one PR each in landing order: the column type on the API (api/1, api/2, OpenAPI), then the cell editor and renderer.

Describe alternatives you've considered

Questions for maintainers

  1. Cell storage: the existing text cell table (RowCellText), or a cell table of its own? We would go with the text cell table, because a UID is a string and no migration is needed.
  2. Should the column also offer accounts from the system address book, which overlaps with the usergroup column? We would go with no, so each column type has one clear meaning.

Additional context

Linking to other objects
  • The issue creates a column type. Each cell links a row to one contact in an address book, one way.
  • Today: the link column can hold the URL of a contact picked through unified search, and the usergroup column (UsergroupBusiness.php) points at accounts and groups. Neither uses a stable contact id. The concept behind Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468 names contact keyed on the vCard UID, with resource and reference providers in a later phase.
  • What this issue must do: store the UID and look up the address book at read time, so the cell uses the same key as a later link. Check per reader that the contact is visible (as the acceptance criteria say). Carry the UIDs through export and import and document that they only resolve where the address book exists. Show a deleted contact as unavailable.
Relevant files:
Related issues

Drafted with AI assistance from the project plan; @rjzondervan reviews it. Part of #3419.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions