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:
Christina Lin 2024-08-19 13:09:02 +01:00 коммит произвёл GitHub
Родитель 4a368cac59
Коммит cedcc4917e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
4 изменённых файлов: 36 добавлений и 13 удалений

Просмотреть файл

@ -25,8 +25,8 @@
{% endif %}
</h2>
<h4 class="author">by
{% for author in addon.listed_authors %}
<a href="{{ url('reviewers.developer_profile', author.id) }}">{{ author.name }}</a>{% if not loop.last %},{% endif %}
{% for author in addon.current_authors %}
<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 %}
</h4>
@ -470,13 +470,6 @@
<li><a href="#review-actions">Resolution</a></li>
</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>
<ul>
{% for category in addon.all_categories %}

Просмотреть файл

@ -2729,7 +2729,7 @@ class TestReview(ReviewBase):
# 7. current version + file
# 8. current version translations
# 9. current version applications versions
# 10. authors
# 10. add current_authors property to the addon instance
# 11. previews
# 12. promoted info for the add-on
# 13. latest version in channel + file
@ -5637,12 +5637,31 @@ class TestReview(ReviewBase):
another_author = user_factory()
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)
self.assertContains(response, another_author.name)
profile_url = reverse('reviewers.developer_profile', args=(another_author.id,))
self.assertContains(response, profile_url)
author_profile_url = reverse('reviewers.developer_profile', args=(author.id,))
another_profile_url = reverse(
'reviewers.developer_profile', args=(another_author.id,)
)
unlisted_profile_url = reverse(
'reviewers.developer_profile', args=(unlisted_author.id,)
)
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):

Просмотреть файл

@ -715,6 +715,8 @@ def review(request, addon, channel=None):
else []
)
Addon._attach_authors([addon], listed=None, to_attr='current_authors')
ctx = context(
# Used for reviewer subscription check, don't use global `is_reviewer`
# since that actually is `is_user_any_kind_of_reviewer`.

Просмотреть файл

@ -1197,6 +1197,15 @@ p.is_promoted {
text-align: center;
}
.author .is_unlisted {
font-weight: 300;
text-decoration: none;
}
.author .is_unlisted:hover {
text-decoration: underline;
}
#reviewers-score-bar {
display: block;
margin-bottom: 15px;