Short description

Dear all

If I add a feature request or bug report I missed to add regulary a subscription. Because while we are using the NewPage macro you got not shown your altered page. You got the large list of existing wishes or bug reports. I leave normally without entering again my previous added page.

This wish is about to get a a button like "Trivial change" on the editor e.g. "subscribe" to subscribe while editing. -- ReimarBauer 2005-10-15 21:42:04

Hmmm, why don't you just add a regex subscription, or a category subscription for bugs? -- JürgenHermann 2005-10-19 18:37:27

I'm not sure I understand the request - you create a new page with the newpage macro, and after you save you want to subscribe to the page, but the wiki send you back to the page where you started, instead of showing the saved page.

There are many options to fix that:

-- NirSoffer 2005-10-19 22:43:19

I thought on something like this

-- ReimarBauer 2005-10-19 20:55:30

  • This looked pretty good for me, so I tried implementing it. I saw a couple of problems.

    1. in the second part of your change to PageEditor.py, you're not using the user's choice in the checkbox to subscribe or not. Every edit results in a subscribe to page. You need to change the if to

      •         if subscribe and self.request.user.isSubscribedTo([self.page_name]) == 0:
    2. The subscribe variable never gets the value from the form if you don't change the code in wikiaction.py (do_edit function)
      • {{{ subscribe = int(request.form.get('subscribe',['0'])[0])
        • and
          • add subscribe=subscribe to the keyword in the pg.saveText() call
        }}}

      I'm planning on cleaning up my code, which additionally has a Preferences option for the user to select if they want to be auto-subscribed to pages they edit or not (changes in multiconfig.py) and I'll upload them to the Patches (as applied to the 1.5.3 code base). --KeithSchwols

PageEditor

--- src/moin--main--1.5--patch-122/MoinMoin/PageEditor.py       2005-10-04 17:53:19.000000000 +0200
+++ PageEditor.py       2005-10-19 22:45:25.992172144 +0200
@@ -409,6 +409,14 @@
                 'checked': ('', 'checked')[form.get('trivial',['0'])[0] == '1'],
                 'label': _("Trivial change"),
                 })
+                
+            self.request.write('''
+ 
+<input type="checkbox" name="subscribe" id="chksubscribe" value="1" %(checked)s>
+<label for="chksubscribe">%(label)s</label> ''' % {
+                'checked': ('', 'checked')[form.get('subscribe',['0'])[0] == '1'],
+                'label': _("Subscribe"),
+                })     
 
         self.request.write('''
 &nbsp;
@@ -926,6 +934,7 @@
             comment = kw.get('comment', u'')
             extra = kw.get('extra', u'')
             trivial = kw.get('trivial', 0)
+            subscribe = kw.get('subscribe', 0)
             
             # write the page file
             mtime_usecs, rev = self._write_file(newtext, action, comment, extra)
@@ -934,6 +943,12 @@
             # send notification mails
             if self.request.cfg.mail_enabled:
                 msg = msg + self._notifySubscribers(comment, trivial)
+                # subscribe user to page 
+                if self.request.user.isSubscribedTo([self.page_name]) == 0:
+                    uid = self.request.user.valid and self.request.user.id or self.request.remote_addr
+                    this_user = user.User (self.request, id = uid)
+                    this_user.subscribe(self.page_name)
+                    this_user.save()  
           
             if self.request.cfg.lupy_search:
                 from MoinMoin import lupy
PageGraphicalEditor.py

--- src/moin--main--1.5--patch-115/MoinMoin/PageGraphicalEditor.py      2005-10-04 17:53:39.000000000 +0200
+++ PageGraphicalEditor.py      2005-10-19 23:32:00.442351144 +0200
@@ -324,6 +324,14 @@
                 'checked': ('', 'checked')[form.get('trivial',['0'])[0] == '1'],
                 'label': _("Trivial change"),
                 })
+            self.request.write('''
+&nbsp;
+<input type="checkbox" name="subscribe" id="chksubscribe" value="1" %(checked)s>
+<label for="chksubscribe">%(label)s</label> ''' % {
+                'checked': ('', 'checked')[form.get('subscribe',['0'])[0] == '1'],
+                'label': _("Subscribe"),
+                })     
+
 
         self.request.write('''
 &nbsp;
@@ -359,3 +367,12 @@
         self.request.theme.emit_custom_html(self.cfg.page_footer1)
         self.request.theme.emit_custom_html(self.cfg.page_footer2)
 
+        subscribe = kw.get('subscribe', 0)
+        
+        if self.request.cfg.mail_enabled:
+                # subscribe user to page 
+                if self.request.user.isSubscribedTo([self.page_name]) == 0:
+                    uid = self.request.user.valid and self.request.user.id or self.request.remote_addr
+                    this_user = user.User (self.request, id = uid)
+                    this_user.subscribe(self.page_name)
+                    this_user.save() 


CategoryFeatureRequest CategoryMoinMoinPatch

MoinMoin: FeatureRequests/NewPageSubscription (last edited 2007-10-29 19:09:35 by localhost)