From 40565e82ae2ab3eb15d0d8f1dd08008a6f6c71bf Mon Sep 17 00:00:00 2001
From: rr- <rr-@sakuya.pl>
Date: Sun, 12 Jun 2016 14:12:00 +0200
Subject: [PATCH] server/posts: change comment-time behavior

Rather than looking at the edit time, now it looks at the creation time.
---
 server/szurubooru/search/configs/post_search_config.py      | 4 ++--
 .../tests/search/configs/test_post_search_config.py         | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/server/szurubooru/search/configs/post_search_config.py b/server/szurubooru/search/configs/post_search_config.py
index 2cd381c5..1039cf6a 100644
--- a/server/szurubooru/search/configs/post_search_config.py
+++ b/server/szurubooru/search/configs/post_search_config.py
@@ -167,7 +167,7 @@ class PostSearchConfig(BaseSearchConfig):
             ('last-edit-date', 'last-edit-time', 'edit-date', 'edit-time'):
                 search_util.create_date_filter(db.Post.last_edit_time),
             ('comment-date', 'comment-time'):
-                search_util.create_date_filter(db.Post.last_comment_edit_time),
+                search_util.create_date_filter(db.Post.last_comment_creation_time),
             ('fav-date', 'fav-time'):
                 search_util.create_date_filter(db.Post.last_favorite_time),
             ('feature-date', 'feature-time'):
@@ -196,7 +196,7 @@ class PostSearchConfig(BaseSearchConfig):
             ('last-edit-date', 'last-edit-time', 'edit-date', 'edit-time'):
                 (db.Post.last_edit_time, self.SORT_DESC),
             ('comment-date', 'comment-time'):
-                (db.Post.last_comment_edit_time, self.SORT_DESC),
+                (db.Post.last_comment_creation_time, self.SORT_DESC),
             ('fav-date', 'fav-time'):
                 (db.Post.last_favorite_time, self.SORT_DESC),
             ('feature-date', 'feature-time'):
diff --git a/server/szurubooru/tests/search/configs/test_post_search_config.py b/server/szurubooru/tests/search/configs/test_post_search_config.py
index 035e7708..55b24a84 100644
--- a/server/szurubooru/tests/search/configs/test_post_search_config.py
+++ b/server/szurubooru/tests/search/configs/test_post_search_config.py
@@ -420,9 +420,9 @@ def test_filter_by_comment_date(
     comment1 = comment_factory(post=post1)
     comment2 = comment_factory(post=post2)
     comment3 = comment_factory(post=post3)
-    comment1.last_edit_time = datetime.datetime(2014, 1, 1)
-    comment2.last_edit_time = datetime.datetime(2015, 1, 1)
-    comment3.last_edit_time = datetime.datetime(2016, 1, 1)
+    comment1.creation_time = datetime.datetime(2014, 1, 1)
+    comment2.creation_time = datetime.datetime(2015, 1, 1)
+    comment3.creation_time = datetime.datetime(2016, 1, 1)
     db.session.add_all([post1, post2, post3, comment1, comment2, comment3])
     verify_unpaged(input, expected_post_ids)