jelhan / croodle

Croodle is a web application to schedule a date or to do a poll on a general topics.
MIT License
187 stars 24 forks source link

Set (default) expiration time for polls. #71

Closed xshadow closed 9 years ago

xshadow commented 9 years ago

Please set an default expiration date for all polls (for example 3 months), which a user could change manually. Else it will cause a filled up webdirectory with polls that aren't relevant anymore

jelhan commented 9 years ago

That means not only to add a expiration date for polls but also to add a feature to delete polls after a specified date. There isn't anything like that yet. It won't be there before 0.4.

jelhan commented 9 years ago

Support for expiration dates is implemented by 3690a60496109035c5f233fac12320926adc0d62. Currently it only checks if an expiration date is exceeded when someone tries to pull the poll data. If so the poll is deleted instantly. I think you also asked for a check of all existing polls on a regular basis. Whats your preferred way to execute a check like this one? Many web-applications simply expose an API endpoint (e.g. /cron). But since it has to map over all existing polls, read their data and parse the JSON this could be used for a DOS attack. Of course there could be some sort of authentication to verify that it's a legit call. But I think it's nice not to bother people with configuration when hosting Croodle...

xshadow commented 9 years ago

Nice, but that does really help. I think no user would pull a poll, if he/she think its deleted. So it still fills up the directory of the server :)

Selfdestruction is implemented in https://github.com/sebsauvage/ZeroBin, maybe there are some hints, how to do it.

jelhan commented 9 years ago

Pushed a php cli script to check and delete existing polls. 148cf81f01c6aabbca4cb03a7d3fa30159125c26

All existing polls without expiration date are treated as having an expiration date never. This is also an option exposed to user when creating a new poll.

As far as I understand the ZeroBin code it does not provide any functionality to check and delete old bins on a regular basis. All checks I found just are executed when a poll is requested (expiration date, burn after reading) or a explicit delete request is made by an authorised user.

xshadow commented 9 years ago

Thats cool.

All existing polls without expiration date are treated as having an expiration date never

Do you mean old polls (before you enabled this feature)?

I think it would be nice, if a poll has an default expiration time of 30 days / 30 days after last picked poll option, if its a time poll. Else the poll would stay on the server forever.

In my mind the best behavior would be: Without user interaction the poll should be deleted after 30 days, only if the user chooses it is valid forever, the expiration date should be never. Deleted by this php script via cron.

jelhan commented 9 years ago

Currently poll creator could choose out of six expiration durations:

All polls before this feature are treated as having a expiration date never.

30 days/1 month might be to short as default value for some use cases. If we choose a default option depending on most in the future date picked, we have to deal with several exceptions:

It would be possible to implement such a complex logic and define the values but we also have to care about user experience. It would be very hard to guess such a logic for end user. Therefore from end user perspective it might seems to be randomly. And the interface for overriding the default date would have to be a calendar which is much harder to interact with for durations than a select list.