Commit 5d760089 authored by webchick's avatar webchick

#438224 by dww, sun, netsensei, vordude, et al: 'Post comments without...

#438224 by dww, sun, netsensei, vordude, et al: 'Post comments without approval' permission name is completely misleading.
parent e4c0766c
......@@ -82,8 +82,8 @@ function comment_help($path, $arg) {
$output .= '<dl>';
$output .= '<dt>' . t('Default and custom settings') . '</dt>';
$output .= '<dd>' . t("Each <a href='@content-type'>content type</a> can have its own default comment settings configured as: <em>Open</em> to allow new comments, <em>Hidden</em> to hide existing comments and prevent new comments, or <em>Closed</em> to view existing comments, but prevent new comments. These defaults will apply to all new content created (changes to the settings on existing content must be done manually). Other comment settings can also be customized per content type, and can be overridden for any given item of content. When a comment has no replies, it remains editable by its author, as long as the author has a user account and is logged in.", array('@content-type' => url('admin/structure/types'))) . '</dd>';
$output .= '<dt>' . t('Comment moderation') . '</dt>';
$output .= '<dd>' . t("Comments from users who do not have the <em>Post comments without approval</em> permission are placed in the <a href='@comment-approval'>Unapproved comments</a> queue, until a user who has permission to <em>Administer comments</em> moderates them as either published or deleted. Published comments can be bulk managed on the <a href='@admin-comment'>Published comments</a> administration page.", array('@comment-approval' => url('admin/content/comment/approval'), '@admin-comment' => url('admin/content/comment'))) . '</dd>';
$output .= '<dt>' . t('Comment approval') . '</dt>';
$output .= '<dd>' . t("Comments from users who have the <em>Skip comment approval</em> permission are published immediately. All other comments are placed in the <a href='@comment-approval'>Unapproved comments</a> queue, until a user who has permission to <em>Administer comments</em> publishes or deletes them. Published comments can be bulk managed on the <a href='@admin-comment'>Published comments</a> administration page.", array('@comment-approval' => url('admin/content/comment/approval'), '@admin-comment' => url('admin/content/comment'))) . '</dd>';
$output .= '</dl>';
return $output;
}
......@@ -386,10 +386,10 @@ function comment_permission() {
'title' => t('View comments'),
),
'post comments' => array(
'title' => t('Post comments with approval'),
'title' => t('Post comments'),
),
'post comments without approval' => array(
'title' => t('Post comments without approval'),
'skip comment approval' => array(
'title' => t('Skip comment approval'),
),
'edit own comments' => array(
'title' => t('Edit own comments'),
......@@ -1421,7 +1421,7 @@ function comment_save($comment) {
'mail' => '',
'homepage' => '',
'name' => '',
'status' => user_access('post comments without approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED,
'status' => user_access('skip comment approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED,
);
foreach ($defaults as $key => $default) {
if (!isset($comment->$key)) {
......@@ -1867,7 +1867,7 @@ function comment_form($form, &$form_state, $comment) {
else {
$author = ($comment->name ? $comment->name : variable_get('anonymous', t('Anonymous')));
}
$status = (user_access('post comments without approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED);
$status = (user_access('skip comment approval') ? COMMENT_PUBLISHED : COMMENT_NOT_PUBLISHED);
$date = '';
}
......@@ -2282,7 +2282,7 @@ function theme_comment_post_forbidden($variables) {
if (!isset($authenticated_post_comments)) {
// We only output a link if we are certain that users will get permission
// to post comments by logging in.
$authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'post comments without approval'));
$authenticated_post_comments = array_key_exists(DRUPAL_AUTHENTICATED_RID, user_roles(TRUE, 'post comments') + user_roles(TRUE, 'skip comment approval'));
}
if ($authenticated_post_comments) {
......
......@@ -440,7 +440,7 @@ class CommentPreviewTest extends CommentHelperCase {
*/
function testCommentEditPreview() {
$langcode = LANGUAGE_NONE;
$web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'post comments without approval'));
$web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'skip comment approval'));
$this->drupalLogin($this->admin_user);
$this->setCommentPreview(DRUPAL_OPTIONAL);
$this->setCommentForm(TRUE);
......@@ -495,7 +495,7 @@ class CommentAnonymous extends CommentHelperCase {
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
'post comments' => TRUE,
'post comments without approval' => TRUE,
'skip comment approval' => TRUE,
));
$this->setCommentAnonymous('0'); // Ensure that doesn't require contact info.
$this->drupalLogout();
......@@ -579,7 +579,7 @@ class CommentAnonymous extends CommentHelperCase {
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => FALSE,
'post comments' => FALSE,
'post comments without approval' => FALSE,
'skip comment approval' => FALSE,
));
// Attempt to view comments while disallowed.
......@@ -598,7 +598,7 @@ class CommentAnonymous extends CommentHelperCase {
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
'post comments' => FALSE,
'post comments without approval' => FALSE,
'skip comment approval' => FALSE,
));
$this->drupalGet('node/' . $this->node->nid);
$this->assertPattern('/<div ([^>]*?)id="comments"([^>]*?)>/', t('Comments were displayed.'));
......@@ -890,7 +890,7 @@ class CommentApprovalTest extends CommentHelperCase {
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
'post comments' => TRUE,
'post comments without approval' => FALSE,
'skip comment approval' => FALSE,
));
$this->drupalLogin($this->admin_user);
$this->setCommentAnonymous('0'); // Ensure that doesn't require contact info.
......@@ -959,7 +959,7 @@ class CommentApprovalTest extends CommentHelperCase {
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
'post comments' => TRUE,
'post comments without approval' => FALSE,
'skip comment approval' => FALSE,
));
$this->drupalLogin($this->admin_user);
$this->setCommentAnonymous('0'); // Ensure that doesn't require contact info.
......
......@@ -411,7 +411,7 @@ class RdfCommentAttributesTestCase extends CommentHelperCase {
user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
'access comments' => TRUE,
'post comments' => TRUE,
'post comments without approval' => TRUE,
'skip comment approval' => TRUE,
));
// Allows anonymous to leave their contact information.
$this->setCommentAnonymous(COMMENT_ANONYMOUS_MAY_CONTACT);
......@@ -569,7 +569,7 @@ class RdfTrackerAttributesTestCase extends DrupalWebTestCase {
'create article content' => TRUE,
'access comments' => TRUE,
'post comments' => TRUE,
'post comments without approval' => TRUE,
'skip comment approval' => TRUE,
));
}
......
......@@ -363,7 +363,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
function testRankings() {
// Login with sufficient privileges.
$this->drupalLogin($this->drupalCreateUser(array('post comments without approval', 'create page content')));
$this->drupalLogin($this->drupalCreateUser(array('skip comment approval', 'create page content')));
// Build a list of the rankings to test.
$node_ranks = array('sticky', 'promote', 'relevance', 'recent', 'comments', 'views');
......@@ -518,7 +518,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
*/
function testDoubleRankings() {
// Login with sufficient privileges.
$this->drupalLogin($this->drupalCreateUser(array('post comments without approval', 'create page content')));
$this->drupalLogin($this->drupalCreateUser(array('skip comment approval', 'create page content')));
// See testRankings() above - build a node that will rank high for sticky.
$settings = array(
......@@ -695,7 +695,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
filter_permission_name($full_html_format),
'administer permissions',
'create page content',
'post comments without approval',
'skip comment approval',
'access comments',
);
$this->admin_user = $this->drupalCreateUser($permissions);
......@@ -949,7 +949,7 @@ class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
parent::setUp('search');
// Create searching user.
$this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'post comments without approval'));
$this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'skip comment approval'));
// Create initial nodes.
$node_params = array('type' => 'article', 'body' => array(LANGUAGE_NONE => array(array('value' => 'SearchCommentToggleTestCase'))));
......@@ -1082,7 +1082,7 @@ class SearchKeywordsConditions extends DrupalWebTestCase {
function setUp() {
parent::setUp('search', 'search_extra_type');
// Create searching user.
$this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'post comments without approval'));
$this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'skip comment approval'));
// Login with sufficient privileges.
$this->drupalLogin($this->searching_user);
// Test with all search modules enabled.
......
......@@ -991,7 +991,7 @@ protected function drupalCompareFiles($file1, $file2) {
* A fully loaded user object with pass_raw property, or FALSE if account
* creation fails.
*/
protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post comments', 'post comments without approval')) {
protected function drupalCreateUser($permissions = array('access comments', 'access content', 'post comments', 'skip comment approval')) {
// Create a role with the given permission set.
if (!($rid = $this->drupalCreateRole($permissions))) {
return FALSE;
......
......@@ -17,7 +17,7 @@ class TrackerTest extends DrupalWebTestCase {
function setUp() {
parent::setUp('comment', 'tracker');
$permissions = array('access comments', 'create page content', 'post comments', 'post comments without approval');
$permissions = array('access comments', 'create page content', 'post comments', 'skip comment approval');
$this->user = $this->drupalCreateUser($permissions);
$this->other_user = $this->drupalCreateUser($permissions);
......
......@@ -495,7 +495,7 @@ class TriggerUserActionTestCase extends TriggerActionTestCase {
* Tests user action assignment and execution.
*/
function testUserActionAssignmentExecution() {
$test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'post comments without approval', 'edit own comments'));
$test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'skip comment approval', 'edit own comments'));
$this->drupalLogin($test_user);
$triggers = array('comment_presave', 'comment_insert', 'comment_update');
......@@ -517,7 +517,7 @@ class TriggerUserActionTestCase extends TriggerActionTestCase {
// the comment is updated.
user_save($account, array('status' => TRUE));
$test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'post comments without approval', 'edit own comments'));
$test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'skip comment approval', 'edit own comments'));
$this->drupalLogin($test_user);
// Our original comment will have been comment 1.
......@@ -526,7 +526,7 @@ class TriggerUserActionTestCase extends TriggerActionTestCase {
$this->assertTrue($comment_author_account->status == 0, t('Comment author account (uid=@uid) is blocked after update to comment', array('@uid' => $comment_author_uid)));
// Verify that the comment was updated.
$test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'post comments without approval', 'edit own comments'));
$test_user = $this->drupalCreateUser(array('administer actions', 'create article content', 'access comments', 'administer comments', 'skip comment approval', 'edit own comments'));
$this->drupalLogin($test_user);
$this->drupalGet("node/$node->nid");
......@@ -627,7 +627,7 @@ class TriggerOtherTestCase extends TriggerWebTestCase {
variable_set($action_id, FALSE);
// Create a node and add a comment to it.
$web_user = $this->drupalCreateUser(array('create article content', 'access content', 'post comments without approval', 'post comments'));
$web_user = $this->drupalCreateUser(array('create article content', 'access content', 'skip comment approval', 'post comments'));
$this->drupalLogin($web_user);
$node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
$edit = array();
......
......@@ -823,6 +823,20 @@ function user_update_7013(&$sandbox) {
$sandbox['#finished'] = empty($sandbox['max']) || ($sandbox['progress'] / $sandbox['max']);
}
/**
* Rename the 'post comments without approval' permission.
*
* In Drupal 7, this permission has been renamed to 'skip comment approval'.
*/
function user_update_7014() {
db_update('role_permission')
->fields(array('permission' => 'skip comment approval'))
->condition('permission', 'post comments without approval')
->execute();
return t("Renamed the 'post comments without approval' permission to 'skip comment approval'.");
}
/**
* @} End of "defgroup user-updates-6.x-to-7.x"
* The next series of updates should start at 8000.
......
......@@ -571,7 +571,7 @@ class UserCancelTestCase extends DrupalWebTestCase {
variable_set('user_cancel_method', 'user_cancel_delete');
// Create a user.
$account = $this->drupalCreateUser(array('cancel account', 'post comments', 'post comments without approval'));
$account = $this->drupalCreateUser(array('cancel account', 'post comments', 'skip comment approval'));
$this->drupalLogin($account);
// Load real user object.
$account = user_load($account->uid, TRUE);
......
......@@ -401,7 +401,7 @@ function standard_install() {
// Enable default permissions for system roles.
$filtered_html_permission = filter_permission_name($filtered_html_format);
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content', 'access comments', $filtered_html_permission));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'post comments without approval', $filtered_html_permission));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content', 'access comments', 'post comments', 'skip comment approval', $filtered_html_permission));
// Create a default role for site administrators, with all available permissions assigned.
$admin_role = new stdClass();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment