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

feat: hide caldav server settings if no app uses the caldav backend #46510

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

st3iny
Copy link
Member

@st3iny st3iny commented Jul 13, 2024

  • Resolves: none

Summary

This PR introduces a dependency type to info.xml called backends which can be used by apps to express their intent to use a specific server-side backend. Currently, the only backend to be required is caldav.

The caldav server admin settings will be hidden if no app is requiring the caldav backend.

Exemplary info.xml

<?xml version="1.0"?>
<info xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
	  xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
	<id>calendar</id>
	<name>Calendar</name>
	<summary>A Calendar app for Nextcloud</summary>
	<version>4.8.0-alpha.1</version>
	<namespace>Calendar</namespace>
	<!-- [...] -->
	<dependencies>
		<php min-version="8.0" max-version="8.3" />
		<nextcloud min-version="27" max-version="30" />
		<backend>caldav</backend>
	</dependencies>
	<!-- [...] -->
</info>

Hidden settings section

grafik

Checklist

@st3iny st3iny added this to the Nextcloud 30 milestone Jul 13, 2024
@st3iny st3iny self-assigned this Jul 13, 2024
@st3iny st3iny changed the title feat(info.xml): add backends options to indicate used backends feat: hide caldav server settings if no app uses the caldav backend Jul 13, 2024
@st3iny st3iny force-pushed the feat/info-xml-backends branch from 3c01364 to ed4f67e Compare July 13, 2024 15:11
@ChristophWurst
Copy link
Member

This PR introduces a new top level key in info.xml called backends which can be used by apps to express their intent to use a specific server-side backend. Currently, the only backend to be required is caldav.

If we are changing info.xsd we can also move this into the dependencies element. I think that makes the meaning clearer. The current approach is ambiguous as it could mean that the apps that list caldav as backend are providing it.

@st3iny st3iny force-pushed the feat/info-xml-backends branch from ed4f67e to 6b3fd3f Compare July 16, 2024 06:59
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far!

<xs:enumeration value="caldav"/>
</xs:restriction>
</xs:simpleType>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't forget to also submit these changes to the appstore repo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@st3iny st3iny added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jul 16, 2024
@st3iny st3iny marked this pull request as ready for review July 16, 2024 07:12
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
@tcitworld
Copy link
Member

The caldav server admin settings will be hidden if no app is requiring the caldav backend.

So you won't be able to set the caldav settings if you want to use calendar sync with clients without the Calendar app? Apart from hiding the settings, is there any more consequences under consideration?

@ChristophWurst
Copy link
Member

Yes, that is the behavior that was decided. We simply hide the settings. The case that someone uses the caldav backend without a Nextcloud frontend app is not covered.

@ChristophWurst
Copy link
Member

I guess we should add a note to https://docs.nextcloud.com/server/latest/admin_manual/groupware/calendar.html for admins who can't find the settings

@ChristophWurst ChristophWurst added the pending documentation This pull request needs an associated documentation update label Jul 17, 2024
@st3iny st3iny merged commit 718ef5d into master Jul 17, 2024
166 checks passed
@st3iny st3iny deleted the feat/info-xml-backends branch July 17, 2024 16:57
*
* @since 30.0.0
*/
public function isBackendRequired(string $backend): bool;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit problematic that we don't have CI in place to confirm this, but https://github.com/nextcloud/appstore/blob/master/nextcloudappstore/api/v1/release/info.xsd needs to be kept in sync.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yamanq
Copy link

yamanq commented Nov 16, 2024

@st3iny I updated to nextcloud 30.0.2 and I was getting hundreds of errors per minute leading me to this PR.

foreach() argument must be of type array|object, null given at .../nextcloud/lib/private/App/AppManager.php#881

I was able to fix this by changing that line:

# Old
foreach ($appInfo['dependencies']['backend'] as $appBackend) {
# My change to stop the error spam
foreach ($appInfo['dependencies']['backend'] ?? [] as $appBackend) {

I hope you can include this fix in a future version. Thank you.

@st3iny
Copy link
Member Author

st3iny commented Nov 19, 2024

Thanks for reporting.

The value in $appInfo['dependencies']['backend'] should always be set. The question is why it is unset in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement feature: apps management feature: caldav Related to CalDAV internals feature: settings pending documentation This pull request needs an associated documentation update
Projects
Development

Successfully merging this pull request may close these issues.

6 participants