Skip to content
Snippets Groups Projects
Commit 08563b46 authored by Angie Byron's avatar Angie Byron
Browse files

#586664 by bleen18: Fixed Users should not be able to contact blocked users (with tests).

parent 2d4b5d08
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -142,6 +142,11 @@ function _contact_personal_tab_access(stdClass $account) {
return FALSE;
}
// If requested user has been blocked, do not allow users to contact them.
if (empty($account->status)) {
return FALSE;
}
return user_access('access user contact forms');
}
......
......@@ -352,6 +352,19 @@ class ContactPersonalTestCase extends DrupalWebTestCase {
$this->drupalLogin($this->admin_user);
$this->drupalGet('user/' . $this->contact_user->uid . '/contact');
$this->assertResponse(200);
// Re-create our contacted user as a blocked user.
$this->contact_user = $this->drupalCreateUser();
user_save($this->contact_user, array('status' => 0));
// Test that blocked users can still be contacted by admin.
$this->drupalGet('user/' . $this->contact_user->uid . '/contact');
$this->assertResponse(200);
// Test that blocked users cannot be contacted by non-admins.
$this->drupalLogin($this->web_user);
$this->drupalGet('user/' . $this->contact_user->uid . '/contact');
$this->assertResponse(403);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment