Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-defined property updates #954

Merged
merged 2 commits into from
Apr 6, 2024

Conversation

jdknight
Copy link
Member

@jdknight jdknight commented Apr 6, 2024

publisher: rework page property processing

Calls to get_page_property should return None for non-entries on a page. This was the original intent with the implementation, but final tweaks for initial APIv2 support made the default result a partially populated property instance. This commit cleans up this to restore the original intent to have undefined properties return None, as well as updates various locations to use a default property value for each applicable section. Specifically:

  • CB_PROP_KEY returns a prepared empty value dictionary, since the requests will push up a new property change
  • Property fetching for v2 will return a None populated value to explicitly indicate that the requests should support this type of metadata, as well as that Confluence has reported no value exists
  • Update events will populate with a fallback value None, which will be updated with the provided property value for the expected change to the property value.

publisher: skip property version bumps for non-populated entries

This extension tracks certain property entries as an indication that a property is supported for this instance (e.g. on Confluence Cloud, a content width property exists, but not on Confluence Server (at this time?)). However, even if we track support, it does not mean that Confluence has reported the property has been defined for a page.

When we publish property updates for a page, we perform a version bump to indicate to Confluence the property is being updated. Although, for non-defined property entries, the value is set to None with no version entries. This causes the implementation to fail since there is no version value to bump. This commit corrects this by checking that the previous value does exist before attempting any version bump; otherwise, it treats the property update event as if it was created a new property entry.

Calls to `get_page_property` should return `None` for non-entries on a
page. This was the original intent with the implementation, but final
tweaks for initial APIv2 support made the default result a partially
populated property instance. This commit cleans up this to restore the
original intent to have undefined properties return `None`, as well as
updates various locations to use a default property value for each
applicable section. Specifically:

- `CB_PROP_KEY` returns a prepared empty value dictionary, since the
   requests will push up a new property change
- Property fetching for v2 will return a `None` populated value to
   explicitly indicate that the requests should support this type of
   metadata, as well as that Confluence has reported no value exists
- Update events will populate with a fallback value `None`, which will
   be updated with the provided property value for the expected change
   to the property value.

Signed-off-by: James Knight <james.d.knight@live.com>
This extension tracks certain property entries as an indication that
a property is supported for this instance (e.g. on Confluence Cloud, a
content width property exists, but not on Confluence Server (at this
time?)). However, even if we track support, it does not mean that
Confluence has reported the property has been defined for a page.

When we publish property updates for a page, we perform a version bump
to indicate to Confluence the property is being updated. Although, for
non-defined property entries, the value is set to `None` with no version
entries. This causes the implementation to fail since there is no
version value to bump. This commit corrects this by checking that the
previous value does exist before attempting any version bump; otherwise,
it treats the property update event as if it was created a new property
entry.

Signed-off-by: James Knight <james.d.knight@live.com>
@jdknight jdknight force-pushed the handle-non-defined-property-updates branch from 37d0f9a to ba09692 Compare April 6, 2024 17:35
@jdknight jdknight merged commit f81b7a5 into main Apr 6, 2024
29 checks passed
@jdknight jdknight deleted the handle-non-defined-property-updates branch April 6, 2024 17:39
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant