Edgewall Software
Modify

Ticket #2839 (closed enhancement: wontfix)

Opened 6 years ago

Last modified 2 years ago

require username, comment when changing stuff

Reported by: joramagten@… Owned by: cboos
Priority: low Milestone:
Component: wiki system Version: 0.9.3
Severity: minor Keywords: tracobject author comment
Cc: joramagten@…
Release Notes:
API Changes:

Description

when editing a wiki page, roadmap, timeline, ...
require an author and comment

this to force users to add comments when committing
I edited the function save in source:trunk/trac/wiki/model.py

    def save(self, author, comment, remote_addr, t=None, db=None):
        ...
        if t is None:
            t = time.time()

        if author == None or author == "" :
            raise TracError('Author field is empty')

        if comment == None or comment == "" :
            raise TracError('Comment field is empty')

        if self.text != self.old_text:
            cursor = db.cursor()
        ...

also in source:/trunk/templates/wiki.cs " (optional)" should be removed

248 	     <div class="field">
249 	      <label>Comment about this change (optional):<br />
250 	      <input id="comment" type="text" name="comment" size="60" value="<?cs
251 	        var:wiki.comment?>" /></label>
252 	     </div><br />
  • maybe this should better be done with an option in the config file
  • it might also be better to handle this in the POST processing of the form and color the field RED?

Attachments

confirm-wiki.patch (1.4 KB) - added by eblot 6 years ago.
Javascript to prompt the user about comment-less wiki page update

Download all attachments as: .zip

Change History

comment:1 Changed 6 years ago by eblot

  • Priority changed from normal to low
  • Severity changed from normal to minor
  • Type changed from defect to enhancement

At best, this could be defined as an option.

I personally use a Javacript to pop out a question to the user whether he's sure he wants to commit a new version of a wiki page without a comment.

(changing the ticket type: this is not a defect)

comment:2 Changed 6 years ago by joramagten@…

you're right, this is not a defect at all, sorry about that

that's also an interesting option, can you share the Javascript with us?
thanks in advance

Changed 6 years ago by eblot

Javascript to prompt the user about comment-less wiki page update

comment:3 Changed 6 years ago by eblot

Sample of a Javascript add-on that:

  • hides the wiki page Save button if the user has not previewed her changes
  • prompts the user if she attempts to save the changes without adding a comment


comment:4 Changed 6 years ago by cboos

  • Keywords tracobject added
  • Milestone set to 1.0
  • Owner changed from jonas to cboos

A IWikiManipulator anyone?

The work Alec did for tickets could be leveraged here for wiki pages.

comment:5 Changed 3 years ago by xyanipheia

We used this patch for a long time. Now, after switching to 0.11 we missed it. We usually use a minimum comment length of 5 chars to remind users not to forget the comment.

I'm working on a patch for 0.11.n.

  • variable name: [wiki] min_wiki_comment_size

The functionality should be implemented easily by a patch similar to #7065. Adding a new init variable in the [wiki] section and adding a few lines as in wiki/web_ui.py (see [7465]).

What I do not know is how to change the line depending on the init variable ("Comment about this change (optional)").

I would appreciate to have one of the following comments:

  • if min_wiki_comment_size == 0: "Comment about this change (optional)".
  • if min_wiki_comment_size > 0: "Comment about this change (mandatory, min. X characters)".

comment:6 follow-up: Changed 3 years ago by osimons

This should be a plugin. The IWikiManipulator (and similar manipulators for other modules) is there just for that reason - so that plugins can implement logic to verifify and possibly veto any create/update event. The plugin can implement any rule for whatever purpose - as for instance used by SpamFilter.

I suggest we close this as wontfix.

comment:7 in reply to: ↑ 6 Changed 2 years ago by cboos

  • Component changed from general to wiki system
  • Milestone 1.0 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

Replying to osimons:

I suggest we close this as wontfix.

My personal take is that you have to educate the users anyway, otherwise even if you enforce comments, all you'll get will be some informative "did some changes" comments if the user is not convinced by the need to record the reasons for the change.

This "education" can be simply showing to the user the difference in page history, one with informative comments, the other without, and let him figure which one is the most useful.

Having the wiki blame feature would be yet another selling point (provided we would have that feature, of course ;-) ).

comment:8 Changed 2 years ago by Ryan Ollos <ryano@…>

I'll just post here what I posted in #8654 (somewhat of a duplicate) in case someone stumbles across here looking to implement this.

There is a ForceCommentPlugin on Trac-Hacks that forces a user to enter a comment. There is also a ForcePreviewPlugin that applies to both wiki pages and tickets.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from cboos. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.