Skip to content

feat(user status): automate user status for events - #40615

Merged
ChristophWurst merged 1 commit into
masterfrom
enh/automate-calendar-event-user-status
Nov 9, 2023
Merged

feat(user status): automate user status for events#40615
ChristophWurst merged 1 commit into
masterfrom
enh/automate-calendar-event-user-status

Conversation

@miaulalala

@miaulalalamiaulalala commented Sep 25, 2023

Copy link
Copy Markdown
Contributor

Summary

The user status currently only takes into account the availability settings. Automatically set a user status to free or busy depending on their calendar transparency, event status and availability settings combined.

This can be done with a free/busy request just like the Calendar app does for the free/busy modal.

How to test:

THe easiest way to test is to create 5- minute calendar events and have some sort of VAVAILABLITY setting.

The decision tree is the following:

Status decision tree:

USER DEFINED STATUS

  • Persistent status such as DND, OFFLINE, INVISIBLE?
    • leave the status alone
  • Not persistent?
    • get Calendar status
      • calendar checks for events (BUSY) and availability (within the availability and no event = ONLINE, event = AWAY + in a meeting status, outside availability = BUSY + away status)
      • calendar reports identical to existing status (i.e. online == online)
      • calendar status is different (i. e. user has status ONLINE but calendar reports AWAY or BUSY)
        • process the new calendar status - in a meeting if a event is happening, away if outside availability

NOT USER DEFINED

  • get calendar status
  • process the new calendar status - in a meeting if a event is happening, away if outside availability

TODO

  • tests

Checklist

@miaulalalamiaulalala self-assigned this Sep 25, 2023
@miaulalalamiaulalala added 2. developing Work in progress feature: status feature: caldav Related to CalDAV internals enhancement pending documentation This pull request needs an associated documentation update labels Sep 25, 2023
@miaulalalamiaulalala added this to the Nextcloud 28 milestone Sep 25, 2023

@github-advanced-securitygithub-advanced-securityAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Psalm found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/dav/lib/CalDAV/CalendarImpl.php Fixed
Comment threadapps/dav/lib/CalDAV/CalendarImpl.php Fixed
Comment threadapps/dav/lib/CalDAV/Schedule/Plugin.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/user_status/lib/Db/UserStatusMapper.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
@miaulalala
miaulalalaforce-pushed the enh/automate-calendar-event-user-status branch from fca0790 to f4cfa4dCompareOctober 3, 2023 14:43
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
@miaulalala
miaulalalaforce-pushed the enh/automate-calendar-event-user-status branch from 8e8911b to d307b47CompareOctober 12, 2023 21:16
Comment threadapps/dav/lib/CalDAV/CalendarImpl.php Fixed
Comment threadapps/dav/lib/CalDAV/CalendarImpl.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
@miaulalala

This comment was marked as off-topic.

Comment threadapps/dav/lib/CalDAV/CalendarImpl.php Fixed
Comment threadapps/dav/lib/CalDAV/CalendarImpl.php Fixed
Comment threadapps/dav/lib/CalDAV/CalendarImpl.php Fixed
@miaulalala

Copy link
Copy Markdown
ContributorAuthor

Having nextcloud/calendar#3193 would be good @ChristophWurst - shall I add it as a followup?

Context:
image

@nimishavijay

This comment was marked as off-topic.

@jancborchardt

This comment was marked as off-topic.

@miaulalala

This comment was marked as off-topic.

@nimishavijay

Copy link
Copy Markdown
Member

I think the status alignment with teams needs to be a separate ticket and is not within the scope of this feature.

Would it not be possible to just change the icons for all the statuses?
New icons:
Available: check-circle in --color-success
Busy: circle in --color-error
Away: watch-later in --color-warning
DND: do-not-disturb-on in --color-error
Offline: trip-origin in --color-text-maxcontrast

Comment threadapps/dav/lib/CalDAV/Status/StatusService.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
@jancborchardt

Copy link
Copy Markdown
Member

Agree with @nimishavijay. If that is out of scope, a good first step would be to just do the same that we do when in a call – which is not changing the status, only emoji and status text, right @nickvergessen?

@nickvergessen

Copy link
Copy Markdown
Member

which is not changing the status, only emoji and status text, right

We do change the status to "Away" (when the user was not invisible (=> no status change) or DND (=> in call with DND))
https://github.com/nextcloud/spreed/blob/3ce5c7bdaafeb8f4747f7bc05e60ebd33ada192a/lib/Status/Listener.php#L55-L83

@miaulalala

Copy link
Copy Markdown
ContributorAuthor

Agree with @nimishavijay. If that is out of scope, a good first step would be to just do the same that we do when in a call – which is not changing the status, only emoji and status text, right @nickvergessen?

Aight, chaningin the status to "away" for now, and removing the icons. Follow up ticket for icon changes discussion here:#41299

@blizzzblizzz mentioned this pull request Nov 6, 2023
@miaulalala
miaulalala marked this pull request as ready for review November 8, 2023 16:41
@ChristophWurstChristophWurst added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Nov 8, 2023

@ChristophWurstChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code looks good

@ChristophWurstChristophWurst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Worked for my local instance once I cleared the Away override and the custom status message

@miaulalala
miaulalalaforce-pushed the enh/automate-calendar-event-user-status branch from 23fbe23 to ab261fcCompareNovember 8, 2023 19:19
Comment threadapps/dav/lib/CalDAV/CalendarImpl.php Fixed
Comment threadapps/dav/lib/CalDAV/Status/StatusService.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/user_status/lib/Service/StatusService.php Fixed
Comment threadapps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php Fixed
Comment threadapps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php Fixed
Comment threadapps/dav/lib/CalDAV/Status/StatusService.php Fixed
Comment threadapps/dav/lib/CalDAV/Status/StatusService.php Fixed
Comment threadapps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php Fixed
Comment threadapps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php Fixed
Comment threadapps/dav/lib/CalDAV/FreeBusy/FreeBusyGenerator.php Fixed
@miaulalala
miaulalalaforce-pushed the enh/automate-calendar-event-user-status branch 3 times, most recently from e358b7b to 1661393CompareNovember 9, 2023 11:38
Comment threadlib/composer/composer/autoload_classmap.php Outdated
@miaulalala
miaulalalaforce-pushed the enh/automate-calendar-event-user-status branch from 1661393 to fc9f805CompareNovember 9, 2023 14:45
and automatically set a user status to free or busy depending on their calendar
transparency, event status and availability settings
Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala
miaulalalaforce-pushed the enh/automate-calendar-event-user-status branch from fc9f805 to f14a4f8CompareNovember 9, 2023 15:20
@miaulalala

Copy link
Copy Markdown
ContributorAuthor

Failing Cypress test: theming/admin-settings.cy.ts (unrelated)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviewsenhancementfeature: caldavRelated to CalDAV internalsfeature: statuspending documentationThis pull request needs an associated documentation update