diff --git a/taiga/projects/notifications/squashing.py b/taiga/projects/notifications/squashing.py index bd7ca66f..13ff9b3b 100644 --- a/taiga/projects/notifications/squashing.py +++ b/taiga/projects/notifications/squashing.py @@ -29,7 +29,6 @@ EXCLUDED_FIELDS = ( NON_SQUASHABLE_FIELDS = ( 'points', 'attachments', - 'tags', 'watchers', 'description_diff', 'content_diff', @@ -49,9 +48,14 @@ def summary(field, entries): if len(entries) <= 1: return entries + # Apply squashing algorithm. In this case, get first `from` and last `to`. initial = entries[0].values_diff[field] final = entries[-1].values_diff[field] from_, to = initial[0], final[1] + + # If the resulting squashed `from` and `to` are equal we can skip + # this entry completely + return [] if from_ == to else [HistoryEntry('', {field: [from_, to]})] diff --git a/tests/unit/test_notifications_squashing.py b/tests/unit/test_notifications_squashing.py index a481d6f8..bb6b6228 100644 --- a/tests/unit/test_notifications_squashing.py +++ b/tests/unit/test_notifications_squashing.py @@ -84,3 +84,16 @@ def test_squash_values_diff_with_multiple_fields(): squashed = squashing.squash_history_entries(history_entries) assert_(expected, squashed, ordered=False) + + +def test_squash_arrays(): + history_entries = [ + squashing.HistoryEntry(comment='', values_diff={'tags': [['A', 'B'], ['A']]}), + squashing.HistoryEntry(comment='', values_diff={'tags': [['A'], ['A', 'C']]}), + ] + expected = [ + squashing.HistoryEntry(comment='', values_diff={'tags': [['A', 'B'], ['A', 'C']]}), + ] + + squashed = squashing.squash_history_entries(history_entries) + assert_(expected, squashed, ordered=False)