Skip to content

Commit

Permalink
feat(forum_moderation): use overriden TopicDeleteView in topic_detail…
Browse files Browse the repository at this point in the history
…_actions template
  • Loading branch information
vincentporte committed Aug 28, 2023
1 parent 427d23c commit 66a8f7c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions lacommunaute/forum_conversation/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,25 @@ def test_edit_link_is_visible(self):
response = self.client.get(self.url)
self.assertContains(response, reverse("forum_conversation:topic_update", kwargs=self.kwargs), status_code=200)

def test_delete_link_visibility(self):
self.client.force_login(self.poster)

response = self.client.get(self.url)
self.assertNotContains(
response,
reverse("forum_moderation_extension:topic_delete", kwargs={"slug": self.topic.slug, "pk": self.topic.pk}),
status_code=200,
)

assign_perm("can_delete_posts", self.poster, self.forum)

response = self.client.get(self.url)
self.assertContains(
response,
reverse("forum_moderation_extension:topic_delete", kwargs={"slug": self.topic.slug, "pk": self.topic.pk}),
status_code=200,
)

def test_numqueries(self):
PostFactory.create_batch(10, topic=self.topic, poster=self.poster)
UpVoteFactory(content_object=self.topic.last_post, voter=UserFactory())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<div class="dropdown-menu" aria-labelledby="id_dropdown_moderation_menu_button">
{% if user_can_lock_topics and not topic.is_locked %}<a href="{% url 'forum_moderation:topic_lock' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Lock topic" %}</a>{% endif %}
{% if user_can_lock_topics and topic.is_locked %}<a href="{% url 'forum_moderation:topic_unlock' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Unlock topic" %}</a>{% endif %}
{% if user_can_delete_topics %}<a href="{% url 'forum_moderation:topic_delete' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Delete topic" %}</a>{% endif %}
{% if user_can_delete_topics %}<a href="{% url 'forum_moderation_extension:topic_delete' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Delete topic" %}</a>{% endif %}
{% if user_can_move_topics %}<a href="{% url 'forum_moderation:topic_move' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Move topic" %}</a>{% endif %}
{% if topic.is_topic %}
{% if user_can_change_to_sticky_topics %}<a href="{% url 'forum_moderation:topic_update_to_sticky' slug=topic.slug pk=topic.pk %}" class="dropdown-item">{% trans "Change to sticky topic" %}</a>{% endif %}
Expand Down

0 comments on commit 66a8f7c

Please sign in to comment.