Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't create activities for email and password change before login #5508

Merged
merged 1 commit into from
Jun 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions settings/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public function __construct(IActivityManager $activityManager,
public function onChangePassword($uid) {
$user = $this->userManager->get($uid);

if (!$user instanceof IUser || $user->getEMailAddress() === null) {
if (!$user instanceof IUser || $user->getLastLogin() === 0) {
Copy link
Member

Choose a reason for hiding this comment

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

I would still keep the email address is null, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, just because the user doesnt have an email, doesnt mean we should not create an activity...
This was basically an accident, because st first there were only emails and i forgot to remove it when adding activities

// User didn't login, so don't create activities and emails.
return;
}

Expand Down Expand Up @@ -141,8 +142,10 @@ public function onChangePassword($uid) {
*/
public function onChangeEmail(IUser $user, $oldMailAddress) {

if ($oldMailAddress === $user->getEMailAddress()) {
// Email didn't really change, so don't create activities and emails
if ($oldMailAddress === $user->getEMailAddress() ||
$user->getLastLogin() === 0) {
// Email didn't really change or user didn't login,
// so don't create activities and emails.
return;
}

Expand Down