diff --git a/lacommunaute/forum/admin.py b/lacommunaute/forum/admin.py index d299ccbc0..e7b28b8c8 100644 --- a/lacommunaute/forum/admin.py +++ b/lacommunaute/forum/admin.py @@ -7,11 +7,7 @@ class ForumAdmin(BaseForumAdmin): fieldsets = BaseForumAdmin.fieldsets fieldsets[0][1]["fields"] += ("short_description", "certified", "tags", "partner") - fieldsets[1][1]["fields"] += ( - "members_group", - "invitation_token", - "kind", - ) + fieldsets[1][1]["fields"] += ("kind",) @admin.register(ForumRating) diff --git a/lacommunaute/forum/enums.py b/lacommunaute/forum/enums.py index 99e92a12f..01c37f99f 100644 --- a/lacommunaute/forum/enums.py +++ b/lacommunaute/forum/enums.py @@ -3,5 +3,4 @@ class Kind(models.TextChoices): PUBLIC_FORUM = "PUBLIC_FORUM", "Espace public" - PRIVATE_FORUM = "PRIVATE_FORUM", "Espace privé" NEWS = "NEWS", "Actualités" diff --git a/lacommunaute/forum/factories.py b/lacommunaute/forum/factories.py index cc5f1713f..668a29787 100644 --- a/lacommunaute/forum/factories.py +++ b/lacommunaute/forum/factories.py @@ -3,13 +3,11 @@ from lacommunaute.forum.models import Forum, ForumRating from lacommunaute.forum_upvote.models import UpVote -from lacommunaute.users.factories import GroupFactory from lacommunaute.utils.perms import add_public_perms_on_forum class ForumFactory(BaseForumFactory): type = Forum.FORUM_POST - members_group = factory.SubFactory(GroupFactory, name=factory.SelfAttribute("..name")) name = factory.Sequence(lambda n: f"Forum {n}") description = factory.Faker("sentence", nb_words=100) short_description = factory.Faker("sentence", nb_words=10) diff --git a/lacommunaute/forum/migrations/0019_del_private_forum_20240905_1202.py b/lacommunaute/forum/migrations/0019_del_private_forum_20240905_1202.py new file mode 100644 index 000000000..2811bdc2b --- /dev/null +++ b/lacommunaute/forum/migrations/0019_del_private_forum_20240905_1202.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.8 on 2024-09-05 10:02 + +from django.db import migrations + + +def delete_private_forums(apps, schema_editor): + Forum = apps.get_model("forum", "Forum") + Forum.objects.filter(kind="PRIVATE_FORUM").delete() + + +class Migration(migrations.Migration): + dependencies = [ + ("forum", "0018_forum_partner"), + ] + + operations = [ + migrations.RunPython(delete_private_forums), + ] diff --git a/lacommunaute/forum/migrations/0020_remove_forum_invitation_token_and_more.py b/lacommunaute/forum/migrations/0020_remove_forum_invitation_token_and_more.py new file mode 100644 index 000000000..3ac1cd585 --- /dev/null +++ b/lacommunaute/forum/migrations/0020_remove_forum_invitation_token_and_more.py @@ -0,0 +1,36 @@ +# Generated by Django 5.0.8 on 2024-09-05 10:28 + +from django.db import migrations, models + + +def delete_empty_groups(apps, schema_editor): + Group = apps.get_model("auth", "Group") + Group.objects.filter(user__isnull=True).delete() + + +class Migration(migrations.Migration): + dependencies = [ + ("forum", "0019_del_private_forum_20240905_1202"), + ] + + operations = [ + migrations.RemoveField( + model_name="forum", + name="invitation_token", + ), + migrations.RemoveField( + model_name="forum", + name="members_group", + ), + migrations.AlterField( + model_name="forum", + name="kind", + field=models.CharField( + choices=[("PUBLIC_FORUM", "Espace public"), ("NEWS", "Actualités")], + default="PUBLIC_FORUM", + max_length=20, + verbose_name="Type", + ), + ), + migrations.RunPython(delete_empty_groups), + ] diff --git a/lacommunaute/forum/models.py b/lacommunaute/forum/models.py index d7f492578..18486d3cc 100644 --- a/lacommunaute/forum/models.py +++ b/lacommunaute/forum/models.py @@ -1,7 +1,4 @@ -import uuid - from django.conf import settings -from django.contrib.auth.models import Group from django.contrib.contenttypes.fields import GenericRelation from django.db import models from django.urls import reverse @@ -24,10 +21,6 @@ def public(self): class Forum(AbstractForum): - members_group = models.ForeignKey( - Group, blank=True, null=True, on_delete=models.CASCADE, verbose_name=("Members Group") - ) - invitation_token = models.UUIDField(default=uuid.uuid4, unique=True) kind = models.CharField( max_length=20, choices=Forum_Kind.choices, default=Forum_Kind.PUBLIC_FORUM, verbose_name="Type" ) diff --git a/lacommunaute/forum/tests/__snapshots__/tests_views.ambr b/lacommunaute/forum/tests/__snapshots__/tests_views.ambr index 312d11d44..563343cd8 100644 --- a/lacommunaute/forum/tests/__snapshots__/tests_views.ambr +++ b/lacommunaute/forum/tests/__snapshots__/tests_views.ambr @@ -373,7 +373,6 @@ - ''' # --- @@ -401,7 +400,6 @@ Test-Child - 0 Sujet - diff --git a/lacommunaute/forum/tests/test_categoryforum_listview.py b/lacommunaute/forum/tests/test_categoryforum_listview.py index 149cf80c5..aad0ddd0c 100644 --- a/lacommunaute/forum/tests/test_categoryforum_listview.py +++ b/lacommunaute/forum/tests/test_categoryforum_listview.py @@ -2,7 +2,6 @@ from django.urls import reverse from pytest_django.asserts import assertContains, assertNotContains -from lacommunaute.forum.enums import Kind as ForumKind from lacommunaute.forum.factories import CategoryForumFactory, ForumFactory from lacommunaute.forum.models import Forum from lacommunaute.users.factories import UserFactory @@ -19,7 +18,6 @@ def test_queryset(client, db): forum = ForumFactory(type=Forum.FORUM_CAT) unvisible_forums = ( ForumFactory(type=Forum.FORUM_CAT, parent=forum), - ForumFactory(type=Forum.FORUM_CAT, kind=ForumKind.PRIVATE_FORUM), ForumFactory(), ForumFactory(type=Forum.FORUM_LINK), ) diff --git a/lacommunaute/forum/tests/tests_model.py b/lacommunaute/forum/tests/tests_model.py index fe0fb7f4e..d8848085d 100644 --- a/lacommunaute/forum/tests/tests_model.py +++ b/lacommunaute/forum/tests/tests_model.py @@ -1,5 +1,4 @@ from django.conf import settings -from django.db import IntegrityError from django.test import TestCase from lacommunaute.forum.enums import Kind as ForumKind @@ -13,18 +12,10 @@ class ForumManagerTest(TestCase): def test_public_method(self): forum = ForumFactory(kind=ForumKind.PUBLIC_FORUM) ForumFactory(kind=ForumKind.NEWS) - ForumFactory(kind=ForumKind.PRIVATE_FORUM) self.assertEqual(forum, Forum.objects.public().get()) class ForumModelTest(TestCase): - def test_invitation_token_is_unique(self): - forum = ForumFactory() - - with self.assertRaises(IntegrityError): - forum.id = None - forum.save() - def test_get_unanswered_topics(self): topic1 = TopicFactory(forum=ForumFactory(), posts_count=1) topic2 = TopicFactory(forum=ForumFactory(parent=topic1.forum), posts_count=1) @@ -43,7 +34,7 @@ def test_count_unanswered_topics(self): def test_kind(self): self.assertEqual( Forum.kind.field.flatchoices, - [("PUBLIC_FORUM", "Espace public"), ("PRIVATE_FORUM", "Espace privé"), ("NEWS", "Actualités")], + [("PUBLIC_FORUM", "Espace public"), ("NEWS", "Actualités")], ) def test_get_absolute_url(self): @@ -89,24 +80,20 @@ def test_is_toplevel_discussion_area(self): sub_discussion_area_forum = ForumFactory(parent=discussion_area_forum) forum = ForumFactory() sub_forum = ForumFactory(parent=forum) - private_forum = ForumFactory(kind=ForumKind.PRIVATE_FORUM) news_forum = ForumFactory(kind=ForumKind.NEWS) self.assertTrue(discussion_area_forum.is_toplevel_discussion_area) self.assertFalse(sub_discussion_area_forum.is_toplevel_discussion_area) self.assertFalse(forum.is_toplevel_discussion_area) self.assertFalse(sub_forum.is_toplevel_discussion_area) - self.assertFalse(private_forum.is_toplevel_discussion_area) self.assertFalse(news_forum.is_toplevel_discussion_area) def test_is_newsfeed(self): news_forum = ForumFactory(kind=ForumKind.NEWS) discussion_area_forum = ForumFactory() - private_forum = ForumFactory(kind=ForumKind.PRIVATE_FORUM) self.assertTrue(news_forum.is_newsfeed) self.assertFalse(discussion_area_forum.is_newsfeed) - self.assertFalse(private_forum.is_newsfeed) def test_get_session_rating(self): forum = ForumFactory() diff --git a/lacommunaute/forum/tests/tests_views.py b/lacommunaute/forum/tests/tests_views.py index 63b2fc72a..a49e2af5e 100644 --- a/lacommunaute/forum/tests/tests_views.py +++ b/lacommunaute/forum/tests/tests_views.py @@ -11,7 +11,6 @@ from pytest_django.asserts import assertContains from taggit.models import Tag -from lacommunaute.forum.enums import Kind as ForumKind from lacommunaute.forum.factories import CategoryForumFactory, ForumFactory, ForumRatingFactory from lacommunaute.forum.models import Forum from lacommunaute.forum.views import ForumView @@ -163,42 +162,6 @@ def test_show_more_content(self): self.assertContains(response, "+ voir la suite") self.assertEqual(response.context_data["loadmoretopic_suffix"], "topicsinforum") - def test_moderator_links(self): - self.client.force_login(self.user) - - # no permission - response = self.client.get(self.url) - self.assertNotContains( - response, - reverse( - "members:forum_profiles", - kwargs={"pk": self.forum.pk, "slug": self.forum.slug}, - ), - ) - - # permission - assign_perm("can_approve_posts", self.user, self.forum) - response = self.client.get(self.url) - self.assertContains( - response, - reverse( - "members:forum_profiles", - kwargs={"pk": self.forum.pk, "slug": self.forum.slug}, - ), - ) - - # permission but no members group - self.forum.members_group = None - self.forum.save() - response = self.client.get(self.url) - self.assertNotContains( - response, - reverse( - "members:forum_profiles", - kwargs={"pk": self.forum.pk, "slug": self.forum.slug}, - ), - ) - def test_poll_form(self): topic = TopicFactory(forum=self.forum, poster=self.user, with_post=True, with_poll_vote=True) poll_option = topic.poll.options.first() @@ -425,11 +388,6 @@ def test_queryset_for_certified_topics(self): self.assertEqual(response.context_data["active_filter_name"], Filters.CERTIFIED.label) certified_topic = TopicFactory(with_post=True, with_certified_post=True, forum=self.forum) - TopicFactory( - with_post=True, - with_certified_post=True, - forum=ForumFactory(kind=ForumKind.PRIVATE_FORUM, with_public_perms=True), - ) response = self.client.get(self.url + f"?filter={Filters.CERTIFIED.value}") self.assertEqual(response.context_data["paginator"].count, 1) diff --git a/lacommunaute/forum_conversation/shortcuts.py b/lacommunaute/forum_conversation/shortcuts.py index 0b799196e..6aad82274 100644 --- a/lacommunaute/forum_conversation/shortcuts.py +++ b/lacommunaute/forum_conversation/shortcuts.py @@ -38,8 +38,4 @@ def get_posts_of_a_topic_except_first_one(topic: Topic, user: User) -> QuerySet[ def can_certify_post(forum, user): - return ( - user.is_authenticated - and forum.kind == Forum_Kind.PUBLIC_FORUM - and (user.groups.filter(forum=forum).exists() or user.is_staff) - ) + return user.is_authenticated and forum.kind == Forum_Kind.PUBLIC_FORUM and user.is_staff diff --git a/lacommunaute/forum_conversation/tests/tests_shortcuts.py b/lacommunaute/forum_conversation/tests/tests_shortcuts.py index bd2c1fa5d..32437d555 100644 --- a/lacommunaute/forum_conversation/tests/tests_shortcuts.py +++ b/lacommunaute/forum_conversation/tests/tests_shortcuts.py @@ -80,19 +80,12 @@ def setUpTestData(cls): def test_user_is_not_authenticated(self): self.assertFalse(can_certify_post(self.forum, AnonymousUser())) - def test_forum_is_private(self): - self.assertFalse(can_certify_post(ForumFactory.create(kind=ForumKind.PRIVATE_FORUM), self.user)) - def test_forum_is_newsfeed(self): self.assertFalse(can_certify_post(ForumFactory.create(kind=ForumKind.NEWS), self.user)) - def test_user_is_not_in_the_forum_members_group(self): - self.assertFalse(can_certify_post(self.forum, self.user)) - - def test_user_is_in_the_forum_members_group(self): - self.forum.members_group.user_set.add(self.user) - self.assertTrue(can_certify_post(self.forum, self.user)) - def test_user_is_staff(self): self.user.is_staff = True self.assertTrue(can_certify_post(self.forum, self.user)) + + def test_user_is_not_staff(self): + self.assertFalse(can_certify_post(self.forum, self.user)) diff --git a/lacommunaute/forum_conversation/tests/tests_views.py b/lacommunaute/forum_conversation/tests/tests_views.py index 74c650754..c494a254b 100644 --- a/lacommunaute/forum_conversation/tests/tests_views.py +++ b/lacommunaute/forum_conversation/tests/tests_views.py @@ -765,7 +765,7 @@ def test_numqueries(self): self.client.force_login(self.poster) # note vincentporte : to be optimized - with self.assertNumQueries(40): + with self.assertNumQueries(39): response = self.client.get(self.url) self.assertEqual(response.status_code, 200) @@ -912,7 +912,6 @@ def test_context_with_tag(self): self.assertEqual(response.context_data["active_tags_label"], " ou ".join([tag.name for tag in tags])) def test_queryset(self): - TopicFactory(with_post=True, forum=ForumFactory(kind=ForumKind.PRIVATE_FORUM, with_public_perms=True)) TopicFactory(with_post=True, forum=ForumFactory(kind=ForumKind.NEWS, with_public_perms=True)) response = self.client.get(self.url) @@ -929,7 +928,6 @@ def test_queryset(self): self.assertContains(response, topic.subject) def test_queryset_for_unanswered_topic(self): - TopicFactory(with_post=True, forum=ForumFactory(kind=ForumKind.PRIVATE_FORUM, with_public_perms=True)) TopicFactory(with_post=True, forum=ForumFactory(kind=ForumKind.NEWS, with_public_perms=True)) response = self.client.get(self.url + "?filter=NEW") @@ -944,11 +942,6 @@ def test_queryset_for_certified_topic(self): certified_topic = TopicFactory( with_post=True, with_certified_post=True, forum=ForumFactory(with_public_perms=True) ) - TopicFactory( - with_post=True, - with_certified_post=True, - forum=ForumFactory(kind=ForumKind.PRIVATE_FORUM, with_public_perms=True), - ) response = self.client.get(self.url + "?filter=CERTIFIED") self.assertEqual(response.context_data["paginator"].count, 1) @@ -1099,7 +1092,6 @@ def test_queryset(self): news_topics = TopicFactory.create_batch( 2, with_post=True, forum=ForumFactory(kind=ForumKind.NEWS, with_public_perms=True) ) - TopicFactory(with_post=True, forum=ForumFactory(kind=ForumKind.PRIVATE_FORUM, with_public_perms=True)) TopicFactory(with_post=True, forum=ForumFactory(kind=ForumKind.PUBLIC_FORUM, with_public_perms=True)) response = self.client.get(self.url) diff --git a/lacommunaute/forum_conversation/tests/tests_views_htmx.py b/lacommunaute/forum_conversation/tests/tests_views_htmx.py index 9103f562b..83df2f0c9 100644 --- a/lacommunaute/forum_conversation/tests/tests_views_htmx.py +++ b/lacommunaute/forum_conversation/tests/tests_views_htmx.py @@ -424,6 +424,7 @@ def test_create_post_with_blocked_domain_name(self): assert blocked_post.block_reason == BlockedPostReason.BLOCKED_DOMAIN +# vincentporte : not to futur self, rewrite it in pytest style class CertifiedPostViewTest(TestCase): @classmethod def setUpTestData(cls): @@ -457,8 +458,8 @@ def test_certify_without_permission(self): self.assertEqual(response.status_code, 403) def test_certify_with_permission(self): - self.topic.forum.members_group.user_set.add(self.user) - self.topic.forum.members_group.save() + self.user.is_staff = True + self.user.save() self.client.force_login(self.user) response = self.client.post(self.url, data=self.form_data) @@ -471,8 +472,8 @@ def test_certify_with_permission(self): self.assertEqual(ForumReadTrack.objects.count(), 1) def test_uncertify_with_permission(self): - self.topic.forum.members_group.user_set.add(self.user) - self.topic.forum.members_group.save() + self.user.is_staff = True + self.user.save() CertifiedPost(topic=self.topic, post=self.topic.last_post, user=self.user).save() self.client.force_login(self.user) response = self.client.post(self.url, data=self.form_data) @@ -482,8 +483,8 @@ def test_uncertify_with_permission(self): self.assertEqual(ForumReadTrack.objects.count(), 1) def test_rendered_content(self): - self.topic.forum.members_group.user_set.add(self.user) - self.topic.forum.members_group.save() + self.user.is_staff = True + self.user.save() self.client.force_login(self.user) response = self.client.post(self.url, data=self.form_data) diff --git a/lacommunaute/forum_member/tests/tests_view.py b/lacommunaute/forum_member/tests/tests_view.py index 7b1de6cd7..99145db00 100644 --- a/lacommunaute/forum_member/tests/tests_view.py +++ b/lacommunaute/forum_member/tests/tests_view.py @@ -1,15 +1,12 @@ -from django.contrib.auth.models import Group from django.test import RequestFactory, TestCase from django.urls import reverse from machina.core.loading import get_class -from machina.test.factories.forum import create_forum from pytest_django.asserts import assertContains, assertNotContains from lacommunaute.forum_member.factories import ForumProfileFactory from lacommunaute.forum_member.models import ForumProfile from lacommunaute.forum_member.shortcuts import get_forum_member_display_name from lacommunaute.forum_member.views import ForumProfileUpdateView -from lacommunaute.users.factories import UserFactory PermissionHandler = get_class("forum_permission.handler", "PermissionHandler") @@ -38,79 +35,6 @@ def test_form_fields(self): self.assertContains(response, "internship_duration") -class ModeratorProfileListView(TestCase): - @classmethod - def setUpTestData(cls): - cls.forum = create_forum() - cls.forum.members_group = Group.objects.create(name="members") - cls.forum.save() - cls.profile = ForumProfileFactory() - - cls.url = reverse( - "members:forum_profiles", - kwargs={"pk": cls.forum.pk, "slug": cls.forum.slug}, - ) - - cls.perm_handler = PermissionHandler() - assign_perm("can_approve_posts", cls.profile.user, cls.forum) - - def test_access_page(self): - user = UserFactory() - self.client.force_login(user) - response = self.client.get(self.url) - self.assertEqual(response.status_code, 403) - - assign_perm("can_approve_posts", user, self.forum) - response = self.client.get(self.url) - self.assertEqual(response.status_code, 200) - - def test_context_data(self): - self.client.force_login(self.profile.user) - response = self.client.get(self.url) - self.assertEqual(response.context_data["forum"], self.forum) - self.assertEqual(response.context_data["paginator"].per_page, 60) - - def test_content(self): - forum_profile = ForumProfileFactory(user__first_name="Jeff", user__last_name="Buckley") - self.forum.members_group.user_set.add(forum_profile.user) - self.forum.members_group.save() - - self.client.force_login(self.profile.user) - response = self.client.get(self.url) - self.assertContains(response, forum_profile.user.get_full_name()) - self.assertContains(response, reverse("members:profile", kwargs={"username": forum_profile.user.username})) - - def test_ordering_and_count(self): - self.forum.members_group.user_set.add(ForumProfileFactory(user__first_name="z").user) - self.forum.members_group.user_set.add(ForumProfileFactory(user__first_name="a").user) - self.forum.members_group.save() - - self.client.force_login(self.profile.user) - response = self.client.get(self.url) - self.assertEqual(response.context["forum_profiles"][0].user.first_name, "a") - self.assertEqual(response.context["forum_profiles"][1].user.first_name, "z") - self.assertContains(response, "2 membres") - - def test_profile_in_group(self): - ForumProfileFactory(user__first_name="john_is_not_a_member") - self.forum.members_group.user_set.add(ForumProfileFactory(user__first_name="bob_is_a_member").user) - self.forum.members_group.save() - - self.client.force_login(self.profile.user) - response = self.client.get(self.url) - self.assertEqual(response.context["forum_profiles"][0].user.first_name, "bob_is_a_member") - self.assertContains(response, "1 membre") - - def test_queries_number(self): - profiles = ForumProfileFactory.create_batch(10) - self.forum.members_group.user_set.add(*[profile.user for profile in profiles]) - self.forum.members_group.save() - - self.client.force_login(self.profile.user) - with self.assertNumQueries(11): - self.client.get(self.url) - - class TestSeekersListView: def test_content(self, client, db): undesired_forum_profile = ForumProfileFactory() diff --git a/lacommunaute/forum_member/urls.py b/lacommunaute/forum_member/urls.py index ac9b37642..21cdb353a 100644 --- a/lacommunaute/forum_member/urls.py +++ b/lacommunaute/forum_member/urls.py @@ -3,7 +3,6 @@ from lacommunaute.forum_member.views import ( ForumProfileDetailView, ForumProfileUpdateView, - ModeratorProfileListView, SeekersListView, ) @@ -13,6 +12,5 @@ urlpatterns = [ path("profile/edit/", ForumProfileUpdateView.as_view(), name="profile_update"), path("profile//", ForumProfileDetailView.as_view(), name="profile"), - path("forum/-/", ModeratorProfileListView.as_view(), name="forum_profiles"), path("seekers/", SeekersListView.as_view(), name="seekers"), ] diff --git a/lacommunaute/forum_member/views.py b/lacommunaute/forum_member/views.py index 51cefaea2..3469110ec 100644 --- a/lacommunaute/forum_member/views.py +++ b/lacommunaute/forum_member/views.py @@ -1,6 +1,5 @@ import logging -from django.shortcuts import get_object_or_404 from django.urls import reverse from django.views.generic import ListView from machina.apps.forum_member.views import ( @@ -9,7 +8,6 @@ ) from machina.core.loading import get_class -from lacommunaute.forum.models import Forum from lacommunaute.forum_member.forms import ForumProfileForm from lacommunaute.forum_member.models import ForumProfile @@ -32,36 +30,6 @@ def get_success_url(self): return reverse("members:profile", kwargs={"username": self.request.user.username}) -class ModeratorProfileListView(PermissionRequiredMixin, ListView): - model = ForumProfile - template_name = "forum_member/moderator_profiles.html" - context_object_name = "forum_profiles" - paginate_by = 60 - permission_required = ["can_approve_posts"] - - def get_forum(self): - """Returns the forum to consider.""" - if not hasattr(self, "forum"): - self.forum = get_object_or_404(Forum, pk=self.kwargs["pk"]) - return self.forum - - def get_queryset(self): - """Returns the list of items for this view.""" - self.forum = self.get_forum() - users = self.forum.members_group.user_set.all() - return ForumProfile.objects.filter(user__in=users).select_related("user").order_by("user__first_name") - - def get_controlled_object(self): - """Returns the controlled object.""" - return self.get_forum() - - def get_context_data(self, **kwargs): - context = super().get_context_data(**kwargs) - forum = self.get_forum() - context["forum"] = forum - return context - - class SeekersListView(ListView): model = ForumProfile template_name = "forum_member/seekers_profiles.html" diff --git a/lacommunaute/pages/tests/test_homepage.py b/lacommunaute/pages/tests/test_homepage.py index ca4cf481a..baad81a84 100644 --- a/lacommunaute/pages/tests/test_homepage.py +++ b/lacommunaute/pages/tests/test_homepage.py @@ -7,7 +7,6 @@ from pytest_django.asserts import assertContains, assertNotContains from lacommunaute.event.factories import EventFactory -from lacommunaute.forum.enums import Kind as ForumKind from lacommunaute.forum.factories import ForumFactory from lacommunaute.forum_conversation.factories import PostFactory, TopicFactory from lacommunaute.utils.testing import parse_response_to_soup @@ -24,7 +23,6 @@ def test_context_data(client, db): disapproved_topic = TopicFactory(with_post=True, forum=ForumFactory()) disapproved_topic.approved = False disapproved_topic.save() - TopicFactory(with_post=True, forum=ForumFactory(kind=ForumKind.PRIVATE_FORUM)) url = reverse("pages:home") diff --git a/lacommunaute/templates/forum/forum_detail.html b/lacommunaute/templates/forum/forum_detail.html index 1a4a365c3..6f4cef05b 100644 --- a/lacommunaute/templates/forum/forum_detail.html +++ b/lacommunaute/templates/forum/forum_detail.html @@ -53,9 +53,6 @@ {{ forum.name }} {{ node.obj.name }} - {% if node.obj.kind == 'PRIVATE_FORUM' %} - {{ node.obj.members_group.user_set.count }} membres - - {% endif %} {% if node.topics_count > 1 %} {{ node.topics_count }} {% trans "Topics" %} {% else %} @@ -106,14 +103,6 @@ {{ forum.name }} {% endif %} - {% if user_can_access_stats and forum.members_group %} - - - - - {% trans "Members" %} - - {% endif %} {% endif %} diff --git a/lacommunaute/templates/forum/partials/topics_and_members_counts.html b/lacommunaute/templates/forum/partials/topics_and_members_counts.html index ac271196e..a240ea169 100644 --- a/lacommunaute/templates/forum/partials/topics_and_members_counts.html +++ b/lacommunaute/templates/forum/partials/topics_and_members_counts.html @@ -1,11 +1,7 @@ {% load i18n %} {% load str_filters %} - {% if node.obj.kind == 'PRIVATE_FORUM' %} - {{ node.obj.members_group.user_set.count }} membre{{ node.obj.members_group.user_set.count|pluralizefr }} - {% endif %} {% if node.obj.is_forum %} - {% if node.obj.kind == 'PRIVATE_FORUM' %}-{% endif %} {% if node.topics_count > 1 %} {{ node.topics_count }} {% trans "Topics" %} {% else %} diff --git a/lacommunaute/templates/forum_member/moderator_profiles.html b/lacommunaute/templates/forum_member/moderator_profiles.html deleted file mode 100644 index e68fa7c5e..000000000 --- a/lacommunaute/templates/forum_member/moderator_profiles.html +++ /dev/null @@ -1,50 +0,0 @@ -{% extends "board_base.html" %} -{% load i18n %} -{% load static %} -{% load str_filters %} -{% block content %} - - - - - - {% trans "Forum Members" %} {{ forum.name }} - - {{ paginator.count }} membre{{ paginator.count|pluralizefr }} - - - - - - - - - - {% for forum_profile in forum_profiles %} - - - - - {{ forum_profile.user.get_full_name }} - - - - - {% empty %} - - No body yet… - - {% endfor %} - - - - {% with "justify-content-center" as pagination_size %} - {% include "partials/pagination.html" %} - {% endwith %} - - - - - - -{% endblock content %}
No body yet…