Bug 32316 - Send invitations to share a list immediately
Summary: Send invitations to share a list immediately
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Katrin Fischer
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-22 08:42 UTC by Katrin Fischer
Modified: 2023-03-24 10:07 UTC (History)
2 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 32316: Send list share invites and accepts immediately (2.62 KB, patch)
2023-02-10 21:38 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32316: Send list share invites and accepts immediately (1.54 KB, patch)
2023-02-20 07:11 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32316: Send list share invites and accepts immediately (2.06 KB, patch)
2023-02-20 19:51 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32316: Send list share invites and accepts immediately (2.11 KB, patch)
2023-03-11 19:23 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2022-11-22 08:42:52 UTC
Invitations to share a list (SHARE_INVITE) are sent via the message_queue, so there can be a noticeable delay. It would be nice if we could use the same trick here as for password reset and self registration verification mails, that are sent through message_queue, but processed/sent immediately.
Comment 1 Katrin Fischer 2023-02-10 21:38:27 UTC
Created attachment 146520 [details] [review]
Bug 32316: Send list share invites and accepts immediately

For emails triggered manually it's save and helpful
to send them immediately. This patch takes care of
SHARE_INVITE and SHARE_ACCEPT.

To test:
* Enable OpacAllowSharingPrivateLists
* Configure SMTP servers
* Set KohaAdminEmailAddress and an email address in your user
* Create a private list in the OPAC
* Share the list with your email
* Verify that you receive the email immediately
  (in the message_queue the status will be sent)
* Create a second user to log into the OPAC with
* Log out of the OPAC
* Click on the link in the invite email or copy/paste it
  to the browser
* Log in as your second user so the list is shared
* Verify that the list acceptance email was sent immediately as well
Comment 2 David Nind 2023-02-19 23:40:24 UTC
Can't apply the patch:

git bz apply 32316

Bug 32316 - Send invitations to share a list immediately

146520 - Bug 32316: Send list share invites and accepts immediately

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 32316: Send list share invites and accepts immediately
error: mode change for installer/data/mysql/atomicupdate/bug_30642-add_renewal_type.pl, which is not in current HEAD
error: could not build fake ancestor
Patch failed at 0001 Bug 32316: Send list share invites and accepts immediately
Comment 3 Katrin Fischer 2023-02-20 07:08:15 UTC
Thanks David, not sure how that wrong file got in there, but I'll fix.
Comment 4 Katrin Fischer 2023-02-20 07:11:22 UTC
Created attachment 146942 [details] [review]
Bug 32316: Send list share invites and accepts immediately

For emails triggered manually it's save and helpful
to send them immediately. This patch takes care of
SHARE_INVITE and SHARE_ACCEPT.

To test:
* Enable OpacAllowSharingPrivateLists
* Configure SMTP servers
* Set KohaAdminEmailAddress and an email address in your user
* Create a private list in the OPAC
* Share the list with your email
* Verify that you receive the email immediately
  (in the message_queue the status will be sent)
* Create a second user to log into the OPAC with
* Log out of the OPAC
* Click on the link in the invite email or copy/paste it
  to the browser
* Log in as your second user so the list is shared
Comment 5 David Nind 2023-02-20 19:26:26 UTC
Hi Katrin.

Thanks for updating the patch! 

I didn't have much luck getting this to work after applying the patch:
1. The messages are generated, but show as pending in the database and aren't sent immediately.
2. They are sent if I process the message queue.
3. I think I set up everything correctly (SMPT configured [1], system preferences set, I also did koha-email-enable kohadev (not sure that was necessary)).

David

[1] Email setup:

To test sending emails using a Google account, edit your /etc/koha/sites/kohadev/koha-conf.xml file and add this configuration near the end (where <user_name> = your Google email address; <password> = your APP password, not your Google account password):

 <smtp_server>
    <host>smtp.gmail.com</host>
    <port>587</port>
    <timeout>5</timeout>
    <ssl_mode>STARTTLS</ssl_mode>
    <user_name>GOOGLEACCOUNTUSER</user_name>
    <password>GOOGLEAPPPASSWORD</password>
    <debug>1</debug>
 </smtp_server>
Comment 6 Katrin Fischer 2023-02-20 19:48:45 UTC
Hmm, something is still not quite right, it looks like some lines got lost. I'll review, thanks for testing!
Comment 7 Katrin Fischer 2023-02-20 19:51:55 UTC
Created attachment 146971 [details] [review]
Bug 32316: Send list share invites and accepts immediately

For emails triggered manually it's save and helpful
to send them immediately. This patch takes care of
SHARE_INVITE and SHARE_ACCEPT.

To test:
* Enable OpacAllowSharingPrivateLists
* Configure SMTP servers
* Set KohaAdminEmailAddress and an email address in your user
* Create a private list in the OPAC
* Share the list with your email
* Verify that you receive the email immediately
  (in the message_queue the status will be sent)
* Create a second user to log into the OPAC with
* Log out of the OPAC
* Click on the link in the invite email or copy/paste it
  to the browser
* Log in as your second user so the list is shared
Comment 8 Katrin Fischer 2023-02-20 19:55:25 UTC
The SHARE_INVITE could definitely not work, but the SHARE_ACCEPT should have. The messages in the message should show with 'sent' - not pending.
If you try again, could you make sure to restart all the things?

I didn't do the enable step when I tested, so I think that is not required in this case. If the mails arrive when processing the message_queue I would also say that your mail setup should be ok.
Comment 9 David Nind 2023-02-20 20:33:21 UTC
(In reply to Katrin Fischer from comment #8)
> The SHARE_INVITE could definitely not work, but the SHARE_ACCEPT should
> have. The messages in the message should show with 'sent' - not pending.
> If you try again, could you make sure to restart all the things?
> 
> I didn't do the enable step when I tested, so I think that is not required
> in this case. If the mails arrive when processing the message_queue I would
> also say that your mail setup should be ok.

Thanks Katrin.

The SHARE_INVITE message is now sent immediately, so that is working!

However, for the SHARE_ACCEPT I am not seeing that in the message queue or receiving it:
- The link in the SHARE_INVITE message is http://kohadev.myDNSname.org:8080/cgi-bin/koha/opac-shareshelf.pl?shelfnumber=1&op=accept&key=58102407571739090704
- I haven't configured my desk top so that http://kohadev.myDNSname.org works, I changed that to http://127.0.0.1.... 

David
Comment 10 Katrin Fischer 2023-02-20 20:37:33 UTC
Hi David, 

maybe this helps:

The SHARE_ACCEPT will only be sent after you click on the link (accepting the invite) and will be sent to the inviting patron. 

* Did you make sure the inviting patron had an email set up in their account?
* Did you log out of Koha before clicking the link?
* Did you log in (accepting) with a different user (not the inviter)?

If the accepting user has the email address the invite was sent to is not important.
Comment 11 David Nind 2023-03-11 19:23:12 UTC
(In reply to Katrin Fischer from comment #10)
> Hi David, 
> 
> maybe this helps:
> 
> The SHARE_ACCEPT will only be sent after you click on the link (accepting
> the invite) and will be sent to the inviting patron. 
> 
> * Did you make sure the inviting patron had an email set up in their account?
> * Did you log out of Koha before clicking the link?
> * Did you log in (accepting) with a different user (not the inviter)?
> 
> If the accepting user has the email address the invite was sent to is not
> important.

Hi Katrin.

I've retested again, and everything is now working (not sure what I did previously now).

Apologies for taking so long to retest.

David
Comment 12 David Nind 2023-03-11 19:23:55 UTC
Created attachment 148104 [details] [review]
Bug 32316: Send list share invites and accepts immediately

For emails triggered manually it's save and helpful
to send them immediately. This patch takes care of
SHARE_INVITE and SHARE_ACCEPT.

To test:
* Enable OpacAllowSharingPrivateLists
* Configure SMTP servers
* Set KohaAdminEmailAddress and an email address in your user
* Create a private list in the OPAC
* Share the list with your email
* Verify that you receive the email immediately
  (in the message_queue the status will be sent)
* Create a second user to log into the OPAC with
* Log out of the OPAC
* Click on the link in the invite email or copy/paste it
  to the browser
* Log in as your second user so the list is shared

Signed-off-by: David Nind <david@davidnind.com>
Comment 13 Katrin Fischer 2023-03-11 23:01:41 UTC
No apologies please! Thanks for testing!
Comment 14 Jonathan Druart 2023-03-24 09:23:53 UTC
Without an SMTP server running: "An invitation to share list list name will be sent shortly to xxx@example.org."

This is not true, it has not been sent. I think we should deal with errors here, like we do in other places.
Comment 15 Katrin Fischer 2023-03-24 09:53:47 UTC
(In reply to Jonathan Druart from comment #14)
> Without an SMTP server running: "An invitation to share list list name will
> be sent shortly to xxx@example.org."
> 
> This is not true, it has not been sent. I think we should deal with errors
> here, like we do in other places.

I believe this is out of scope here. This only changes the when, nothing about how the mail is sent.
Comment 16 Katrin Fischer 2023-03-24 10:07:56 UTC
Talked to Jonathan, will check out the send list feature for error handling along the lines of "There was an error sending the list."