diff --git a/clevercloud/collect_weekly_matomo_forum_stats.sh b/clevercloud/collect_weekly_matomo_forum_stats.sh
index 494ddf3e..1a5ff24d 100755
--- a/clevercloud/collect_weekly_matomo_forum_stats.sh
+++ b/clevercloud/collect_weekly_matomo_forum_stats.sh
@@ -15,4 +15,6 @@ fi
# $APP_HOME is set by default by clever cloud.
cd $APP_HOME
-python manage.py collect_matomo_forum_stats
+# reactivate after documentation migration
+# python manage.py collect_matomo_forum_stats
+echo "Collecting weekly matomo stats for the forum is disabled for now."
diff --git a/lacommunaute/forum/tests/__snapshots__/tests_views.ambr b/lacommunaute/forum/tests/__snapshots__/tests_views.ambr
index 397f6eab..ceae4547 100644
--- a/lacommunaute/forum/tests/__snapshots__/tests_views.ambr
+++ b/lacommunaute/forum/tests/__snapshots__/tests_views.ambr
@@ -6,7 +6,7 @@
Retourner vers
- Documentation
+ Documentation
@@ -22,7 +22,7 @@
Retourner vers
- Documentation
+ Documentation
@@ -60,7 +60,7 @@
Retourner vers
- Documentation
+ Documentation
@@ -127,7 +127,7 @@
@@ -176,7 +176,7 @@
Retourner vers
- Documentation
+ Documentation
diff --git a/lacommunaute/forum/tests/test_categoryforum_createview.py b/lacommunaute/forum/tests/test_categoryforum_createview.py
deleted file mode 100644
index 05008883..00000000
--- a/lacommunaute/forum/tests/test_categoryforum_createview.py
+++ /dev/null
@@ -1,60 +0,0 @@
-import pytest # noqa
-from django.urls import reverse
-
-from machina.core.db.models import get_model
-from pytest_django.asserts import assertContains
-from lacommunaute.forum.models import Forum
-from lacommunaute.users.factories import UserFactory
-
-
-UserForumPermission = get_model("forum_permission", "UserForumPermission")
-
-
-def test_user_access(client, db):
- url = reverse("forum_extension:create_category")
- response = client.get(url)
- assert response.status_code == 302
-
- user = UserFactory()
- client.force_login(user)
- response = client.get(url)
- assert response.status_code == 403
-
- user.is_staff = True
- user.save()
- response = client.get(url)
- assert response.status_code == 403
-
- user.is_superuser = True
- user.save()
- response = client.get(url)
- assert response.status_code == 200
-
-
-def test_form_title_and_context_data(client, db):
- client.force_login(UserFactory(is_superuser=True))
- url = reverse("forum_extension:create_category")
- response = client.get(url)
- assertContains(response, "Créer une nouvelle catégorie documentaire")
- assertContains(response, reverse("forum_extension:documentation"))
-
-
-def test_success_url(client, db):
- client.force_login(UserFactory(is_superuser=True))
- url = reverse("forum_extension:create_category")
- response = client.post(url, data={"name": "Test", "description": "Test", "short_description": "Test"})
- assert response.status_code == 302
- assert response.url == reverse("forum_extension:documentation")
-
-
-def test_create_category_with_perms(client, db):
- client.force_login(UserFactory(is_superuser=True))
- url = reverse("forum_extension:create_category")
- response = client.post(url, data={"name": "Test", "description": "Test", "short_description": "Test"})
- assert response.status_code == 302
-
- forum = Forum.objects.get()
- assert forum.type == Forum.FORUM_CAT
- assert forum.parent is None
-
- assert UserForumPermission.objects.filter(forum=forum).count() == 14
diff --git a/lacommunaute/forum/tests/test_categoryforum_listview.py b/lacommunaute/forum/tests/test_categoryforum_listview.py
index aad0ddd0..597f9b00 100644
--- a/lacommunaute/forum/tests/test_categoryforum_listview.py
+++ b/lacommunaute/forum/tests/test_categoryforum_listview.py
@@ -1,48 +1,8 @@
import pytest # noqa
from django.urls import reverse
-from pytest_django.asserts import assertContains, assertNotContains
+from pytest_django.asserts import assertContains
from lacommunaute.forum.factories import CategoryForumFactory, ForumFactory
-from lacommunaute.forum.models import Forum
-from lacommunaute.users.factories import UserFactory
-
-
-def test_context(client, db):
- url = reverse("forum_extension:documentation")
- response = client.get(url)
- assert "forum/category_forum_list.html" == response.templates[0].name
- assertContains(response, reverse("stats:statistiques"), status_code=200)
-
-
-def test_queryset(client, db):
- forum = ForumFactory(type=Forum.FORUM_CAT)
- unvisible_forums = (
- ForumFactory(type=Forum.FORUM_CAT, parent=forum),
- ForumFactory(),
- ForumFactory(type=Forum.FORUM_LINK),
- )
- url = reverse("forum_extension:documentation")
- response = client.get(url)
- assert response.status_code == 200
- assert forum in response.context_data["forums"]
- for unvisible_forum in unvisible_forums:
- assert unvisible_forum not in response.context_data["forums"]
-
-
-def test_display_create_category_button(client, db):
- url = reverse("forum_extension:documentation")
- response = client.get(url)
- assertNotContains(response, reverse("forum_extension:create_category"), status_code=200)
-
- user = UserFactory()
- client.force_login(user)
- response = client.get(url)
- assertNotContains(response, reverse("forum_extension:create_category"), status_code=200)
-
- user.is_superuser = True
- user.save()
- response = client.get(url)
- assertContains(response, reverse("forum_extension:create_category"), status_code=200)
def test_display_banners(client, db):
diff --git a/lacommunaute/forum/tests/test_subcategoryforum_createview.py b/lacommunaute/forum/tests/test_subcategoryforum_createview.py
deleted file mode 100644
index cbf9d60a..00000000
--- a/lacommunaute/forum/tests/test_subcategoryforum_createview.py
+++ /dev/null
@@ -1,69 +0,0 @@
-import pytest # noqa
-from django.urls import reverse
-from machina.core.db.models import get_model
-from pytest_django.asserts import assertContains
-
-from lacommunaute.forum.models import Forum
-from lacommunaute.users.factories import UserFactory
-from lacommunaute.forum.factories import CategoryForumFactory
-
-
-UserForumPermission = get_model("forum_permission", "UserForumPermission")
-
-
-def test_user_access(client, db):
- category_forum = CategoryForumFactory()
- url = reverse("forum_extension:create_subcategory", kwargs={"pk": category_forum.pk})
- response = client.get(url)
- assert response.status_code == 302
-
- user = UserFactory()
- client.force_login(user)
- response = client.get(url)
- assert response.status_code == 403
-
- user.is_staff = True
- user.save()
- response = client.get(url)
- assert response.status_code == 403
-
- user.is_superuser = True
- user.save()
- response = client.get(url)
- assert response.status_code == 200
-
-
-def test_form_title_and_context_datas(client, db):
- client.force_login(UserFactory(is_superuser=True))
- category_forum = CategoryForumFactory()
- url = reverse("forum_extension:create_subcategory", kwargs={"pk": category_forum.pk})
- response = client.get(url)
- assertContains(response, f"Créer une fiche pratique dans la catégorie {category_forum.name}", html=True)
- assertContains(
- response, reverse("forum_extension:forum", kwargs={"pk": category_forum.pk, "slug": category_forum.slug})
- )
-
-
-def test_success_url(client, db):
- client.force_login(UserFactory(is_superuser=True))
- category_forum = CategoryForumFactory()
- url = reverse("forum_extension:create_subcategory", kwargs={"pk": category_forum.pk})
- response = client.post(url, data={"name": "Test", "description": "Test", "short_description": "Test"})
- assert response.status_code == 302
- assert response.url == reverse(
- "forum_extension:forum", kwargs={"pk": category_forum.children.first().pk, "slug": "test"}
- )
-
-
-def test_create_subcategory_with_perms(client, db):
- client.force_login(UserFactory(is_superuser=True))
- category_forum = CategoryForumFactory()
- url = reverse("forum_extension:create_subcategory", kwargs={"pk": category_forum.pk})
- response = client.post(url, data={"name": "Test", "description": "Test", "short_description": "Test"})
- assert response.status_code == 302
-
- forum = category_forum.children.get()
- assert forum.type == Forum.FORUM_POST
- assert forum.parent == category_forum
-
- assert UserForumPermission.objects.filter(forum=forum).count() == 14
diff --git a/lacommunaute/forum/tests/tests_views.py b/lacommunaute/forum/tests/tests_views.py
index 3ae9a6fd..97e3486f 100644
--- a/lacommunaute/forum/tests/tests_views.py
+++ b/lacommunaute/forum/tests/tests_views.py
@@ -285,24 +285,6 @@ def test_descendants_are_in_cards_if_forum_is_category_type(self):
response, reverse("forum_extension:forum", kwargs={"pk": child_forum.pk, "slug": child_forum.slug})
)
- def test_show_add_forum_button_for_superuser_if_forum_is_category_type(self):
- forum = CategoryForumFactory(with_public_perms=True, with_child=True)
- url = reverse("forum_extension:forum", kwargs={"pk": forum.pk, "slug": forum.slug})
-
- user = UserFactory()
- self.client.force_login(user)
- response = self.client.get(url)
- self.assertNotContains(
- response, reverse("forum_extension:create_subcategory", kwargs={"pk": forum.pk}), status_code=200
- )
-
- user.is_superuser = True
- user.save()
- response = self.client.get(url)
- self.assertContains(
- response, reverse("forum_extension:create_subcategory", kwargs={"pk": forum.pk}), status_code=200
- )
-
def test_siblings_in_context(self):
forum = CategoryForumFactory(with_public_perms=True)
ForumFactory.create_batch(3, parent=forum, with_public_perms=True)
diff --git a/lacommunaute/forum/urls.py b/lacommunaute/forum/urls.py
index 77cd7c35..b0427a9d 100644
--- a/lacommunaute/forum/urls.py
+++ b/lacommunaute/forum/urls.py
@@ -2,12 +2,9 @@
from machina.apps.forum.views import IndexView
from lacommunaute.forum.views import (
- CategoryForumCreateView,
- CategoryForumListView,
ForumRatingView,
ForumUpdateView,
ForumView,
- SubCategoryForumCreateView,
SubCategoryForumListView,
)
@@ -21,7 +18,4 @@
path("forum/-/rate/", ForumRatingView.as_view(), name="rate"),
path("forum/-/subs/", SubCategoryForumListView.as_view(), name="subcategory_forums"),
path("forums/", IndexView.as_view(), name="index"),
- path("documentation/", CategoryForumListView.as_view(), name="documentation"),
- path("documentation/category/create/", CategoryForumCreateView.as_view(), name="create_category"),
- path("documentation/category//create/", SubCategoryForumCreateView.as_view(), name="create_subcategory"),
]
diff --git a/lacommunaute/forum/views.py b/lacommunaute/forum/views.py
index f16088f9..3b11e172 100644
--- a/lacommunaute/forum/views.py
+++ b/lacommunaute/forum/views.py
@@ -3,11 +3,10 @@
from django.conf import settings
from django.contrib.auth.mixins import UserPassesTestMixin
from django.contrib.contenttypes.models import ContentType
-from django.db.models.query import QuerySet
from django.shortcuts import get_object_or_404, render
-from django.urls import reverse, reverse_lazy
+from django.urls import reverse
from django.views import View
-from django.views.generic import CreateView, ListView, UpdateView
+from django.views.generic import UpdateView
from machina.apps.forum.views import ForumView as BaseForumView
from machina.core.loading import get_class
from taggit.models import Tag
@@ -17,7 +16,7 @@
from lacommunaute.forum_conversation.forms import PostForm
from lacommunaute.forum_conversation.view_mixins import FilteredTopicsListViewMixin
from lacommunaute.forum_upvote.models import UpVote
-from lacommunaute.utils.perms import add_public_perms_on_forum, forum_visibility_content_tree_from_forums
+from lacommunaute.utils.perms import forum_visibility_content_tree_from_forums
logger = logging.getLogger(__name__)
@@ -134,63 +133,6 @@ def get_context_data(self, **kwargs):
return context
-class CategoryForumListView(ListView):
- template_name = "forum/category_forum_list.html"
- context_object_name = "forums"
-
- def get_queryset(self) -> QuerySet[Forum]:
- return Forum.objects.filter(type=Forum.FORUM_CAT, level=0)
-
-
-class BaseCategoryForumCreateView(UserPassesTestMixin, CreateView):
- template_name = "forum/forum_create_or_update.html"
- form_class = ForumForm
-
- def test_func(self):
- return self.request.user.is_superuser
-
- def form_valid(self, form):
- response = super().form_valid(form)
- add_public_perms_on_forum(form.instance)
- return response
-
-
-class CategoryForumCreateView(BaseCategoryForumCreateView):
- success_url = reverse_lazy("forum_extension:documentation")
-
- def form_valid(self, form):
- form.instance.parent = None
- form.instance.type = Forum.FORUM_CAT
- return super().form_valid(form)
-
- def get_context_data(self, **kwargs):
- context = super().get_context_data(**kwargs)
- context["title"] = "Créer une nouvelle catégorie documentaire"
- context["back_url"] = reverse("forum_extension:documentation")
- return context
-
-
-class SubCategoryForumCreateView(BaseCategoryForumCreateView):
- def get_success_url(self):
- return reverse("forum_extension:forum", kwargs={"pk": self.object.pk, "slug": self.object.slug})
-
- def get_parent_forum(self):
- return Forum.objects.get(pk=self.kwargs["pk"])
-
- def form_valid(self, form):
- form.instance.type = Forum.FORUM_POST
- form.instance.parent = self.get_parent_forum()
- return super().form_valid(form)
-
- def get_context_data(self, **kwargs):
- context = super().get_context_data(**kwargs)
- context["title"] = f"Créer une fiche pratique dans la catégorie {self.get_parent_forum().name}"
- context["back_url"] = reverse(
- "forum_extension:forum", kwargs={"pk": self.get_parent_forum().pk, "slug": self.get_parent_forum().slug}
- )
- return context
-
-
class ForumRatingView(View):
def post(self, request, *args, **kwargs):
forum_rating = ForumRating.objects.create(
diff --git a/lacommunaute/forum_conversation/tests/__snapshots__/tests_views.ambr b/lacommunaute/forum_conversation/tests/__snapshots__/tests_views.ambr
index d094bf82..17d4c366 100644
--- a/lacommunaute/forum_conversation/tests/__snapshots__/tests_views.ambr
+++ b/lacommunaute/forum_conversation/tests/__snapshots__/tests_views.ambr
@@ -240,7 +240,7 @@
Retourner vers
- Documentation
+ Documentation
diff --git a/lacommunaute/pages/tests/__snapshots__/test_homepage.ambr b/lacommunaute/pages/tests/__snapshots__/test_homepage.ambr
index 7d067ba7..36a809fb 100644
--- a/lacommunaute/pages/tests/__snapshots__/test_homepage.ambr
+++ b/lacommunaute/pages/tests/__snapshots__/test_homepage.ambr
@@ -13,7 +13,7 @@
Espace d'échanges
- Documentation
+ Documentation
Évènements
@@ -196,7 +196,7 @@
Espace d'échanges
- Documentation
+ Documentation
Évènements
@@ -242,7 +242,7 @@
Espace d'échanges
- Documentation
+ Documentation
Évènements
diff --git a/lacommunaute/templates/404.html b/lacommunaute/templates/404.html
index b0626243..60e6dd87 100644
--- a/lacommunaute/templates/404.html
+++ b/lacommunaute/templates/404.html
@@ -15,7 +15,7 @@ Bienvenue sur le site de la Communauté de l'Inclusion.
Espace d'échanges
- Documentation
+ Documentation
Recherche
diff --git a/lacommunaute/templates/forum/forum_documentation_category.html b/lacommunaute/templates/forum/forum_documentation_category.html
index e12bfabe..823538e4 100644
--- a/lacommunaute/templates/forum/forum_documentation_category.html
+++ b/lacommunaute/templates/forum/forum_documentation_category.html
@@ -8,7 +8,7 @@
diff --git a/lacommunaute/templates/pages/home.html b/lacommunaute/templates/pages/home.html
index d4ad09ad..9563829e 100644
--- a/lacommunaute/templates/pages/home.html
+++ b/lacommunaute/templates/pages/home.html
@@ -10,7 +10,7 @@
{% block body_class %}p-home{{ block.super }}{% endblock %}
{% block content %}
{% url 'forum_conversation_extension:topics' as publicforum_url %}
- {% url 'forum_extension:documentation' as documentation_url %}
+ {% url None as documentation_url %}
{% url 'event:current' as event_url %}
{% url 'surveys:dsp_create' as dsp_url %}
diff --git a/lacommunaute/templates/partials/ask_a_question.html b/lacommunaute/templates/partials/ask_a_question.html
index 3516f50c..bedd7e2a 100644
--- a/lacommunaute/templates/partials/ask_a_question.html
+++ b/lacommunaute/templates/partials/ask_a_question.html
@@ -21,11 +21,7 @@
ou
diff --git a/lacommunaute/templates/partials/breadcrumb.html b/lacommunaute/templates/partials/breadcrumb.html
index 47731b11..dc2e07db 100644
--- a/lacommunaute/templates/partials/breadcrumb.html
+++ b/lacommunaute/templates/partials/breadcrumb.html
@@ -5,7 +5,7 @@
{% trans "Back to" %}
{% if forum.is_in_documentation_area %}
- {% trans "Documents" %}
+ {% trans "Documents" %}
{% else %}
{% trans "Discussion area" %}
{% endif %}
diff --git a/lacommunaute/templates/partials/footer.html b/lacommunaute/templates/partials/footer.html
index 5c39f256..e0ef21cf 100644
--- a/lacommunaute/templates/partials/footer.html
+++ b/lacommunaute/templates/partials/footer.html
@@ -14,7 +14,7 @@
{% trans "Discussion area" %}
- {% trans "Documents" %}
+ {% trans "Documents" %}
{% trans "Events" %}