Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,25 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments',
];

/** @var array properties to index */
public static $indexProperties = ['CATEGORIES', 'COMMENT', 'DESCRIPTION',
'LOCATION', 'RESOURCES', 'STATUS', 'SUMMARY', 'ATTENDEE', 'CONTACT',
'ORGANIZER'];
/**
* properties to index
*
* This list has to be kept in sync with ICalendarQuery::SEARCH_PROPERTY_*
*
* @see \OCP\Calendar\ICalendarQuery
*/
private const INDEXED_PROPERTIES = [
Copy link
Member

Choose a reason for hiding this comment

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

Any problem with public, so it can be used in apps, etc?

Copy link
Member Author

Choose a reason for hiding this comment

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

That is what we have ICalendarQuery for. This class here is private API. Apps must not access the class directly.

'CATEGORIES',
'COMMENT',
'DESCRIPTION',
'LOCATION',
'RESOURCES',
'STATUS',
'SUMMARY',
'ATTENDEE',
'CONTACT',
'ORGANIZER'
];

/** @var array parameters to index */
public static $indexParameters = [
Expand Down Expand Up @@ -2948,7 +2963,7 @@ public function updateProperties($calendarId, $objectUri, $calendarData, $calend
}

foreach ($component->children() as $property) {
if (in_array($property->name, self::$indexProperties)) {
if (in_array($property->name, self::INDEXED_PROPERTIES, true)) {
$value = $property->getValue();
// is this a shitty db?
if (!$this->db->supports4ByteText()) {
Expand Down
57 changes: 57 additions & 0 deletions lib/public/Calendar/ICalendarQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

namespace OCP\Calendar;

use DateTimeImmutable;
Expand All @@ -34,6 +35,56 @@
*/
interface ICalendarQuery {

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_CATEGORIES = 'CATEGORIES';

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_COMMENT = 'COMMENT';

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_DESCRIPTION = 'DESCRIPTION';

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_LOCATION = 'LOCATION';

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_RESOURCES = 'RESOURCES';

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_STATUS = 'STATUS';

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_SUMMARY = 'SUMMARY';

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_ATTENDEE = 'ATTENDEE';

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_CONTACT = 'CONTACT';

/**
* @since 24.0.0
*/
public const SEARCH_PROPERTY_ORGANIZER = 'ORGANIZER';

/**
* Limit the results to the calendar uri(s)
*
Expand All @@ -51,6 +102,12 @@ public function setSearchPattern(string $pattern): void;
/**
* Define the property name(s) to search for
*
* Note: Nextcloud only indexes *some* properties. You can not search for
* arbitrary properties.
*
* @param string $value any of the ICalendarQuery::SEARCH_PROPERTY_* values
* @psalm-param ICalendarQuery::SEARCH_PROPERTY_* $value
*
* @since 23.0.0
*/
public function addSearchProperty(string $value): void;
Expand Down