Skip to content

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

Closed

Description

@PhoenixxClaw

⚠️ 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

Activity

  1. added theissue type on Sep 29, 2026
  2. added this to the 9.3.1 milestone on Sep 30, 2026
  3. dartcafe commented on Sep 30, 2026

    @dartcafe
    Collaborator

    Analysis and patch suggestion was accurate.
    Thanks. Wondering, no one ever noticed that until now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions