Skip to content

Commit

Permalink
Merge pull request mozilla#6156 from akatsoulas/question-list-product
Browse files Browse the repository at this point in the history
Display tags for all products in AAQ
  • Loading branch information
akatsoulas authored Aug 1, 2024
2 parents 219caad + 373d86e commit 91b6f07
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
1 change: 0 additions & 1 deletion kitsune/products/jinja2/products/documents.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
{{ topic_sidebar(topics[:10], subtopics, product, topic, subtopic) }}
{% endif %}


{{ aaq_widget(request, "topic", topic) }}

{% endblock %}
Expand Down
4 changes: 2 additions & 2 deletions kitsune/questions/jinja2/questions/question_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ <h1 class="sumo-page-heading {% if not logo %}no-logo{% endif %}">
{% if question.topic %}
{% set topic = question.topic %}
<li class="tag">
<a class="tag-name" href="{{ url('questions.list', topic.product.slug)|urlparams(None, request.GET, topic=None) }}">
{{ pgettext('DB: products.Product.title', topic.product.title) }}
<a class="tag-name" href="{{ url('questions.list', question.product.slug)|urlparams(None, request.GET, topic=None) }}">
{{ pgettext('DB: products.Product.title', question.product.title) }}
</a>
</li>
{% endif %}
Expand Down
28 changes: 13 additions & 15 deletions kitsune/questions/tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
from kitsune.questions.tests import AnswerFactory, QuestionFactory, tags_eq
from kitsune.questions.views import NO_TAG, UNAPPROVED_TAG
from kitsune.sumo.templatetags.jinja_helpers import urlparams
from kitsune.sumo.tests import (
TestCase,
attrs_eq,
emailmessage_raise_smtp,
get,
post,
)
from kitsune.sumo.tests import TestCase, attrs_eq, emailmessage_raise_smtp, get, post
from kitsune.sumo.urlresolvers import reverse
from kitsune.tags.tests import TagFactory
from kitsune.tidings.models import Watch
Expand Down Expand Up @@ -1126,13 +1120,16 @@ def check(product, expected):

def test_topic_filter(self):
p = ProductFactory()
t1 = TopicFactory(product=p)
t2 = TopicFactory(product=p)
t3 = TopicFactory(product=p)
t1 = TopicFactory()
t2 = TopicFactory()
t3 = TopicFactory()
t1.products.add(p)
t2.products.add(p)
t3.products.add(p)

q1 = QuestionFactory()
q2 = QuestionFactory(topic=t1)
q3 = QuestionFactory(topic=t2)
q1 = QuestionFactory(product=p)
q2 = QuestionFactory(topic=t1, product=p)
q3 = QuestionFactory(topic=t2, product=p)

url = reverse("questions.list", args=["all"])

Expand Down Expand Up @@ -1206,8 +1203,9 @@ def test_show_is_empty_string_doesnt_500(self):

def test_product_shows_without_tags(self):
p = ProductFactory()
t = TopicFactory(product=p)
q = QuestionFactory(topic=t)
t = TopicFactory()
t.products.add(p)
q = QuestionFactory(topic=t, product=p)

response = self.client.get(urlparams(reverse("questions.list", args=["all"]), show=""))
doc = pq(response.content)
Expand Down
8 changes: 6 additions & 2 deletions kitsune/questions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ def question_list(request, product_slug=None, topic_slug=None):
messages.add_message(request, messages.WARNING, "You cannot list questions at this time.")
return HttpResponseRedirect("/")

topic_navigation = any(
[
request.resolver_match.url_name == "questions.list_by_topic",
topic_slug and not product_slug,
]
)
filter_ = request.GET.get("filter")
owner = request.GET.get("owner", request.session.get("questions_owner", "all"))
show = request.GET.get("show")
Expand Down Expand Up @@ -157,7 +163,6 @@ def question_list(request, product_slug=None, topic_slug=None):

# Get all topics
topics = []
topic_navigation = False
if topic_slug:
try:
topic_history = TopicSlugHistory.objects.get(slug=topic_slug)
Expand All @@ -166,7 +171,6 @@ def question_list(request, product_slug=None, topic_slug=None):
except TopicSlugHistory.DoesNotExist:
...
topics = Topic.active.filter(visible=True, slug=topic_slug)
topic_navigation = True
if not topics:
raise Http404()

Expand Down

0 comments on commit 91b6f07

Please sign in to comment.