Display version notes w versions (bug 663250)
This commit is contained in:
Родитель
6dd59ee7a9
Коммит
daf77bec9e
|
@ -161,6 +161,7 @@ class APPROVE_VERSION(_LOG):
|
|||
id = 21
|
||||
action_class = 'approve'
|
||||
format = _(u'{addon} {version} approved.')
|
||||
short = _(u'Approved')
|
||||
keep = True
|
||||
review_email_user = True
|
||||
review_queue = True
|
||||
|
@ -170,6 +171,7 @@ class PRELIMINARY_VERSION(_LOG):
|
|||
id = 42
|
||||
action_class = 'approve'
|
||||
format = _(u'{addon} {version} given preliminary review.')
|
||||
short = _(u'Preliminarily approved')
|
||||
keep = True
|
||||
review_email_user = True
|
||||
review_queue = True
|
||||
|
@ -180,6 +182,7 @@ class REJECT_VERSION(_LOG):
|
|||
id = 43
|
||||
action_class = 'reject'
|
||||
format = _(u'{addon} {version} rejected.')
|
||||
short = _(u'Rejected')
|
||||
keep = True
|
||||
review_email_user = True
|
||||
review_queue = True
|
||||
|
@ -190,6 +193,7 @@ class RETAIN_VERSION(_LOG):
|
|||
id = 22
|
||||
action_class = None
|
||||
format = _(u'{addon} {version} retained.')
|
||||
short = _(u'Retained')
|
||||
keep = True
|
||||
review_email_user = True
|
||||
review_queue = True
|
||||
|
@ -200,6 +204,7 @@ class ESCALATE_VERSION(_LOG):
|
|||
id = 23
|
||||
action_class = None
|
||||
format = _(u'{addon} {version} escalated.')
|
||||
short = _(u'Escalated')
|
||||
keep = True
|
||||
review_email_user = True
|
||||
review_queue = True
|
||||
|
@ -210,6 +215,7 @@ class REQUEST_VERSION(_LOG):
|
|||
id = 24
|
||||
action_class = None
|
||||
format = _(u'{addon} {version} review requested.')
|
||||
short = _(u'Review requested')
|
||||
keep = True
|
||||
review_email_user = True
|
||||
review_queue = True
|
||||
|
@ -219,6 +225,7 @@ class REQUEST_INFORMATION(_LOG):
|
|||
id = 44
|
||||
action_class = None
|
||||
format = _(u'{addon} {version} more information requested.')
|
||||
short = _(u'More information requested')
|
||||
keep = True
|
||||
review_email_user = True
|
||||
review_queue = True
|
||||
|
@ -228,6 +235,7 @@ class REQUEST_SUPER_REVIEW(_LOG):
|
|||
id = 45
|
||||
action_class = None
|
||||
format = _(u'{addon} {version} super review requested.')
|
||||
short = _(u'Super review requested')
|
||||
keep = True
|
||||
review_queue = True
|
||||
|
||||
|
@ -236,6 +244,7 @@ class COMMENT_VERSION(_LOG):
|
|||
id = 49
|
||||
action_class = None
|
||||
format = _(u'Comment on {addon} {version}.')
|
||||
short = _(u'Comment')
|
||||
keep = True
|
||||
review_queue = True
|
||||
|
||||
|
|
|
@ -262,6 +262,10 @@ class ActivityLog(amo.models.ModelBase):
|
|||
def details(self, data):
|
||||
self._details = json.dumps(data)
|
||||
|
||||
@property
|
||||
def log(self):
|
||||
return amo.LOG_BY_ID[self.action]
|
||||
|
||||
# TODO(davedash): Support other types.
|
||||
def to_string(self, type=None):
|
||||
log_type = amo.LOG_BY_ID[self.action]
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<li>
|
||||
<strong>{{ record }}</strong>
|
||||
{% if record.details %}
|
||||
<div class="history-comment">{{ record.details.comments }}</div>
|
||||
{% endif %}
|
||||
<div class="history-comment-byline light">
|
||||
<tr>
|
||||
<th>
|
||||
{{ record.log.short }}
|
||||
</th>
|
||||
<td>
|
||||
{% trans user = record.user|user_link, date = record.created|babel_datetime %}
|
||||
By {{ user }} on {{ date }}
|
||||
<div>By {{ user }} on {{ date }}</div>
|
||||
{% endtrans %}
|
||||
</div>
|
||||
</li>
|
||||
{% if record.details %}
|
||||
<div class="light history-comment">{{ record.details.comments }}</div>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
{% endtrans %}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="listing-body">
|
||||
<td class="files">
|
||||
<div><strong>{{ _('Files in this version:') }}</strong></div>
|
||||
{% for file in version.all_files %}
|
||||
|
@ -95,19 +95,26 @@
|
|||
{% endfor %}
|
||||
</td>
|
||||
<td>
|
||||
{% set records = version.all_activity %}
|
||||
{% if records %}
|
||||
<ul class="activity">
|
||||
{% for record_version in records %}
|
||||
{% set record = record_version.activity_log %}
|
||||
{% include 'editors/includes/history.html' %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<div class="no-activity">
|
||||
{{ _('This version has not been reviewed.') }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<table class="activity">
|
||||
{% if version.releasenotes %}
|
||||
<tr>
|
||||
<th>{{ _('Version Notes') }}</th>
|
||||
<td class="activity_version">{{ version.releasenotes|nl2br }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% set records = version.all_activity %}
|
||||
{% for record_version in records %}
|
||||
{% set record = record_version.activity_log %}
|
||||
{% include 'editors/includes/history.html' %}
|
||||
{% endfor %}
|
||||
{% if not version.releasenotes and not records %}
|
||||
<tr>
|
||||
<td class="no-activity">
|
||||
{{ _('This version has not been reviewed.') }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
@ -1446,21 +1446,35 @@ class TestReview(ReviewBase):
|
|||
doc = pq(r.content)
|
||||
|
||||
# View the history verify two versions:
|
||||
ths = doc('table#review-files tr th:first-child')
|
||||
ths = doc('table#review-files > tr > th:first-child')
|
||||
|
||||
assert '0.1' in ths.eq(0).text()
|
||||
assert '0.2' in ths.eq(1).text()
|
||||
|
||||
for i in [0, 2]:
|
||||
tds = doc('table#review-files tr td')
|
||||
eq_(tds.eq(i).find('strong').eq(0).text(), "Files in this version:")
|
||||
tds = doc('table#review-files > tr > td')
|
||||
eq_(tds.eq(i).find('strong').eq(0).text(),
|
||||
"Files in this version:")
|
||||
eq_(tds.eq(i).find('div').length, 3)
|
||||
|
||||
eq_(tds.eq(1).find('table td').length, 1)
|
||||
|
||||
eq_(tds.eq(1).find('ul li').length, 1)
|
||||
eq_(tds.eq(1).find('ul li a').length, 3)
|
||||
eq_(tds.eq(1).find('.history-comment').text(), "something")
|
||||
eq_(tds.eq(1).find('th').text(), "Preliminarily approved")
|
||||
eq_(tds.eq(1).find('td a').text(), "An editor")
|
||||
|
||||
eq_(tds.eq(1).find('ul li .history-comment').text(), "something")
|
||||
eq_(tds.eq(1).find('ul li div a').text(), "An editor")
|
||||
def test_item_history_version(self):
|
||||
v = self.addon.versions.all()[0]
|
||||
v.releasenotes = 'hi'
|
||||
v.save()
|
||||
|
||||
url = reverse('editors.review', args=[self.addon.slug])
|
||||
|
||||
r = self.client.get(url)
|
||||
doc = pq(r.content)
|
||||
|
||||
eq_(doc('#review-files .activity_version').length, 1)
|
||||
eq_(doc('#review-files .activity_version').text(), 'hi')
|
||||
|
||||
def test_item_history_comment(self):
|
||||
# Add Comment
|
||||
|
@ -1472,10 +1486,9 @@ class TestReview(ReviewBase):
|
|||
r = self.client.get(self.url)
|
||||
doc = pq(r.content)
|
||||
|
||||
td = doc('#review-files td').eq(1)
|
||||
|
||||
assert td.find('strong').eq(0).text().startswith('Comment on')
|
||||
eq_(td.find('.history-comment').text(), "hello sailor")
|
||||
eq_(doc('#review-files th').eq(1).text(), 'Comment')
|
||||
eq_(doc('#review-files .history-comment').eq(0).text(), "hello sailor")
|
||||
|
||||
def test_files_in_item_history(self):
|
||||
data = {'action': 'public', 'operating_systems': 'win',
|
||||
|
@ -1495,8 +1508,10 @@ class TestReview(ReviewBase):
|
|||
def test_no_items(self):
|
||||
response = self.client.get(self.url)
|
||||
doc = pq(response.content)
|
||||
div = doc('#review-files-header').next().find('td').eq(1).find('div')
|
||||
eq_(div.text(), "This version has not been reviewed.")
|
||||
|
||||
eq_(doc('#review-files .no-activity').length, 1)
|
||||
eq_(doc('#review-files .no-activity').text(),
|
||||
"This version has not been reviewed.")
|
||||
|
||||
def test_hide_beta(self):
|
||||
version = self.addon.latest_version
|
||||
|
@ -1617,7 +1632,7 @@ class TestReview(ReviewBase):
|
|||
doc = pq(r.content)
|
||||
|
||||
# View the history verify two versions:
|
||||
ths = doc('table#review-files tr th:first-child')
|
||||
ths = doc('table#review-files > tr > th:first-child')
|
||||
assert '0.1' in ths.eq(0).text()
|
||||
assert '0.2' in ths.eq(1).text()
|
||||
|
||||
|
@ -1626,9 +1641,9 @@ class TestReview(ReviewBase):
|
|||
# Verify two versions, one deleted:
|
||||
r = self.client.get(url)
|
||||
doc = pq(r.content)
|
||||
ths = doc('table#review-files tr th:first-child')
|
||||
ths = doc('table#review-files > tr > th:first-child')
|
||||
|
||||
eq_(doc('table#review-files tr th:first-child').length, 1)
|
||||
eq_(doc('table#review-files > tr > th:first-child').length, 1)
|
||||
assert '0.1' in ths.eq(0).text()
|
||||
|
||||
def review_version(self, version, url):
|
||||
|
|
|
@ -553,18 +553,20 @@ div.editor-stats-table > div.editor-stats-dark {
|
|||
top: -20px;
|
||||
width: auto;
|
||||
}
|
||||
#review-files td .activity li {
|
||||
border-top: 1px dotted #DDDDDD;
|
||||
margin: 1em 1em 0;
|
||||
padding-top: 1em;
|
||||
#review-files table.activity {
|
||||
margin: 0 10px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#review-files td .activity li:first-child {
|
||||
#review-files table.activity th {
|
||||
width: 25%;
|
||||
padding-right: 1em;
|
||||
}
|
||||
#review-files table.activity tr {
|
||||
border-top: 1px dotted #ccc;
|
||||
}
|
||||
#review-files table.activity tr:first-child {
|
||||
border-top: 0 none;
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
#review-files tr.listing-header:first-child {
|
||||
border-top: none;
|
||||
}
|
||||
|
@ -755,6 +757,9 @@ div.editor-stats-table > div.editor-stats-dark {
|
|||
|
||||
.history-comment {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.history-comment, .history-comment-version {
|
||||
padding: 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
|
|
@ -140,9 +140,13 @@ function initReviewActions() {
|
|||
check_currently_viewing();
|
||||
|
||||
/* Item History */
|
||||
$('#review-files tr.listing-header').click(function() {
|
||||
$(this).next('tr.listing-body').toggle();
|
||||
});
|
||||
|
||||
var storage = z.Storage(),
|
||||
eh_setting = storage.get('editors_history'),
|
||||
eh_els = $('#review-files tr:not(.listing-header)'),
|
||||
eh_els = $('#review-files tr.listing-body'),
|
||||
eh_size = eh_els.length;
|
||||
if(!eh_setting) eh_setting = 1;
|
||||
|
||||
|
@ -151,9 +155,6 @@ function initReviewActions() {
|
|||
function toggleHistory() {
|
||||
eh_els.slice(eh_size - eh_setting, eh_setting).show();
|
||||
eh_els.slice(0, eh_size - eh_setting).hide();
|
||||
$('#review-files tr.listing-header').click(function() {
|
||||
$(this).next().toggle();
|
||||
});
|
||||
}
|
||||
|
||||
$('#editors_history').click(_pd(function() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче