Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Guests registering to a public poll with an email address never receive their personal link (inverted preventInvitation in registerGuest

Closed Beginner friendly
#5,049 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
php
Domain
backend

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

needs approval
⚠️ 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?
  1. As a poll owner, create a poll and add a public share (email field optional or mandatory).
  2. Open the public link in a private browser window (not logged in).
  3. Enter a name and a valid email address and click "OK".
  4. No invitation / personal link email arrives. The new external share in oc_polls_share has email_address filled and invitation_sent set to the current timestamp, and nextcloud.log (loglevel 0) shows no Email transport ... starting / Sent mail to entries for the /register request.
  5. Repeat without an email address: nextcloud.log gets a warning Invalid 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud/polls

All issues in nextcloud/polls

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.