Details

Applies to
1.9
Purpose
get rid of the extremely user-unfriendly "Immutable Page" message
Description
replaces the "Immutable Page" message with "You are not allowed to edit this page." or "You need to login to edit this page." as appropriate.
Fixes

Debian bugs: 678539 731694

Obsoletes

the "Show a login link instead of Immutable page" patch

Patch

   1 From efa03734f416d3ae7f3dad394e837435ba886aed Mon Sep 17 00:00:00 2001
   2 From: Paul Wise <pabs3@bonedaddy.net>
   3 Date: Sun, 29 Dec 2013 11:43:47 +0800
   4 Subject: [PATCH] Use a more user-friendly message when login-to-edit is
   5  enabled
   6 
   7 ---
   8  MoinMoin/theme/__init__.py | 35 ++++++++++++++++++++++++++++++-----
   9  1 file changed, 30 insertions(+), 5 deletions(-)
  10 
  11 diff --git a/MoinMoin/theme/__init__.py b/MoinMoin/theme/__init__.py
  12 index 604092b..ffe869d 100644
  13 --- a/MoinMoin/theme/__init__.py
  14 +++ b/MoinMoin/theme/__init__.py
  15 @@ -1271,9 +1271,22 @@ actionsMenuInit('%(label)s');
  16          if 'edit' in self.request.cfg.actions_excluded:
  17              return ""
  18  
  19 -        if not (page.isWritable() and
  20 -                self.request.user.may.write(page.page_name)):
  21 -            return self.disabledEdit()
  22 +        if not page.isWritable():
  23 +            return self.immutablePage()
  24 +        if not self.request.user.may.write(page.page_name):
  25 +            user_valid = self.request.user.valid
  26 +            user_name = self.request.user.name
  27 +            user_may_name = self.request.user.may.name
  28 +            self.request.user.name = self.request.user.may.name = u'Known'
  29 +            self.request.user.valid = 1
  30 +            if self.request.user.may.write(page.page_name):
  31 +                result = self.loginToEdit()
  32 +            else:
  33 +                result = self.editNotAllowed()
  34 +            self.request.user.valid = user_valid
  35 +            self.request.user.name = user_name
  36 +            self.request.user.may.name = user_may_name
  37 +            return result
  38  
  39          _ = self.request.getText
  40          querystr = {'action': 'edit'}
  41 @@ -1327,12 +1340,24 @@ var gui_editor_link_text = "%(text)s";
  42         'text': _('Edit (GUI)'),
  43        }
  44  
  45 -    def disabledEdit(self):
  46 -        """ Return a disabled edit link """
  47 +    def immutablePage(self):
  48 +        """ Return an immutable page message """
  49          _ = self.request.getText
  50          return ('<span class="disabled">%s</span>'
  51                  % _('Immutable Page'))
  52  
  53 +    def editNotAllowed(self):
  54 +        """ Return an edit not allowed message """
  55 +        _ = self.request.getText
  56 +        return ('<span class="disabled">%s</span>'
  57 +                % _('You are not allowed to edit this page.'))
  58 +
  59 +    def loginToEdit(self):
  60 +        """ Return a login to edit message """
  61 +        _ = self.request.getText
  62 +        return ('<span class="disabled">%s</span>'
  63 +                % _('You need to login to edit this page.'))
  64 +
  65      def infoLink(self, page):
  66          """ Return link to page information """
  67          if 'info' in self.request.cfg.actions_excluded:
  68 -- 
  69 1.8.5.1

0001-Use-a-more-user-friendly-message-when-login-to-edit-.patch

Discussion

"Known" is not a user name (see code above), but a pseudo group. If that code works, you are maybe just lucky that it does.

Logging a user in puts him into "Known" pseudo group. Maybe also into "Trusted" or other groups which you can't even know before the user is actually identified.

Thus, the promise of "log in to edit" might be fulfilled or not, you can't know beforehands. And this is exactly the reason why moin does not even promise that.

FYI, when we (team of maintainers of some wiki farm) faced the same problem, we've just changed the message to something like "You can't edit this page. You may try to login in order to get ability to edit this page." for non-logged in users. Furthermore, iirc there's somewhere patch on this wiki which implements just this behaviour. — -- EugeneSyromyatnikov 2014-01-22 10:40:58

the more constructive part

As this sort of idea is not new and comes up every year about once, maybe let's try to seek a real solution.

Requirements

Status Quo (1.9.7)

edit_bar

Tells "Immutable Page" (if fs permissions or acl permissions do not allow write).

Problem: User might wrongly assume that this is a unchangeable universally-true fact (for this page or even this wiki).

on-page permission msg

Tells "You are not allowed to edit this page." (if acl permissions do not allow write)

Problem: User might not be aware that "You" refers to the anon user as long as he/she is not logged in.

Ideas

edit_bar

Please note the rather limited space in the edit bar, must be rather brief.

Better:

on-page permission msg

We have more space for a verbose message here.

Better:

Plan


CategoryMoinMoinPatch

MoinMoin: MoinMoinPatch/UserFriendlyImmutable (last edited 2014-01-22 10:40:58 by EugeneSyromyatnikov)