diff options
| author | fpi | 2024-08-28 18:33:20 +0200 |
|---|---|---|
| committer | Robert Pluim | 2024-09-11 10:04:23 +0200 |
| commit | 8332b4dd07a43d09ff8eed7097873d9ac4d5afc8 (patch) | |
| tree | 0d70823b286166bb17f082f1ab912c5a03581acc /test | |
| parent | 69e1aca041c57ba425425d31471e1c8f86d3bf04 (diff) | |
| download | emacs-8332b4dd07a43d09ff8eed7097873d9ac4d5afc8.tar.gz emacs-8332b4dd07a43d09ff8eed7097873d9ac4d5afc8.zip | |
Allow comments to organizer in icalendar event replies (Bug#72831)
* lisp/gnus/gnus-icalendar.el
(gnus-icalendar-event--build-reply-event-body): Add optional COMMENT
argument to be inserted into the reply.
(gnus-icalendar-event-reply-from-buffer): Add COMMENT argument to be
passed through to gnus-icalendar-event--build-reply-event-body
(gnus-icalendar-reply-accept, gnus-icalendar-reply-tentative,
gnus-icalendar-reply-decline): If interactively called with a prefix
argument ask user for a COMMENT to add to the reply.
* test/lisp/gnus/gnus-icalendar-tests.el
(gnus-icalendar-accept-with-comment,
gnus-icalendar-decline-without-changing-comment): New tests.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/gnus/gnus-icalendar-tests.el | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/lisp/gnus/gnus-icalendar-tests.el b/test/lisp/gnus/gnus-icalendar-tests.el index 08c85013d17..72f1e660077 100644 --- a/test/lisp/gnus/gnus-icalendar-tests.el +++ b/test/lisp/gnus/gnus-icalendar-tests.el | |||
| @@ -255,5 +255,77 @@ END:VCALENDAR" (list "participant@anoncompany.com")))) | |||
| 255 | <2020-09-21 14:00-14:30 +1w>"))) | 255 | <2020-09-21 14:00-14:30 +1w>"))) |
| 256 | (setenv "TZ" tz)))) | 256 | (setenv "TZ" tz)))) |
| 257 | 257 | ||
| 258 | (ert-deftest gnus-icalendar-accept-with-comment () | ||
| 259 | "" | ||
| 260 | (let ((event "BEGIN:VEVENT | ||
| 261 | DTSTART;TZID=Europe/Berlin:20200915T140000 | ||
| 262 | DTEND;TZID=Europe/Berlin:20200915T143000 | ||
| 263 | RRULE:FREQ=WEEKLY;BYDAY=FR,MO,TH,TU,WE | ||
| 264 | DTSTAMP:20200915T120627Z | ||
| 265 | ORGANIZER;CN=anon@anoncompany.com:mailto:anon@anoncompany.com | ||
| 266 | UID:7b6g3m7iftuo90ei4ul00feqn_R20200915T120000@google.com | ||
| 267 | ATTENDEE;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE | ||
| 268 | ;CN=participant@anoncompany.com;X-NUM-GUESTS=0:mailto:participant@anoncompany.com | ||
| 269 | CREATED:20200325T095723Z | ||
| 270 | DESCRIPTION:Coffee talk | ||
| 271 | LAST-MODIFIED:20200915T120623Z | ||
| 272 | LOCATION: | ||
| 273 | SEQUENCE:0 | ||
| 274 | STATUS:CONFIRMED | ||
| 275 | SUMMARY:Casual coffee talk | ||
| 276 | TRANSP:OPAQUE | ||
| 277 | END:VEVENT") | ||
| 278 | (icalendar-identities '("participant@anoncompany.com"))) | ||
| 279 | (unwind-protect | ||
| 280 | (progn | ||
| 281 | (let* ((reply (with-temp-buffer | ||
| 282 | (insert event) | ||
| 283 | (gnus-icalendar-event-reply-from-buffer | ||
| 284 | (current-buffer) | ||
| 285 | 'accepted | ||
| 286 | icalendar-identities | ||
| 287 | "Can not stay long.")))) | ||
| 288 | (should (string-match "^ATTENDEE;.*?\\(PARTSTAT=[^;]+\\)" reply)) | ||
| 289 | (should (string-equal (match-string 1 reply) "PARTSTAT=ACCEPTED")) | ||
| 290 | (should (string-match "^COMMENT:\\(.*\\)$" reply)) | ||
| 291 | (should (string-equal (match-string 1 reply) "Can not stay long."))))))) | ||
| 292 | |||
| 293 | (ert-deftest gnus-icalendar-decline-without-changing-comment () | ||
| 294 | "" | ||
| 295 | (let ((event "BEGIN:VEVENT | ||
| 296 | DTSTART;TZID=Europe/Berlin:20200915T140000 | ||
| 297 | DTEND;TZID=Europe/Berlin:20200915T143000 | ||
| 298 | RRULE:FREQ=WEEKLY;BYDAY=FR,MO,TH,TU,WE | ||
| 299 | DTSTAMP:20200915T120627Z | ||
| 300 | ORGANIZER;CN=anon@anoncompany.com:mailto:anon@anoncompany.com | ||
| 301 | UID:7b6g3m7iftuo90ei4ul00feqn_R20200915T120000@google.com | ||
| 302 | ATTENDEE;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE | ||
| 303 | ;CN=participant@anoncompany.com;X-NUM-GUESTS=0:mailto:participant@anoncompany.com | ||
| 304 | CREATED:20200325T095723Z | ||
| 305 | DESCRIPTION:Coffee talk | ||
| 306 | LAST-MODIFIED:20200915T120623Z | ||
| 307 | COMMENT:Only available at 2pm | ||
| 308 | LOCATION: | ||
| 309 | SEQUENCE:0 | ||
| 310 | STATUS:CONFIRMED | ||
| 311 | SUMMARY:Casual coffee talk | ||
| 312 | TRANSP:OPAQUE | ||
| 313 | END:VEVENT") | ||
| 314 | (icalendar-identities '("participant@anoncompany.com"))) | ||
| 315 | (unwind-protect | ||
| 316 | (progn | ||
| 317 | (let* ((reply (with-temp-buffer | ||
| 318 | (insert event) | ||
| 319 | (gnus-icalendar-event-reply-from-buffer | ||
| 320 | (current-buffer) | ||
| 321 | 'declined | ||
| 322 | icalendar-identities | ||
| 323 | nil)))) | ||
| 324 | (should (string-match "^ATTENDEE;.*?\\(PARTSTAT=[^;]+\\)" reply)) | ||
| 325 | (should (string-equal (match-string 1 reply) "PARTSTAT=DECLINED")) | ||
| 326 | (should (string-match "^COMMENT:\\(.*\\)$" reply)) | ||
| 327 | (should (string-equal (match-string 1 reply) "Only available at 2pm")) | ||
| 328 | ))))) | ||
| 329 | |||
| 258 | (provide 'gnus-icalendar-tests) | 330 | (provide 'gnus-icalendar-tests) |
| 259 | ;;; gnus-icalendar-tests.el ends here | 331 | ;;; gnus-icalendar-tests.el ends here |