Revision author should default to the current user instead of the previous revision author

Created on 18 October 2024, about 1 month ago

Problem/Motivation

When I run a replacement, any of my colleagues looking at the revision history should be able to see that the person who ran the replacement was me. Currently however, newer revisions are attributed to whoever did the change... meaning some will be very confused to see their name next to changes they have nothing to do with.

Steps to reproduce

1. Select a piece of content (with revisions turned on), whose last edit was done by a user other than yourself.
2. Run a replacement which affects that piece.
3. Check the revision history.
4. Note that the most recent revision is not attributed to you, but whomever did the last edit.

Proposed resolution

set revision_uid to current user wherever revision_log is being set in...
src/Plugin/Scanner/Node.php
and
src/Plugin/Scanner/Paragraph.php

Remaining tasks

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom jacobupal Leeds

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @jacobupal
  • 🇬🇧United Kingdom jacobupal Leeds
  • 🇬🇧United Kingdom jacobupal Leeds
  • 🇩🇪Germany Anybody Porta Westfalica

    In my opinion this should be a setting, because you may alternatively want to keep the existing behaviour, if an administrator runs the scans and replacements and should not appear as author.

  • 🇬🇧United Kingdom jacobupal Leeds

    I think you might have misunderstood (forgive me if not!). This proposal would not make the person running the replacements the author of the piece itself (the "uid") instead I'm proposing that the "revision_uid" value (not "uid") in the new revision should reflect who ran the replacement.

    In your example, the author of piece would remain whatever it was before the replacement, but when reading through the revision history, the change would be now attributed to the administrator who ran the replacement, this would only be visible by users who can read the revision history. Or if for example you have made the revision user visible in your theme using some view/twig like "Created on [created] by [uid] and last updated on [changed] by [revision_uid]".

    With the current behavior: if I make a normal change to an article, and a new revision is made, that change/revision is always attributed to me by default. But then, if somebody runs a bunch of replacements after me, using this module, those changes are now attributed to me too, even though I have nothing to do with them. Those new revisions are not my work, and if somebody asks me why I made those changes I won't have anything to tell them.

    I can't really think of a situation where this proposal shouldn't be the default, because that is who made this change. Attributing changes/revisions to people who didn't make those changes seems like a bug to me...

    I can see a situation where you might like the option want to force "revision_uid" to be some generic user and call it "bulk changes" or something, however I think that'd be a different proposal/issue.

  • 🇬🇧United Kingdom jacobupal Leeds

    Just to illustrate, I performed the same 3 steps and have screenshot what happens before and after this proposed change.

    The steps:

    1. User "jacob" creates the new article.
    2. User "clare" makes a change to the article.
    3. User "admin" performs a replacement which affects the article.

    This first image compares two screenshots; before and after. It can be seen that there is no change to the "author" from this proposal.

    However, when viewing revision history there is a difference.

    Before the patch/MR, we can see the latest is revision is incorrectly attributed to "clare":

    After the patch/MR we can see the latest revision is properly attributed to "admin":

Production build 0.71.5 2024