If you edit an issue directly, not via a followup comment, the next real comment gets "blamed" for all corresponding metadata changes. See http://drupal.org/node/176015#comment-701681 for an example. I'm not sure what, if anything, we could do about this. Definitely minor, but I wanted to submit it in case hunmonk or others had bright ideas at some point in the future. ;)

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

keith.smith’s picture

Heh. This happened to me recently at http://drupal.org/node/212375#comment-699188. I was *very* confused for a bit.

webchick’s picture

Shhh!! Don't get me in trouble with dww! Sheesh! ;)

Hm. Apart from suppressing the message unless the diff happened on /comment/ form submission (check form ID of referring form?), I don't really know.

Or, can't it diff to the current state of the node, rather than the last state of a comment?

I should probably stfu and read the code, but I'm juggling things atm.

hunmonk’s picture

i'd actually prefer to prevent editing of the metadata on issue node edit altogether, either via validation or hiding the form fields

leop’s picture

Still, if it is the last comment being edited, it doesn't pose a problem. It would be great if a user can edit his own comment or issue, including metadata, as long as no follow-up is posted.

hunmonk’s picture

@leo_pape: this was rejected because it made the metadata diffing code more complicated and error prone. think of the metadata changes like a CVS commit -- you don't go hacking a CVS commit when you made a mistake, you make another commit to fix it. this 'only-forward' approach is also the best for the metadata, especially since, just like CVS, you can never be guaranteed that your 'last' comment is still the last comment, because others can comment to the issue.

this really needs to be fixed as i suggested above, so that initial issue metadata behaves like the current comment metadata upon edit.

aclight’s picture

Status: Active » Needs review
FileSize
10.02 KB

Let's try this on for size.

aclight’s picture

Even better, with phpdoc

aclight’s picture

With project_issue_update() removed.

hunmonk’s picture

Status: Needs review » Active

committed to 5.x-2.x. setting back to active until this is deployed on d.o et. all

aclight’s picture

Priority: Minor » Critical

Marking to critical due to a bug when a user who is not uid=1 attempts to edit the issue and is not allowed to.

This happens in the project_issue_issue_nodeapi() function in the following code:

      // Check if user has access, or if status is default status and therefore available to all,
      // or if user is original issue poster and poster is granted access.
      // If none of these is true, set error.
      if (!(user_access('set issue status '. str_replace("'", "", $state->name)) || ($node->sid == variable_get('project_issue_default_state', 1)) || ($state->author_has && ($user->uid == $node->uid)))) {
        form_set_error('sid', t('Invalid issue status %status: you do not have permission to set this status', array('%status' => $state)));
      }
      break;
aclight’s picture

Component: User interface » Issues
Assigned: Unassigned » aclight
Status: Active » Needs review
FileSize
3.72 KB

This patch is even simpler than it looks. The first hunk is really just rewriting some conditional statements to not be so obtuse. The second hunk is just indenting the code into an if clause. I tested this as uid=1 and a site admin that can edit nodes and it works properly in both cases.

hunmonk’s picture

Status: Needs review » Postponed (maintainer needs more info)

from the code comment for the status validation:

or if user is original issue poster and poster is granted access

do we need that check given that metadata fields are only displayed on new issue nodes?

hunmonk’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
1.37 KB

we don't even need this validate case. it's cruft from pre-fapi days. the project_issue_status() function already limits the status dropdown to the statuses that the user can set, and fapi handles validation from there.

dww’s picture

no. in addition to those perms, each status has a setting to toggle if the original issue poster can always set that status, regardless of other perms.

dww’s picture

sorry, cross post -- that 'no' was relative to #12, not #13. but i haven't looked closely at the patches, so i'm not sure where we stand, i'm just talking about how project_issue "works" regarding all these permissions.

aclight’s picture

Status: Needs review » Reviewed & tested by the community

Code looks fine, and functionality works with admin and regular users and verified that the "author may set" stuff still works as it should as well.

aclight’s picture

Status: Reviewed & tested by the community » Fixed

Commited in #104539 and deployed on drupal.org and project.drupal.org.

aclight’s picture

Actually, it was http://drupal.org/cvs?commit=104696 where this was finally fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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