nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.32k stars 4.06k forks source link

Users should be able to choose whether reminders are generated for events in the birthday calendar #1505

Open nursoda opened 8 years ago

nursoda commented 8 years ago

I'm not sure if it's correct in "server" component - but it does not only affect calendar or contacts, so it's either both - or "server", thus I report it here. Feel free to point me to re-insert it somewhere else.

Steps to reproduce Import a vcf file that contains data that contains birthday data.

Actual behaviour All birthday events in calendar are created with reminder (valarm).

Expected behaviour The admin should be able to set not to create any EVENT for contacts -or- The user should be able to opt not to create any EVENT for imported contacts -or- The admin should be able to set not to create any REMINDER for contacts -or- The user should be able to opt not to create remindes (valarms) while importing (contacts).

Server configuration Debian jessie fully patched, Apache 2.4.10 prefork, PHP 5.6.24, MySQL 5.5.52, Nextcloud 10.0 (stable) freshly installed via Webinstaller.

nickvergessen commented 8 years ago

Well you can also just not sync that birthday calendar, to get rid of the events?

nursoda commented 8 years ago

True, thanks!

However, that's not the point, is it? I like to be able to see birthdays on all devices, yet not be reminded.

At least not in the middle of the night ;-) But that's a more general request for enhancement to be able to set a fixed time or time offset for default alarms of all-day events. Which in turn could be a per installation, per account or a per calendar setting.

nickvergessen commented 8 years ago

@jancborchardt can we have your input here?

mnlipp commented 8 years ago

It's indeed extremely annoying (actually was, see workaround at the end of this comment). I moved from owncloud 9.x to nextcloud 10.0.1 yesterday. I didn't experience this problem before. The reminder pops up every time when the SOGO connector (Thunderbird/Lightning) synchronizes the birthday calendar that is automatically derived from the contacts.

I'm not sure whether this is related to importing contacts, though. I had all my contacts in the database already. So I would rephrase the requirement as "Users should be able to choose whether reminders are generated for events in the birthday calendar".

(To avoid unnecessary searching: the corresponding owncloud issue is https://github.com/owncloud/core/issues/26118. It refers to the Thunderbird problem with read-only calendars https://bugzilla.mozilla.org/show_bug.cgi?id=356002. There I found that I can turn off reminders for a specific calendar in lightning -- wasn't aware of that --, which solved the problem for me.)

nursoda commented 8 years ago

Yes, silencing a calendar in a user agent (here: TB) works, but it's the wrong way if you don't want/need reminders at all. Problem is that you need to silence ALL user agents. Using Business Calendar on Android for example, I can switch off the SOUND, but not the notification.

nickvergessen commented 8 years ago

Yeah, that's why the issue is still open ;)

jancborchardt commented 8 years ago

The user should be able to opt not to create remindes (valarms) while importing (contacts).

This seems to be the most sensible course of action. It’s definitely not an admin decision.

@georgehrke @raghunayyar @tcitworld we could have a default reminders setting for each calendar, including subscribed ones like birthdays?

mnlipp commented 8 years ago

I'm not sure if a default setting for each calendar is a good idea. The problem here arises from the special birthday calendar that is generated by the server. And for this generated calendar, it is reasonable to allow the user to control if alarms should be generated along with the dates.

For "ordinary" user maintained calendars it is not the servers job to modify them. It should take and preserve whatever clients send to it. Any different behavior makes things harder to understand.

Of course, I have to admit that if the default setting is to not add alarms to dates without alarms, then the proposed feature would do no harm.

georgehrke commented 8 years ago

For "ordinary" user maintained calendars it is not the servers job to modify them. It should take and preserve whatever clients send to it. Any different behavior makes things harder to understand.

The server is never ever going to change any events sent by some clients.

There is a CalDAV extension providing some mechanisms for defining default alarms for allDay and timed events (see https://tools.ietf.org/id/draft-daboo-valarm-extensions-01.html#rfc.section.9) This extension actually requires the server to add the default VAlarms, but it's only used by some Apple clients and also not implemented by the CalDAV server nextcloud uses.

We could use something similar for the birthday calendar though. Users will be able to define a custom default reminder and the server will take that choice into account when generating the birthday calendar.

nickvergessen commented 8 years ago

@jancborchardt so where should we put this setting? Personal page? Contacts app? Calendar app?

georgehrke commented 8 years ago

I'd go for the calendar app.

mnlipp commented 8 years ago

I'd go for the calendar app.

From a user's perspective, I agree. It's the only place where the contact birthday calendar currently appears in the user interface. (And considering the requests to allow modification of color for this calendar just as with the others, it needs an "edit" dialog on the long run anyway.)

georgehrke commented 8 years ago

Instead of providing default alarms for each calendar, which most clients don't expect anyway, we should simply add a simple select to the calendar settings, that provides the following options:

(This select will only influence the birthday calendar, having default alarms for ordinary events is a completely different topic)

jancborchardt commented 8 years ago

@georgehrke sounds good!

enoch85 commented 7 years ago

@georgehrke

(This select will only influence the birthday calendar, having default alarms for ordinary events is a completely different topic)

I would actually want this feature for ordinary calendars. Should I open a new issue or is there one already regarding this?

georgehrke commented 7 years ago

I would actually want this feature for ordinary calendars. Should I open a new issue or is there one already regarding this?

What exact feature do you want? :)

I don't think we will go for a dedicated input for each calendar. But I can very well imagine adding a user-based option for all (non-birthday) calendars. One for all day and one for timed events.

This option should only affect events created in the calendar app though. As said above, the standard for adding alarms on the server is a very uncommon and used only by apple software (to my knowledge). Implementing it might cause very weird behavior in some clients.

enoch85 commented 7 years ago

This is what I want:

None 9AM on day of birthday 1 day before (9AM) 2 days before (9AM) 1 week before (9AM)

Works for me. :)

But I can very well imagine adding a user-based option for all (non-birthday) calendars.

georgehrke commented 7 years ago

Okay :) Can you please open a feature request in the calendar bug tracker?

nursoda commented 7 years ago

Unspecified: What shall happen if one already has birthday events and changes the general setting? Re-Create all birthday calendar alarms?

Anyone willing to set a milestone for this issue? ;-)

nursoda commented 6 years ago

Sidenote in case someone stumbles upon the mute issue also discussed within this bug: Read-only calendars do not contain alarms since NC 13, see https://github.com/nextcloud/server/pull/6903. Mind that e.g. mobile clients cache existing appointments. After I removed and re-connected my account, an event that has an alarm for the "read-only-user" did not have an alarm on my device.

CNeutron commented 6 years ago

Seems the issue is not mute, as 6903 only concerns shared calendars. I hope that I'm not seeing something, could you please point me in the right direction on how to get rid of the annoying birthday alarms at midnight?

georgehrke commented 6 years ago

This issue is still open -> you can't select it yet.

dolanor commented 6 years ago

I'm totally for an alarm in a calendar settings. While

None 9AM on day of birthday 1 day before (9AM) 2 days before (9AM) 1 week before (9AM)

Is already good, setting it with more freedom would be better. For example, I have friends which are further away now, and a 1 month alarm let me organize myself and the other friends to make a surprise and be able to reserve a train/plane in advance, etc.

andre-spindler commented 6 years ago

Hello!

I have nextcloud 14.0.1 running, but didn't manage to find this setting. Where can I set the default reminders for the birthday calender of contact entries or disable them?

juni-vogt commented 5 years ago

Hi, it would be cool if this could be added to the next milestone :)

georgehrke commented 5 years ago

@matthias-g Feel free to step in and help implementing this. :)

juni-vogt commented 5 years ago

Ok I can try c:

Am 16. Dezember 2018 18:24:16 MEZ schrieb Georg Ehrke notifications@github.com:

@matthias-g Feel free to step in and help implementing this. :)

-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/nextcloud/server/issues/1505#issuecomment-447660476

EarthlingX commented 4 years ago

Any news about this issue yet?

I am also very annoyed by those nightly birthday notifications that I can not disable… :slightly_frowning_face:

franzhartwig commented 4 years ago

After every upgrade I do: sudo -u www-data sed -i 's#\t$alarm = $vCal#\t/**$alarm = $vCal#g' /var/www/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php sudo -u www-data sed -i 's#$vEvent->add($alarm);#$vEvent->add($alarm);*/#g' /var/www/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php

This comments out the five lines generating the alarms (line 283-287, actually in version 17.0.2.1). That's my workaround for this issue.

EarthlingX commented 4 years ago

After every upgrade I do: sudo -u www-data sed -i 's#\t$alarm = $vCal#\t/**$alarm = $vCal#g' /var/www/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php sudo -u www-data sed -i 's#$vEvent->add($alarm);#$vEvent->add($alarm);*/#g' /var/www/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php

This comments out the five lines generating the alarms (line 283-287, actually in version 17.0.2.1). That's my workaround for this issue.

Awesome, thank you very much!

Maybe you can push a commit to make several users happy? :+1:

nursoda commented 4 years ago

An option for this should be visible to users at settings/admin/groupware

franzhartwig commented 4 years ago

My solution would kill reminders for all users. So it's not a solution, but a workaround. Deactivating the reminders should be an option.

srwareham commented 4 years ago

After every upgrade I do: sudo -u www-data sed -i 's#\t$alarm = $vCal#\t/**$alarm = $vCal#g' /var/www/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php sudo -u www-data sed -i 's#$vEvent->add($alarm);#$vEvent->add($alarm);*/#g' /var/www/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php

This comments out the five lines generating the alarms (line 283-287, actually in version 17.0.2.1). That's my workaround for this issue.

For anyone else that had the BirthdayService.php file at a different path, here's a modified version I've put in a small bash script:

#!/usr/bin/env bash
birthdayServicePath="/var/www/html/apps/dav/lib/CalDAV/BirthdayService.php"
cp "$birthdayServicePath" .
sudo -u www-data sed -i 's#\t$alarm = $vCal#\t/**$alarm = $vCal#g' "$birthdayServicePath" 
sudo -u www-data sed -i 's#$vEvent->add($alarm);#$vEvent->add($alarm);*/#g' "$birthdayServicePath"
galianet commented 4 years ago

If you want to keep the alarm, but don't ring at 00:00 AM After every upgrade, in BirthdayService.php Change the line:

$alarm->add($vCal->createProperty('TRIGGER', '-PT0M', ['VALUE' => 'DURATION']));

To ring at 9AM on day of birthday: $alarm->add($vCal->createProperty('TRIGGER', 'PT9H', ['VALUE' => 'DURATION']));

To ring 1 day before (9AM): $alarm->add($vCal->createProperty('TRIGGER', '-PT15H', ['VALUE' => 'DURATION']));

2 days before (9AM) $alarm->add($vCal->createProperty('TRIGGER', '-P1DT15H', ['VALUE' => 'DURATION']));

1 week before (9AM) $alarm->add($vCal->createProperty('TRIGGER', '-P6DT15H', ['VALUE' => 'DURATION']));

nursoda commented 4 years ago

Thanks for that admin hack! But NC / Calendar really should offer such an option itself.

eloo commented 4 years ago

If you want to keep the alarm, but don't ring at 00:00 AM After every upgrade, in BirthdayService.php Change the line:

$alarm->add($vCal->createProperty('TRIGGER', '-PT0M', ['VALUE' => 'DURATION']));

To ring at 9AM on day of birthday: $alarm->add($vCal->createProperty('TRIGGER', 'PT9H', ['VALUE' => 'DURATION']));

To ring 1 day before (9AM): $alarm->add($vCal->createProperty('TRIGGER', '-PT15H', ['VALUE' => 'DURATION']));

2 days before (9AM) $alarm->add($vCal->createProperty('TRIGGER', '-P1DT15H', ['VALUE' => 'DURATION']));

1 week before (9AM) $alarm->add($vCal->createProperty('TRIGGER', '-P1WT15H', ['VALUE' => 'DURATION']));

I'm also using this hack but as far i know this only applies to new entries. Do you if its possible to "adjust" already existing events?

Currently my workaround was to remove the calendars and rebuild them. But this is not very good solution :D

EarthlingX commented 4 years ago

Currently my workaround was to remove the calendars and rebuild them. But this is not very good solution :D

Same problem here: Changes are only made for future calendar entries, but not for already existing ones.

So you delete the whole birthday calendar, but how do you rebuild the new one? I thought, if deleted once, it can not be recreated?

tcitworld commented 4 years ago

So you delete the whole birthday calendar, but how do you rebuild the new one? I thought, if deleted once, it can not be recreated?

It will be recreated by cron. Admins can use dav:sync-birthday-calendar %user%.

EarthlingX commented 4 years ago

It will be recreated by cron. Admins can use dav:sync-birthday-calendar %user%.

So just deleting the birthday calendar via Nextcloud-Web-GUI in "Calendar"-tab will be enough?

galianet commented 4 years ago

Currently my workaround was to remove the calendars and rebuild them. But this is not very good solution :D

Same problem here: Changes are only made for future calendar entries, but not for already existing ones.

So you delete the whole birthday calendar, but how do you rebuild the new one? I thought, if deleted once, it can not be recreated?

In the web interface, go to settings / admin / groupware and uncheck and check again "Automatically generate a birthday calendar"

eloo commented 4 years ago

@galianet

In the web interface, go to settings / admin / groupware and uncheck and check again "Automatically generate a birthday calendar"

Ah this nice.. So i now just need to have a script which is applying php changes on every start. So when my docker image is updated the changes will be applied again

kosli commented 4 years ago

@eloo For such cases I used to build my own container -> Take a Dockerfile, use the official NC docker as base and just apply the file changes (e.g. via patch).... done.... so you don't need to care about updates on the new versions...

georgehrke commented 4 years ago

Can you please take the off-topic discussions about Docker to help.nextcloud.com? Thanks!

BluemchenBlau commented 4 years ago

Again: Please integrate this in the next update!

Kariton commented 4 years ago

If you want to keep the alarm, but don't ring at 00:00 AM After every upgrade, in BirthdayService.php Change the line:

$alarm->add($vCal->createProperty('TRIGGER', '-PT0M', ['VALUE' => 'DURATION']));

To ring at 9AM on day of birthday: $alarm->add($vCal->createProperty('TRIGGER', 'PT9H', ['VALUE' => 'DURATION']));

To ring 1 day before (9AM): $alarm->add($vCal->createProperty('TRIGGER', '-PT15H', ['VALUE' => 'DURATION']));

2 days before (9AM) $alarm->add($vCal->createProperty('TRIGGER', '-P1DT15H', ['VALUE' => 'DURATION']));

1 week before (9AM) $alarm->add($vCal->createProperty('TRIGGER', '-P6DT15H', ['VALUE' => 'DURATION']));

Nice. Thanks for that info.

here is what i have done:

#!/bin/bash

#### define vars ####
TARGETFILE=/var/www/nextcloud/apps/dav/lib/CalDAV/BirthdayService.php
### NOTIFYTIME_DEFAULT=-PT0M ###
NOTIFYTIME_OLD=-PT0M
NOTIFYTIME_NEW=PT9H  # at 9AM on day of birthday
SEARCHSTRING="\$alarm->add(\$vCal->createProperty('TRIGGER', '$NOTIFYTIME_OLD', ['VALUE' => 'DURATION']));"
REPLACESTRING="\$alarm->add(\$vCal->createProperty('TRIGGER', '$NOTIFYTIME_NEW', ['VALUE' => 'DURATION']));"

#### do it ####
grep -F -q "$SEARCHSTRING" $TARGETFILE && \
  cp $TARGETFILE $TARGETFILE.backup_$(date --iso-8601=seconds) && \
  python replace_string.py "$SEARCHSTRING" "$REPLACESTRING" $TARGETFILE
exit 0

and a python script to get rid of that escaping in 'sed' that would be needed otherways.

#!/usr/bin/python
import sys

# Replace string in a file (in place)
match=sys.argv[1]
replace=sys.argv[2]
filename=sys.argv[3]

print "Replacing strings in",filename

with open(filename,"r") as f:
  data = f.read().replace(match,replace)

with open(filename,"w") as f:
  f.write(data)

But now I have another problem. It's OT but I should share that at least.

My sync via DAVx5 is now "broken" for birthdays. Each birthday on my phone calendar is now listet as "notify -9 Minutes before" (Simple Calendar Pro by Tibor Kaputa from F-Droid) I dont know if there are similar issues with other apps.

But in Nextcloud everything is fine.

felurx commented 4 years ago

Would it be possible to have the 'Contact birthdays' as a calendar owned by each user which is automatically populated by the server? This way it'd be possible to change colors and have other customizations, and, of course, set up reminders as wanted.

b-pfl commented 4 years ago

As a calendar user, I would really appreciate the following behavior (or be able to configure is in such a way):

ScaroCI commented 3 years ago

Thanks you all for the ideas on how to solve the issue that the Birthday Cad wakes me up at midnight to remind me to celebrate my friends. As I could understand, the main reason is that this Calendar is Read-Only imported/created and it remains being like this. Can we change that ? In general when you import something, you should simply be the Owner right ? Because if the only way is to have a script (!!) and to run it each time you upgrade (!!!!!) you're killing directly your solution and I'm pretty sure you lost, loose and will be loosing a lot of potential users. Be sure of that. Being wake up at midnight it's not fun. Even worst when you sleep with someone else and you have to explain why he/she awake once more time by your device. I'm sure you can understand that in 2020 (almost 2021) this cannot be acceptable from a simple User-Experience point of view. You/We should find a better solution for that issue, bug whatever you called it.

From "where" I'm talking to : even if I'm not a Developer, I worked for a NASDAQ software company in the DevOps team linked to the 'software environment'. So even if I'm not a pure developer, I worked with them every single day (and I love it !!) in order to fix bug but also to make their work useful for our end-users. So please be sure that my comment is motivated by only one idea : to make most people using your nice and important work ! I'm using this solution in order to forget the GAFA solutions...

PS : sorry for my English, I'm French !

SamuXzX commented 2 years ago

Any news?

tsvallender-zz commented 2 years ago

Hi, just run into this issue myself. I was trying to take a look at fixing it but am struggling to work out where the calendar is actually being generated? Is it in the contacts app and if so where? Pointers appreciated.