@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix user indexing for "open" search results when email verification required

Summary:
Enforce reindexing of a user account once they verified their email address when `auth.require-email-verification` is set to true. The reindexing set `PhabricatorUser->isUserActivated()` to true (in case no account approval by admins is required), so `PhabricatorSearchRelationship::RELATIONSHIP_OPEN` is returned, and the `PhabricatorFulltextEngine` will reindex the account as "Open", so the account shows up in the results of http://phorge.localhost/search/ when entering the account name in the "Query" field and setting the "Item Status" to "Open", as expected.

Thanks to valerio.bozzolan for the additional code investigation.

Refs T16136

Test Plan:
1. Make sure all your daemons and torment is running via `./bin/phd start`
2. As an admin, set http://phorge.localhost/config/edit/auth.require-email-verification/ to `true`.
3. As an admin, set http://phorge.localhost/config/edit/auth.require-approval/ to `false` (Yes, that's needed).
4. Insert the line `phlog('Verify link for ' . $address . ': ' . $link);` at https://we.phorge.it/source/phorge/browse/master/src/applications/people/storage/PhabricatorUserEmail.php;aa2b70708e2fa962cc6552759be2e726a8591501$212 so we don't have to set up a mail server.
5. As anonymous, go to http://phorge.localhost/auth/register/, set Username `meouw`, fill in the rest, click `Register Account` button.
6. In SQL, run `SELECT f.isClosed, u.userName, u.isDisabled, u.isEmailVerified, u.isApproved FROM phabricator_user.user u INNER JOIN phabricator_user.user_user_fdocument f ON u.phid = f.objectPHID WHERE u.userName = "meouw";`. See that the account is marked as `isClosed` in the first column.
7. As anonymous, get dialog `Check Your Email: You must verify your email address to log in. You should have a new email message with verification instructions in your inbox`
8. If you performed step 3 above, check your server logs and copy the confirmation URI. Alternatively, set up a mail server.
9. As anonymous, open that confirmation URI and verify your new user account.
10. In SQL, run `SELECT f.isClosed, u.userName, u.isDisabled, u.isEmailVerified, u.isApproved FROM phabricator_user.user u INNER JOIN phabricator_user.user_user_fdocument f ON u.phid = f.objectPHID WHERE u.userName = "meouw";`. Before this patch, the account is still marked as `isClosed` in the first column though we verified the email address. After this patch, the account is not marked as `isClosed` anymore.
11. Go to http://phorge.localhost/search/, set `Query` to `meouw`, set `Document Status` to `Open`, set `Document Types` to `User`, click the `Search` button. See a result after applying this patch.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16136

Differential Revision: https://we.phorge.it/D26553

+4
+4
src/applications/people/editor/PhabricatorUserEditor.php
··· 385 385 if ($user_primary->getID() == $email->getID()) { 386 386 $user->setIsEmailVerified(1); 387 387 $user->save(); 388 + // Update the account status also in the fulltext search index. 389 + PhabricatorSearchWorker::queueDocumentForIndexing( 390 + $user->getPHID(), 391 + array('force' => true)); 388 392 } 389 393 } 390 394