Regression fix: history entry should not be marked as hidden ...

... when change comes with a comment.
remotes/origin/enhancement/email-actions
Andrey Antukh 2014-09-18 14:38:22 +02:00
parent 1dd5c4c768
commit 8df1b2a799
2 changed files with 26 additions and 1 deletions

View File

@ -276,7 +276,11 @@ def take_snapshot(obj:object, *, comment:str="", user=None, delete:bool=False):
return None
fvals = make_diff_values(typename, fdiff)
is_hidden = is_hidden_snapshot(fdiff)
if len(comment) > 0:
is_hidden = False
else:
is_hidden = is_hidden_snapshot(fdiff)
kwargs = {
"user": {"pk": user_id, "name": user_name},

View File

@ -197,3 +197,24 @@ def test_take_hidden_snapshot():
assert qs_all.count() == 2
assert qs_hidden.count() == 1
def test_history_with_only_comment_shouldnot_be_hidden(client):
project = f.create_project()
us = f.create_userstory(project=project)
qs_all = HistoryEntry.objects.all()
qs_hidden = qs_all.filter(is_hidden=True)
assert qs_all.count() == 0
url = reverse("userstories-detail", args=[us.pk])
data = json.dumps({"comment": "test comment", "version": us.version})
print(url, data)
client.login(project.owner)
response = client.patch(url, data, content_type="application/json")
assert response.status_code == 200, response.content
assert qs_all.count() == 1
assert qs_hidden.count() == 0