Ga naar hoofdinhoud

resolveObjectLock

import { resolveObjectLock } from '@conduction/nextcloud-vue'

const { locked, byMe, holder, expiresAt } = resolveObjectLock(record)

Resolves a record's whole lock state in one pass. Takes no store, makes no request, opens no subscription — so a list can call it once per row.

KeyTypeDescription
lockedbooleanWhether an unexpired lock is held.
byMebooleanWhether the current user holds it.
holderstring | nullDisplay name, falling back to uid.
expiresAtDate | nullWhen the lock lapses.

Prefer this over calling the individual helpers in sequence: each of those re-reads the payload, and four calls per row does four times the work for one answer.

An expired lock resolves to exactly the same shape as no lock at all — { locked: false, byMe: false, holder: null, expiresAt: null }.

Accepts both a record carrying @self and a flattened one.

See objectLock for the full rationale and the rest of the family.