I hereby wish to promote my sandbox project User Revision Edit to a full project and apply for git vetted access.

Version control

git clone --branch 7.x-1.x http://git.drupal.org/sandbox/donschoe/2270791.git user_revision_edit
cd user_revision_edit

About the module

The User Revision Edit module extends the User Revision module by the edit revision functionality. This allows to modify each revision of a user including avatar and custom FAPI fields.

screenshot

Example Usecase:

  • If you are running a site with revisioned user profiles and you use the revisions as a public archive. Sometimes you have to apply corrections to the public archive pages (revisions) without hacking the database or redoing the whole revision history.

Module status:

  • I've been working on this module for 4 weeks now. You can checkout my development cycle with the issue tracker and the recent commits.
  • In addition, check out the automated code style testing at Pareview.sh. I've been running Coder reviews all the time.
  • This module is used and funded by Parliamentwatch e.V. (NGO). It's used for public archived politician profiles which are can be modified by content managers of the site using the User Revision Edit module.

About the maintainer

I'm a software engineer from Berlin and developing Drupal sites for more than 6 years now.

Drupal contributions

  • I stepped up to take over the 7.x development of the Views Dynamic Fields module 2 months ago and created a first stable 7.x version. Use the issue tracker and the commits to get a basic understanding of my maintainance stlye.
  • The User Revision Edit module will be my first contibuted module which I built from scratch.

Review checklist

  • check Repository and project page: https://drupal.org/sandbox/donschoe/2270791
  • check My module is not a duplicate. It's extending the functionality of the User Revision module. In addition, this should not added to the User Revision module because modifying revision is not the default desired behaviour.
  • check This module has only one application, the edit user revision functionality.
  • check The repository contains code in the 7.x-1.x branch, a first release tag 7.x-1.0-alpha1 was created to prepare the initial module release.
  • check I've checked my code for possible security issues and caught user input using the available standard Drupal methods.
  • check The repository does not contain a LICENSE file and no 3rd party code. I've written all the code by myself or adapted GPL-compliant code from Drupal core or contrib modules.
  • check The project page contains detailled information and the README file includes installation and usage instructions.
  • check The code contains inline-commets to make it easier to understand how this module works.
  • check I've run automated tests with Coder, Code Sniffer and PAReview.sh, the results are available here.
  • check I've tried to use the Drupal API correctly whenever possible.

I'm willing to maintain this module and I'm able to port it for Drupal 8 as soon as Drupal 8 enters a more stable beta phase (D8CX).

Got 5-Minutes?

  1. Launch Simplytest.me sandbox.
  2. Enable devel module and generate some users.
  3. Go to people and select one.
  4. Find the revision tab and chose a revision.
  5. Edit the revision and report back if everything works out.

Module reviews

Thanks for your time.
---donSchoe

CommentFileSizeAuthor
#11 cross.png428 bytesdonSchoe
#3 check.png1.33 KBdonSchoe
shot-2014-06-17_12-01-07.png93.99 KBdonSchoe

Comments

donSchoe’s picture

Issue summary: View changes
donSchoe’s picture

Issue summary: View changes
Status: Needs review » Postponed

Accidently hit "save" instead of "upload"... will update the description and reopen it again.

donSchoe’s picture

Issue summary: View changes
Status: Postponed » Needs review
Related issues: +#2258483: [META] Make revisions editable
StatusFileSize
new1.33 KB

Here we go. Please leave any feedback for this module. Thanks.

donSchoe’s picture

Issue summary: View changes
donSchoe’s picture

Issue summary: View changes
PA robot’s picture

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

donSchoe’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus

Added 3 reviews and applied the PAReview: review bonus tag.

donSchoe’s picture

Issue summary: View changes

Got 5-Minutes?

  1. Launch Simplytest.me sandbox.
  2. Enable devel module and generate some users.
  3. Go to people and select one.
  4. Find the revision tab and chose a revision.
  5. Edit the revision and report back if everything works out.
donSchoe’s picture

Issue summary: View changes
miroslavbanov’s picture

Status: Needs review » Needs work

Hi DonSchoe,

That's certainly an interesting module, if I don't exactly agree with the idea of changing previous revisions of anything.

Drupalcs automated testing has picked up some errors:

FILE: ...t/sites/all/modules/review/user_revision_edit/user_revision_edit.module
--------------------------------------------------------------------------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
 278 | ERROR | Function comment short description must end with a full stop
 334 | ERROR | The second argument to watchdog() should not be enclosed with
     |       | t()
--------------------------------------------------------------------------------


FILE: ...ser_revision_edit/views/views_handler_field_user_revision_edit_link.inc
--------------------------------------------------------------------------------
FOUND 3 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
 11 | ERROR | Class name must begin with a capital letter
 11 | ERROR | Class name must use UpperCamel naming without underscores
 32 | ERROR | Public method name
    |       | "views_handler_field_user_revision_edit_link::render_link" is not
    |       | in lowerCamel format, it must not contain underscores
--------------------------------------------------------------------------------

You should split the administration part of this module in a spearate user_revision_edit.admin.inc file.

You shouldn't adhere so strictly to the 80 characters per line rule. Some parts would be more readable if you don't break the line.

Module info file lines 7-11
You don't have any tests, so you shouldn't have any test dependencies either.

In module file, at lines 4, 24, 43, 85, 238, 278, 296, 303, 413, 428, 434 you have links to pages on drupal.org. There should only be links, if something is particularly confusing, and you need to link to a page which will explain why this is, or you need to link to a page that documents certain behavior. And the syntax is:
* @see http://drupal.org/node/2270833

On line 74, the check for 'node_admin_theme' variable is not correct. What do user revisions have to do with a configuration setting for nodes?

Lines 99-126 the checking of permissions can be a lot more compact, and easily readable:

$revert_permission = user_access('revert user revisions')
  || $user->uid == $viewed_user->uid && user_access('revert own user revisions');

On line 222, inside a form constructor, you should use form_load_include().

On line 330, why is the cache_clear_all() call needed? I don't think it is.

On line 31 and 364 _user_revision_edit_access() is only used on one place, so you shouldn't pass permissions as arguments. I haven't seen permissions being passed as array to an access callback like that. You can explicitly check for the two:

$access = user_access('edit own user revisions')
  || $user->uid == $u->uid && user_access('edit user revisions');

You should change the argument name from $u to something more descriptive.

donSchoe’s picture

Status: Needs work » Needs review
StatusFileSize
new428 bytes

Hi MiroslavBanov,

thank you for your review.

I created this extra module on purpose. My first intention was to just submit a patch for the User Revision module, but I soon noticed making revisions editable is not the behaviour that should be available by default. Therefore, if you have a use case (like the one I described) and you are really sure you wish to make revisions editable, you have to install a new module (User Revision Edit). That way I avoid revisions get modified by accident.

I'm aware of the automated testing results by pareview.sh and coder, but these are all false negatives. I will explain why:

  • All my function comments are ending with a full stop, always. But in some causes I wish to add the related issue number at the end of that line (after the full stop). For example // Does really important stuff. #1234
  • The watchdog() warning is a pure false negative. If you check the code you will find the second argument actually being enclosed with t(). The parser seems not to like my code formatting.. :-)
  • The class name is not starting with capital letter and not using UpperCamel casing without underscores because that was actually introduced in the views module. Let's have a look:
        class views_handler_field_user_revision_edit_link extends views_handler_field_user_link
      

    Which is already wrong defined in drupal core API: https://api.drupal.org/api/views/modules!user!views_handler_field_user_l...
    For the sake of readability of the code I wish to keep this naming pattern.

      class views_object
      --- class views_handler
      ------- class views_handler_field
      ----------- class views_handler_field_user_link
      --------------- class views_handler_field_user_revision_edit_link
  • Same applies to the function names of the class above. I would have to rename the function names in core or else I would break this class hierarchy. I consider this as a false negative.

Concerning the manual review:

  • I moved the 10 lines of the admin funciton to a new include, even though this is no real administration part for this module. These lines of code only apply the admin theme to the edit form if enabled.
  • While we are at it, checking for 'node_admin_theme' sounds confusing but this is actually the name of the config variable which holds the configuration of the administration seem option and is not limited to editing nodes. See: http://drupal.stackexchange.com/q/8220/13526
  • I renamed the test_dependencies in the info file to simplytest_dependencies to clarify what they are used for: http://simplytest.me/project/2270791/7.x-1.x
  • Could you provide an example where the 80 characters per line limit is reducing the code readability? I applied that because I prefer reading the code line by line without horizontal scrolling.
  • I changed all references to drupal.org issues to // @see http://drupal.org/node/1234 style.
  • I changed module_load_include() to form_load_include() in my form.
  • I simplyfied the permission checks as suggested in page callback.
  • My form is a modified reimplementation of the user account form. I have to clear the cache because pages can contain usernames and profile information, as described here: https://api.drupal.org/api/drupal/modules!user!user.pages.inc/function/u...
  • I simplyfied the permission checks as suggested in access callback.
  • Changed $u and $perm to $account and $permissions.

Commit: http://cgit.drupalcode.org/sandbox-donschoe-2270791/commit/?id=0943eb653...
Setting back to Needs Review to recieve more feedback to the module and its code.

miroslavbanov’s picture

Status: Needs review » Needs work

Hi donSchoe,

Lets review the items one by one:

  1. cross Automated test. As you said, the views part is false positive, but you misunderstood the message of one test:
    The second argument to watchdog() should not be enclosed with t()

    Remove t(). First argument of t() should become the $message of watchdog(), and second argument - the $variables.

  2. cross When I said:
    You should split the administration part of this module in a spearate user_revision_edit.admin.inc file

    I meant to move every page callback in hook_menu and hook_menu_alter to be in separate file(s). This means:

    • user_revision_edit_form
    • user_revision_edit_overview + all validate/submit callbacks

    In hook_menu and hook_menu_alter add 'file' => 'user_revision_edit.admin.inc',
    And move hook_admin_paths() back to module, or it won't work.

  3. check About 'node_admin_theme'. You're correct and I was wrong.
  4. cross
    I changed all references to drupal.org issues to // @see.

    Syntax is correct, but I was thinking that these references should be removed. Because, is there any reason for a future you, or other developer looking at the code, to see these? If you need to track what change was introduced where, that's what git history and commit messages are for.

  5. check About the 80 characters thing, ignore what I said. This is your code style, and it follows guidelines. Beyond this, it is a matter of preference.
  6. cross About form_load_include(). I didn't mention, but in user_revision_edit_form() you might need for &$form_state to be passed by reference for form_load_include() to really affect $form_state.
  7. check
    I simplyfied the permission checks as suggested in access callback.
  8. check About needing to clear the cache - fair enough.
  9. check
    Changed $u and $perm to $account and $permissions.

Anyway, I am satisfied with this module, and I am sure you will fix these small issues that are left. I hope you get more reviews soon and be given permissions to create full projects. Good luck :)

donSchoe’s picture

Status: Needs work » Needs review

Hey, thanks again for your review. I already learned alot.

  • Now, watchdog() is fixed (oops :-)!
  • I moved all page callbacks to admin.inc.
  • I removed all references to drupal.org issues.
  • Concerning the &$form_state to be passed by reference for form_load_include(): As of PHP 5.4 call-time pass-by-reference was removed, so using it will raise a fatal error (deprecated since PHP 5.0). Check out this one: http://stackoverflow.com/a/8971301/1260906

Fixed in commit 8fd3feb.

That's all I guess. Any one else? :-)

donSchoe’s picture

  • revisited pareview.sh to check for errors
  • removed the master branch from git
miroslavbanov’s picture

It's not call-time. I meant for the form constructor to get &$form_state by reference:

function user_revision_edit_form($form, &$form_state, $user_revision) {

Other than that, I am satisfied with the changes.

donSchoe’s picture

  • All right, fixed in commit 959c6cd
nuez’s picture

Hi donSchoe,

First of all: Thanks for your contribution.

Automated Review

FILE: ...iew/pareview_temp/views/views_handler_field_user_revision_edit_link.inc
--------------------------------------------------------------------------------
FOUND 3 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
11 | ERROR | Class name must begin with a capital letter
11 | ERROR | Class name must use UpperCamel naming without underscores
33 | ERROR | Public method name
| | "views_handler_field_user_revision_edit_link::render_link" is not
| | in lowerCamel format, it must not contain underscores
--------------------------------------------------------------------------------

I see this issue was addressed in the previous comments (#11), and i agree on that.

Manual Review

In general everything looks pretty good. Some issues I've found are:

  1. hook_views_api: The last stable release is 3.8. Instead of defining a specific release (3.0-alpha1) better to put just '3'
  2. user_revision_edit.module line 128: don't understand $revision->revision = 1. It is not a property, and not saved to the database. Think this can be removed.
  3. user_revision_edit_form_validate does quite a few things for validation that the original 'user_account_form_validate' does do too. If possible I would add the 'user_account_form_validate' as a validation callback so you can save yourself some coding. Maybe you have considered this option, and have reasons not to use the core user_account_form_validate?
  4. user_revision_edit.admin.inc line 244: is it necessary to 'cache_clear_all();' ? On bigger websites this will cause considerate waiting times upon submit.
  5. In hook_menu_alter, line 51 user_revision_edit, and also other places I would prefer to have the definitions on one line without a hard return. I know that the line would exceed the threshold of 80 characters, but I think it's better for readability and Drupal Coder won't throw an error. This is my personal preference though.

I'm not changing the status to 'needs work' since these issues are not really show stoppers I think, but will leave the decision to RTBC to someone else...

donSchoe’s picture

Hi nuez,
thank you for your review.

I've decided to rename the views handler class according to coding standards now. The module is now free from any pareview.sh issues. About your manual review:

  1. Changed Views API version string to '3', good idea.
  2. Well spotted, removed.
  3. Excellent idea. Completely removed my own validation as I noticed the profile validation already does what I need.
  4. As discussed in #11: My form is a modified reimplementation of the user account form. I have to clear the cache because pages can contain usernames and profile information, as described here: https://api.drupal.org/api/drupal/modules!user!user.pages.inc/function/u...
  5. Already discussed in #11: I applied that because I prefer reading the code line by line without horizontal scrolling.

Commit 4ff4b70.

So far, so good? :-)

gisle’s picture

Status: Needs review » Reviewed & tested by the community

Automated Review

PAReview came up clean.

Manual Review

Individual user account
Yes: Follows the guidelines for individual user accounts.
No duplication
Yes
Is adequately addressed on the project page. Quote:

My module is not a duplicate. It's extending the functionality of the User Revision module. In addition, this should not added to the User Revision module because modifying revision is not the default desired behaviour.

Master Branch
Yes: Follows the guidelines for master branch.
Licensing
Yes: Follows the licensing requirements
3rd party code/content
Yes: Follows the guidelines for 3rd party code.
README.txt
No.
The documentation is too brief. For instance, the module creates two permissions. Configuration of permissions and their security implications is not documented. Please see the guidelines for in-project documentation. Not a blocking issue, tho'
Code long/complex enough for review
Yes: Follows the guidelines for project length and complexity.
Secure code
Yes: Follows guidelines for writing secure code.
Coding style & Drupal API usage
Code walkthrough did not reveal anything wrong with the code submitted.

There are IMHO no more blockers. Moving to RTBC. Note that promotion will not happen until a git administrator has given this a second set of eyeballs.

donSchoe’s picture

Thanks, I just have improved the README.txt file.

klausi’s picture

Status: Reviewed & tested by the community » Fixed

Review of the 7.x-1.x branch:

  • Coder Sniffer has found some issues with your code (please check the Drupal coding standards).
    FILE: /home/klausi/pareview_temp/user_revision_edit.module
    --------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    --------------------------------------------------------------------------------
     124 | ERROR | [ ] Inline comments must end in full-stops, exclamation marks,
         |       |     or question marks
     125 | ERROR | [x] A cast statement must be followed by a single space
    --------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    --------------------------------------------------------------------------------
    

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. user_revision_edit_link_access(): $permissions is unused? Just remove it and from hook_menu()?
  2. user_revision_edit_link_access(): Do not use db_select() for simple static queries, use db_query() instead. See https://www.drupal.org/node/310075
  3. user_revision_edit_save(): @param docs missing.
  4. user_revision_edit_form(): why do you need drupal_retrieve_form() and drupal_prepare_form()? Shouldn't you simply use drupal_get_form()? Please add a comment.
  5. user_revision_edit_form_submit(): why do you need to clear ALL the chaches here? Please add a comment.

But that are not critical application blockers, so ...

Thanks for your contribution, donSchoe!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

donSchoe’s picture

Hello klausi,

thanks for approving my application.

  • I fixed the pareview issues.
  • I removed $permissions from the access callback.
  • Using a static query now.
  • Added inline documentation to explain why I'm rebuilding the from. drupal_get_form() is returning a processed form which is not working for our needs here. We only need to rebuild it as discussed here: http://drupal.stackexchange.com/q/120193/13526
  • Added inline documentation to explain why I'm clearing all caches. My form is a modified reimplementation of the user account form. I have to clear the cache because pages can contain revision information, as described here: https://api.drupal.org/api/drupal/modules!user!user.pages.inc/function/u...

And thanks to @MiroslavBanov, @nuez and @gisle for your reviews.

Status: Fixed » Closed (fixed)

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