diff --git a/taiga/projects/history/services.py b/taiga/projects/history/services.py index 10b63bdf..53e36a66 100644 --- a/taiga/projects/history/services.py +++ b/taiga/projects/history/services.py @@ -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}, diff --git a/tests/integration/test_project_history.py b/tests/integration/test_project_history.py index 0631d338..42d0476f 100644 --- a/tests/integration/test_project_history.py +++ b/tests/integration/test_project_history.py @@ -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 +