Ralfp 12 лет назад
Родитель
Сommit
da9447f9c1

+ 27 - 0
misago/fixtures/privatethreadssettings.py

@@ -0,0 +1,27 @@
+from misago.utils.fixtures import load_settings_fixture, update_settings_fixture
+from misago.utils.translation import ugettext_lazy as _
+
+settings_fixture = (
+    # Threads Settings
+    ('private-threads', {
+         'name': _("Private Threads Settings"),
+         'description': _("Those settings control your forum's private threads."),
+         'settings': (
+            ('enable_private_threads', {
+                'value':        True,
+                'type':         "boolean",
+                'input':        "yesno",
+                'separator':    _("Private Threads"),
+                'name':         _("Enable Private Threads"),
+            }),
+       ),
+    }),
+)
+
+
+def load():
+    load_settings_fixture(settings_fixture)
+
+
+def update():
+    update_settings_fixture(settings_fixture)

+ 2 - 0
misago/migrations/0001_initial.py

@@ -403,6 +403,7 @@ class Migration(SchemaMigration):
             ('last_search', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
             ('alerts', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
             ('alerts_date', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
+            ('unread_pds', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
             ('activation', self.gf('django.db.models.fields.IntegerField')(default=0)),
             ('token', self.gf('django.db.models.fields.CharField')(max_length=12, null=True, blank=True)),
             ('avatar_ban', self.gf('django.db.models.fields.BooleanField')(default=False)),
@@ -904,6 +905,7 @@ class Migration(SchemaMigration):
             'timezone': ('django.db.models.fields.CharField', [], {'default': "'utc'", 'max_length': '255'}),
             'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
             'token': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True', 'blank': 'True'}),
+            'unread_pds': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
             'username': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
             'username_slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '255'}),
             'votes': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})

+ 1 - 0
misago/models/usermodel.py

@@ -163,6 +163,7 @@ class User(models.Model):
     last_search = models.DateTimeField(null=True, blank=True)
     alerts = models.PositiveIntegerField(default=0)
     alerts_date = models.DateTimeField(null=True, blank=True)
+    unread_pds = models.PositiveIntegerField(default=0)
     activation = models.IntegerField(default=0)
     token = models.CharField(max_length=12, null=True, blank=True)
     avatar_ban = models.BooleanField(default=False)

+ 3 - 1
templates/cranefly/layout.html

@@ -49,7 +49,9 @@
         <ul class="nav navbar-blocks pull-right">
           <li class="user-profile"><a href="{% url 'user' user=user.id, username=user.username_slug %}" title="{% trans %}Go to your profile{% endtrans %}" class="tooltip-bottom"><div><img src="{{ user.get_avatar(28) }}" alt=""> {{ user.username }}</div></a></li>
           <li><a href="{% url 'alerts' %}" title="{% if user.alerts %}{% trans %}You have new notifications!{% endtrans %}{% else %}{% trans %}Your Notifications{% endtrans %}{% endif %}" class="tooltip-bottom"><i class="icon-asterisk"></i>{% if user.alerts %}<span class="label label-important">{{ user.alerts }}</span>{% endif %}</a></li>
-          <li><a href="#" title="{% trans %}Private messages{% endtrans %}" class="tooltip-bottom"><i class="icon-inbox"></i><span class="label label-important">2</span></a></li>
+          {% if settings.enable_private_threads %}
+          <li><a href="#" title="{% if user.unread_pds %}{% trans %}You have new replies in your Private Threads!{% endtrans %}{% else %}{% trans %}Your Private Threads{% endtrans %}{% endif %}" class="tooltip-bottom"><i class="icon-inbox"></i>{% if user.unread_pds %}<span class="label label-important">{{ user.unread_pds }}</span>{% endif %}</a></li>
+          {% endif %}
           <li><a href="{% url 'newsfeed' %}" title="{% trans %}Your News Feed{% endtrans %}" class="tooltip-bottom"><i class="icon-signal"></i></a></li>
           <li><a href="{% url 'watched_threads' %}" title="{% trans %}Threads you are watching{% endtrans %}" class="tooltip-bottom"><i class="icon-bookmark"></i></a></li>
           <li><a href="{% url 'usercp' %}" title="{% trans %}Edit your profile options{% endtrans %}" class="tooltip-bottom"><i class="icon-cog"></i></a></li>