This has started happening about a week ago on d.o. Example issue queue: http://drupal.org/project/issues/hierarchical_select.

CommentFileSizeAuthor
#4 auto_close.patch4.08 KBhunmonk
#1 auto_close.patch3.78 KBhunmonk

Comments

hunmonk’s picture

Assigned: Unassigned » hunmonk
Status: Active » Needs review
StatusFileSize
new3.78 KB

whoop. i don't know how i missed it, but i forget to re-implement this for IFAC :/

unfortunately, we again run into limitations of comment module. drupal.org (and a lot of other sites) don't allow anon users to post comments w/o approval, and this cron based job runs as anon :(

it looked messy and potentially dangerous to be running cron as another user, so i've instead elected to roll custom code for inserting the comments. i don't like to do it, but i think that's our best bet for now. i stole as little code as possible from comment_save() to make this work.

attached has been tested, and seems to work perfectly.

we should probably get this reviewed and committed ASAP, so we don't have a pileup on d.o.

dww’s picture

Status: Needs review » Needs work

That's a very good start. I'll resist the urge to feature creep this, since there are a lot of problems with the current functionality that I'd like to address, but I agree, the first step is to get it working the same as it used to before IFAC. So, a few minor complaints with this patch:

A) "cron" isn't very friendly for user-facing text. How about "Automatically closed after being fixed for 2 weeks." or something?

B) I know I just said I don't want to feature creep it, but maybe a theme function for the exact text being used? I'd hate to tell people to localize their site just to translate this if they wanted to alter it without hacking the code. Definitely not a show-stopper, but if we're going to change the line anyway...

C) I don't understand the code block for // Build vancode. I thought we always made project_issue comments unthreaded? Why do we care for this one?

D) Any reason to "unroll" this loop like you have it:

+    $comment['nid'] = $issue->nid;
+    $comment['category'] = $issue->category;
+    $comment['priority'] = $issue->priority;
+    $comment['assigned'] = $issue->assigned;
+    $comment['title'] = $issue->title;

instead of leaving it more like it used to be:

  foreach (array('nid', 'category', 'priority', 'assigned', 'title') as $var) {
    $comment[$var] = $issue->$var;
  }

??

Otherwise, looks good to me. I haven't tested it, but it seems like it should work. ;)

Thanks!

hunmonk’s picture

A) sure we can change it, but not to what you suggested :P
B) easy enough
C) it's the same as comment_save() uses, and we'll be using comment_save() again in D7, so it's consistent
D) some of the vars are another layer deep b/c of namespace issues. there aren't that many vars, and i find the way it's done a bit more readable overall.

so we need a better default val for A)...

hunmonk’s picture

Status: Needs work » Needs review
StatusFileSize
new4.08 KB

attached corrects A) and B) -- C) and D) are fine as is.

dww’s picture

Status: Needs review » Reviewed & tested by the community

Sorry I didn't mention this before (since I scared myself away from feature creeping), but this line:
$comment['sid'] = 7;

could use something like this:

// TODO: It's evil to hard-code the status here.

Otherwise, this is RTBC.

Thanks!
-Derek

hunmonk’s picture

Status: Reviewed & tested by the community » Fixed

added the above comment, committed to HEAD, installed on drupal.org

wim leers’s picture

Yay, it works again! :) Thanks guys!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.