Guests registering to a public poll with an email address never receive their personal link (inverted preventInvitation in registerGuest
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
Research direction
Open lib/Service/ShareService.php and inspect ShareService::registerGuest() around the createNewShare() call and invitation_sent check. Reproduce the registration steps with and without an email address. Done means registrations with an email send the personal-link invitation, while registrations without one do not attempt delivery or log an invalid-address warning.
Written by the indexing model from the issue text.
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I've searched it).
- I agree to follow Nextcloud's Code of Conduct.
What went wrong, what did you observe?
First of all: I let AI help me find and create this issue as I personally don't have enough experience in that field.
I'm the poll owner. When a guest registers to a public poll and enters an email address, the dialog says "You will receive your personal link after clicking 'OK'", but no email is ever sent. If the guest loses the "remember me" cookie (other device, cleared browser), they can't get back into their share.
Guests who register without an email address go the other way: Polls tries to send an invitation and logs Invalid or no email address for invitation.
The cause looks like an inverted boolean in ShareService::registerGuest() (lib/Service/ShareService.php, v9.3.0 lines 631–641, still the same on main):
$this->createNewShare(
$this->share->getPollIdOrFail(),
$user,
$user->getEmailAddress() !== '', // 3rd param is $preventInvitation
);
...
if (!$this->share->getInvitationSent()) {
$this->mailService->sendInvitation($this->share);
}
The third parameter of createNewShare() is $preventInvitation. When it's true, invitation_sent is set to time(), so the check that follows skips the mail. The result:
- email given →
preventInvitation = true→ invitation marked as sent → no mail - no email →
preventInvitation = false→ mail is attempted → fails with "Invalid or no email address"
In v8.3.0 the equivalent code was correct:
// prevent invtation sending, when no email address is given
$this->createNewShare(
$this->share->getPollId(),
$this->userMapper->getUserObject(...),
!$emailAddress,
$timeZone
);
The condition was flipped in the 9.0.0 refactor, and every release from v9.0.0 through v9.3.0 has the bug.
The database shows the same thing. Registered external shares that have an email address have invitation_sent set to the registration timestamp, but the log contains no mail transport activity at all for those requests. SMTP itself works: the admin test mail and other Nextcloud mails are delivered normally.
What did you expect, how polls should behave instead?
A guest who registers with an email address should get the invitation mail with their personal link right away, as the registration dialog says. A guest without an email address shouldn't trigger a send attempt or a warning.
Suggested fix (one line):
$this->createNewShare(
$this->share->getPollIdOrFail(),
$user,
- $user->getEmailAddress() !== '',
+ $user->getEmailAddress() === '',
);
What steps does it need to replay this bug?
- As a poll owner, create a poll and add a public share (email field optional or mandatory).
- Open the public link in a private browser window (not logged in).
- Enter a name and a valid email address and click "OK".
- No invitation / personal link email arrives. The new
externalshare inoc_polls_sharehasemail_addressfilled andinvitation_sentset to the current timestamp, andnextcloud.log(loglevel 0) shows noEmail transport ... starting/Sent mail toentries for the/registerrequest. - Repeat without an email address:
nextcloud.loggets a warningInvalid or no email address for invitation.
Workaround: the poll owner can use "Resend invitation" on the share in the sharing sidebar (the /s/{token}/resend endpoint doesn't check invitation_sent), or copy the personal link and send it manually.
Affected polls version
9.3.0 (also verified in source: v9.0.0, v9.2.0, main)
Installation method
Installed/updated from the appstore (Apps section of your site)
Installation type
First time installation
Can you rule out that any extension you use is involved in the issue?
- I have checked all browser extension
Which browser did you use, when experiencing the bug?
- Firefox
- Chrome
- Chromium/Chromium based (i.e. Edge)
- Safari
- Other/Don't know
Other browser
No response
Add your browser log here
(none – request succeeds with HTTP 201)
Additional client environment information
No response
NC version
Other/Don't know
Other Nextcloud version
34.0.4 (Nextcloud AIO)
PHP engine version
PHP 8.4
Other PHP version
No response
Database engine
PostgreSQL
Database Engine version or other Database
PostgreSQL 18.6
Which user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other/Don't know
Add your nextcloud server log here
{"level":2,"app":"polls","method":"POST","url":"/apps/polls/s/<token>/register","message":"Invalid or no email address for invitation","version":"34.0.4.1","data":{"app":"polls","recipient":"{... \"emailAddress\":\"\", \"isGuest\":true, \"type\":\"guest\" ...}"}}
(For registrations WITH an email address there is no log entry at all, which is the bug.)
Additional environment informations
Additional environment info: Nextcloud AIO (Docker). SMTP is configured and working (admin test mail and other notification mails are delivered).
Signing status: No errors
Configuration report
List of activated Apps
Nextcloud Signing status
Additional Information
No response
- Dominant language
- JavaScript
- Stars
- 285
- Forks
- 91
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 46
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nextcloud/polls
-
new
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
nextcloud/polls#4874 · 1 comment ·
Maintainers usually reply within 2 days
-
needs approval
Difficulty 4/5 3-5 days Newbie friendliness 22/100
nextcloud/polls#5091 · 3 comments ·
Maintainers usually reply within 2 days
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
nextcloud/polls#4978 · 4 comments · 1 reaction ·
Maintainers usually reply within 2 days
-
new
Difficulty 3/5 1-2 days Newbie friendliness 52/100
nextcloud/polls#4875 · 2 comments ·
Maintainers usually reply within 2 days
-
UX
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Maintainers usually reply within 2 days
Similar issues
-
Pills' meter dots fade on bright and deep pillsPossibly taken @wassim-azi claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
wassim-azi/agy-powerline#168 ·
Maintainers usually reply within 1 day
-
accounts bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
area:docs effort:S impact:S kind:docs source:critic stage:ready
Difficulty 1/5 1-3 hours Newbie friendliness 91/100
Jason-Vaughan/TangleClaw#2693 ·
Maintainers usually reply within 1 day
-
infrastructure P2 security
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Energy flow: add an "Other" row so the consumers add up to the consumption totalPossibly taken @github-actions claimed this today. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
evcc-io/evcc#35512 · 1 comment ·
Maintainers usually reply within 1 day