enhancement
major
defect
major
minor
major
#29732
TL Views: <create-transient container="…"> creates the draft without the container's context; option lists and context-dependent defaults of the draft see no container
Problem
CreateTransientAction (<create-transient>, #29675) uses its container only for the rights check; the draft itself is created without context: TransientObjectFactory.INSTANCE.createObject(clazz, null). TL-Script's new(type, context: $container, transient: true) creates the draft in the container's context instead.
Everything on the draft that depends on its container therefore sees none while the dialog is open: an option list reading $draft.container(), a default computed from the context, a ContextAwareSequenceName.
Seen in the TL Development app:
- Reply on a comment: the reply draft's cited option list reads $comment.container() (the ticket).
- The ticket create dialog: the draft is created in the chosen project's context, so that it draws that project's ticket number.
Both keep their new(..., context: …, transient: true) scripts.
Expected
With a container, <create-transient> creates the draft in the context of the container, the way new(type, context: $container, transient: true) does: the draft's container() is the container, and default values are computed in its context.
Test
A type whose default reads the create context; <create-transient container="c" reference="r" type="…"/>: the draft has the container as its container, and the default sees it.
Lösung
- CreateTransientAction resolves the container channel at execution and passes its value as create context to TransientObjectFactory - the draft's tContainer() is the container, TLFactory.setupDefaultValues runs in its context.
- The resolution of the container channel (value must be a TLObject or empty) is shared by CreateTransientAction and PersistTransientAction through CreationContainer.
- The reference remains part of the rights check (and, in <persist-transient>, of adding the persistent object to the container); a transient object has no container reference of its own, as with new(..., context: …, transient: true).