Skip to content

feat: add repair step to ensure guests haven't changed their email - #1370

Merged
skjnldsv merged 1 commit into
mainfrom
guest-reset-email-repair
Aug 11, 2025
Merged

feat: add repair step to ensure guests haven't changed their email#1370
skjnldsv merged 1 commit into
mainfrom
guest-reset-email-repair

Conversation

@icewind1991

Copy link
Copy Markdown
Member

Related to #1369

@icewind1991 icewind1991 added this to the Nextcloud 32 milestone Aug 6, 2025
@icewind1991
icewind1991 requested a review from skjnldsv as a code owner August 6, 2025 15:11
@icewind1991 icewind1991 added the 3. to review Waiting for reviews label Aug 6, 2025
Signed-off-by: Robin Appelman <robin@icewind.nl>
@icewind1991
icewind1991 force-pushed the guest-reset-email-repair branch from 0a99fe1 to 46f5c9d Compare August 11, 2025 08:27
@skjnldsv
skjnldsv merged commit a6a9a5b into main Aug 11, 2025
45 checks passed
@skjnldsv
skjnldsv deleted the guest-reset-email-repair branch August 11, 2025 08:37
@skjnldsv skjnldsv mentioned this pull request Aug 12, 2025
public function run(IOutput $output) {
foreach ($this->guestManager->listGuests() as $guestId) {
$guest = $this->userManager->get($guestId);
if (strtolower($guest->getSystemEMailAddress()) !== strtolower($guestId)) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@icewind1991 psalm should have warned us about the potential null, no?
Is psalm even properly working?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have it if I show infos

INFO: PossiblyNullArgument - lib/Repair/ResetEmails.php:35:19 - Argument 1 of strtolower cannot be null, possibly null value provided (see https://psalm.dev/078)
			if (strtolower($guest?->getSystemEMailAddress()) !== strtolower($guestId)) {


INFO: PossiblyNullArgument - lib/Repair/ResetEmails.php:36:66 - Argument 4 of OCP\IConfig::setUserValue cannot be null, possibly null value provided (see https://psalm.dev/078)
				$this->config->setUserValue($guestId, 'guests', 'old_email', $guest->getSystemEMailAddress());


INFO: PossiblyNullReference - lib/Repair/ResetEmails.php:36:74 - Cannot call method getSystemEMailAddress on possibly null value (see https://psalm.dev/083)
				$this->config->setUserValue($guestId, 'guests', 'old_email', $guest->getSystemEMailAddress());

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

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants