Is it me ...or the "Comment: duplicate ..." message is written to watchdog even when editing a comment?

I mean, when the comment is edited not to change the text, but to change another value such as publish/unpublish, etc.

CommentFileSizeAuthor
#3 comment_duplicate.patch.txt2.28 KBheine

Comments

markus_petrux’s picture

I guess this message is written to note a user entered a duplicated message. Not sure how much sense there is, but maybe there is little sense when one just changes the status, the user or the date of the message?

What if this message was not written when the user has 'administer comments' permission and it is editing a comment. ie. write the message when creating, but not when editing (even if the text is being changed, let's suppose the admin knows what (s)he is doing...).

markus_petrux’s picture

This is the code snippet, located in comment_save():

      // Check for duplicate comments.  Note that we have to use the
      // validated/filtered data to perform such check.
      $duplicate = db_result(db_query("SELECT COUNT(cid) FROM {comments} WHERE pid = %d AND nid = %d AND subject = '%s' AND comment = '%s'", $edit['pid'], $edit['nid'], $edit['subject'], $edit['comment']), 0);
      if ($duplicate != 0) {
        watchdog('content', t('Comment: duplicate %subject.', array('%subject' => theme('placeholder', $edit['subject']))), WATCHDOG_WARNING);
      }

Does anyone know what "Note that we have to use the validated/filtered data to perform such check." means?

Also, note that comment duplicates are checked only against the same node and comment parent. That makes me think it is to prevent users from posting the same comment twice. If so, what we have here is pretty useless. The message is sent only to watchdog, so...

I'm wondering if it would be better to remove that check?

heine’s picture

StatusFileSize
new2.28 KB

Doesn't change much, except moves the duplicate checking to work for new comments only.

heine’s picture

Status: Active » Needs review

status

drumm’s picture

Version: x.y.z » 5.x-dev
Status: Needs review » Reviewed & tested by the community

Committed to HEAD.

drumm’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)