changeset 752:9b57d117e8c5

browser side: features are checked for microblogging and group blogging. If one of them is not available, a pop-up warns it, and it is not possible to write a new entry.
author Goffi <goffi@goffi.org>
date Mon, 23 Nov 2015 23:30:34 +0100
parents 2ddd85551612
children 76a9c074327b
files src/browser/libervia_main.py src/browser/sat_browser/blog.py
diffstat 2 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Mon Nov 23 23:30:34 2015 +0100
+++ b/src/browser/libervia_main.py	Mon Nov 23 23:30:34 2015 +0100
@@ -363,10 +363,26 @@
         contact_list = self.contact_list
         contact_list.update()
 
+        try:
+            self.mblog_available = C.bool(self.features['XEP-0277']['available'])
+        except KeyError:
+            self.mblog_available = False
+
+        try:
+            self.groupblog_available = C.bool(self.features['GROUPBLOG']['available'])
+        except KeyError:
+            self.groupblog_available = False
 
         blog_widget = self.displayWidget(blog.Blog, ())
         self.setSelected(blog_widget)
 
+        if self.mblog_available:
+            if not self.groupblog_available:
+                dialog.InfoDialog(_(u"Group blogging not available"), _(u"Your server can manage (micro)blogging, but not fine permissions.<br />You'll only be able to talk publicly.")).show()
+
+        else:
+            dialog.InfoDialog(_(u"Blogging not available"), _(u"Your server can't handle (micro)blogging.<br />You'll be able to see your contacts (micro)blogs, but not to post yourself.")).show()
+
         # we fill the panels already here
         # for wid in self.widgets.getWidgets(blog.MicroblogPanel):
         #     if wid.accept_all():
--- a/src/browser/sat_browser/blog.py	Mon Nov 23 23:30:34 2015 +0100
+++ b/src/browser/sat_browser/blog.py	Mon Nov 23 23:30:34 2015 +0100
@@ -396,7 +396,9 @@
         self.vpanel = VerticalPanel()
         self.vpanel.setStyleName('microblogPanel')
         self.setWidget(self.vpanel)
-        self.addEntry(editable=True, first=True)
+        if ((self._targets_type == C.ALL and self.host.mblog_available) or
+            (self._targets_type == C.GROUP and self.host.groupblog_available)):
+            self.addEntry(editable=True, first=True)
 
         self.getAll()