Show All Current Authors on the Review Page (#22548)
* Show all current authors on the review page * Removed extra style * Added tests * ruff formatting * ruff format * Changed to use class rather than inline style * Updated tests, better conditional * Dotted underline under unlisted authors * Removed underline, modified conditional, removed sidebar Author * Extra space * 300 weight font
This commit is contained in:
Родитель
4a368cac59
Коммит
cedcc4917e
|
@ -25,8 +25,8 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h2>
|
</h2>
|
||||||
<h4 class="author">by
|
<h4 class="author">by
|
||||||
{% for author in addon.listed_authors %}
|
{% for author in addon.current_authors %}
|
||||||
<a href="{{ url('reviewers.developer_profile', author.id) }}">{{ author.name }}</a>{% if not loop.last %},{% endif %}
|
<a href="{{ url('reviewers.developer_profile', author.id) }}"{% if not author.listed %}class="is_unlisted"{% endif %}>{{ author.name }}</a>{% if not loop.last %},{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
|
@ -470,13 +470,6 @@
|
||||||
<li><a href="#review-actions">Resolution</a></li>
|
<li><a href="#review-actions">Resolution</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<strong>Authors</strong>
|
|
||||||
<ul>
|
|
||||||
{% for author in addon.authors.all() %}
|
|
||||||
<li><a href="{{ url('reviewers.developer_profile', author.id) }}">{{ author.name }}</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<strong>Categories</strong>
|
<strong>Categories</strong>
|
||||||
<ul>
|
<ul>
|
||||||
{% for category in addon.all_categories %}
|
{% for category in addon.all_categories %}
|
||||||
|
|
|
@ -2729,7 +2729,7 @@ class TestReview(ReviewBase):
|
||||||
# 7. current version + file
|
# 7. current version + file
|
||||||
# 8. current version translations
|
# 8. current version translations
|
||||||
# 9. current version applications versions
|
# 9. current version applications versions
|
||||||
# 10. authors
|
# 10. add current_authors property to the addon instance
|
||||||
# 11. previews
|
# 11. previews
|
||||||
# 12. promoted info for the add-on
|
# 12. promoted info for the add-on
|
||||||
# 13. latest version in channel + file
|
# 13. latest version in channel + file
|
||||||
|
@ -5637,12 +5637,31 @@ class TestReview(ReviewBase):
|
||||||
|
|
||||||
another_author = user_factory()
|
another_author = user_factory()
|
||||||
AddonUser.objects.create(addon=self.addon, user=another_author)
|
AddonUser.objects.create(addon=self.addon, user=another_author)
|
||||||
|
unlisted_author = user_factory()
|
||||||
|
AddonUser.objects.create(addon=self.addon, user=unlisted_author, listed=False)
|
||||||
|
|
||||||
response = self.client.get(self.url)
|
response = self.client.get(self.url)
|
||||||
self.assertContains(response, another_author.name)
|
self.assertContains(response, another_author.name)
|
||||||
profile_url = reverse('reviewers.developer_profile', args=(another_author.id,))
|
author_profile_url = reverse('reviewers.developer_profile', args=(author.id,))
|
||||||
self.assertContains(response, profile_url)
|
another_profile_url = reverse(
|
||||||
|
'reviewers.developer_profile', args=(another_author.id,)
|
||||||
|
)
|
||||||
|
unlisted_profile_url = reverse(
|
||||||
|
'reviewers.developer_profile', args=(unlisted_author.id,)
|
||||||
|
)
|
||||||
|
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response, f'{author.name}</a>, <a href="{profile_url}">'
|
response,
|
||||||
|
f'<a href="{author_profile_url}">{author.name}</a>,',
|
||||||
|
)
|
||||||
|
self.assertContains(
|
||||||
|
response,
|
||||||
|
f'<a href="{another_profile_url}">{another_author.name}</a>,',
|
||||||
|
)
|
||||||
|
self.assertContains(
|
||||||
|
response,
|
||||||
|
f'<a href="{unlisted_profile_url}"'
|
||||||
|
f'class="is_unlisted">{unlisted_author.name}</a>',
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_displayed_metadata(self):
|
def test_displayed_metadata(self):
|
||||||
|
|
|
@ -715,6 +715,8 @@ def review(request, addon, channel=None):
|
||||||
else []
|
else []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Addon._attach_authors([addon], listed=None, to_attr='current_authors')
|
||||||
|
|
||||||
ctx = context(
|
ctx = context(
|
||||||
# Used for reviewer subscription check, don't use global `is_reviewer`
|
# Used for reviewer subscription check, don't use global `is_reviewer`
|
||||||
# since that actually is `is_user_any_kind_of_reviewer`.
|
# since that actually is `is_user_any_kind_of_reviewer`.
|
||||||
|
|
|
@ -1197,6 +1197,15 @@ p.is_promoted {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.author .is_unlisted {
|
||||||
|
font-weight: 300;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.author .is_unlisted:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
#reviewers-score-bar {
|
#reviewers-score-bar {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 15px;
|
margin-bottom: 15px;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче