feat: add custom field default key#11
Conversation
barredterra
left a comment
There was a problem hiding this comment.
On second though, the 'fetch from' brings the following problems:
- It always overrides a manually entered, different key.
- That could be solved by setting
"fetch_if_empty": 1. - However, that would still require that we always set a key, making the "no key" scenario impossible.
I think we'll need a more fine-tuned mechanism here, that could be described as "fetch only once". Only when setting/changing the project, the default key should be set, never otherwise. This could be achieved by extending this script to not only set the billable % but also the default key:
|
If I have understood correctly the key is now fetched only once when the project is set. But you can also enter your own key and overwrite the default key. |
|
Manual backport: cf10a7a |
There was a problem hiding this comment.
This change is unnecessary / doesn't do anything
There was a problem hiding this comment.
I've added this to ensure that the custom field is created when we install the update on existing sites.
| .get_value("Project", child.project, "project_type") | ||
| .get_value("Project", child.project, ["project_type", "default_key"]) | ||
| .then(({ message }) => { | ||
| if (!child.key && message.default_key) { |
There was a problem hiding this comment.
Added this condition to ensure we don't override existing data
Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
Adds a custom field for a default key in projects. If no key is selected, the key defined in the default key is fetched.
Closes #10