Commit ee57e9ee authored by Robert's avatar Robert

Add links to chat rooms to group page

parent d8f40ae8
Pipeline #3000 failed with stages
in 1 minute and 55 seconds
......@@ -127,7 +127,6 @@
<a href="{% url 'recommend-group' group.slug %}">Weiterempfehlen</a>
{% endif %}
</dd>
{% load rules %}
{% has_perm 'groups.change' user group as can_view_details %}
{% if GROUPRISE_MAILINGLIST_ENABLED and can_view_details %}
......@@ -141,6 +140,26 @@
</a>
</dd>
{% endif %}
{% if public_chat_room %}
<dt>
<i class="sg sg-public-chat"></i>
</dt>
<dd>
<a href="{{ public_chat_room.get_client_url }}"><strong>Öffentlicher Chatraum der Gruppe</strong></a>
</dd>
{% endif %}
{% load rules %}
{% has_perm 'groups.change' user group as can_view_details %}
{% if private_chat_room and can_view_details %}
<dt>
<i class="sg sg-private-chat"></i>
</dt>
<dd>
<a href="{{ private_chat_room.get_client_url }}"><strong>Interner Chatraum der Gruppe</strong></a>
</dd>
{% endif %}
</dl>
</div>
......
......@@ -55,6 +55,8 @@ class Detail(PermissionMixin, TemplateFilterMixin, MultipleObjectMixin, DetailVi
mailinglist_conf = settings.GROUPRISE.get('MAILINGLIST_ENABLED', False)
kwargs['feed_url'] = self.request.build_absolute_uri(
reverse('group-feed', args=(self.object.pk,)))
kwargs['public_chat_room'] = self.object.matrix_rooms.filter(is_private=False).first()
kwargs['private_chat_room'] = self.object.matrix_rooms.filter(is_private=True).first()
return super().get_context_data(
GROUPRISE_MAILINGLIST_ENABLED=mailinglist_conf,
associations=associations,
......
# Generated by Django 2.2.17 on 2021-02-08 10:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('matrix_chat', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='matrixchatgrouproom',
name='group',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='matrix_rooms', to='groups.Group'),
),
]
......@@ -7,7 +7,7 @@ from grouprise.features.matrix_chat.settings import MATRIX_DOMAIN
class MatrixChatGroupRoom(models.Model):
group = models.ForeignKey(
"groups.Group", related_name="matrix_room", on_delete=models.CASCADE
"groups.Group", related_name="matrix_rooms", on_delete=models.CASCADE
)
room_id = models.CharField(max_length=256)
is_private = models.BooleanField()
......
......@@ -105,6 +105,8 @@
.sg-icon(more, @fa-var-ellipsis-h);
.sg-icon(imprint, @fa-var-gavel);
.sg-icon(mailinglist, @fa-var-envelope);
.sg-icon(public-chat, @fa-var-comments);
.sg-icon(private-chat, @fa-var-user-secret);
// utility icons
.sg-icon(increase, @fa-var-plus);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment