diff --git a/src/database/queries.py b/src/database/queries.py index 7dd780c..4d0cf90 100644 --- a/src/database/queries.py +++ b/src/database/queries.py @@ -73,7 +73,7 @@ def get_claim_comments(conn: sqlite3.Connection, claim_id: str, parent_id: str = } -def get_hidden_claim_comments(conn: sqlite3.Connection, claim_id: str, hidden=True, page=1, page_size=50): +def get_claim_hidden_comments(conn: sqlite3.Connection, claim_id: str, hidden=True, page=1, page_size=50): with conn: results = conn.execute( SELECT_COMMENTS_ON_CLAIMS + "WHERE claim_id = ? AND is_hidden = ? LIMIT ? OFFSET ?", diff --git a/src/server/handles.py b/src/server/handles.py index 662e13b..5951960 100644 --- a/src/server/handles.py +++ b/src/server/handles.py @@ -10,7 +10,7 @@ from src.server.misc import clean_input_params from src.database.queries import get_claim_comments from src.database.queries import get_comments_by_id, get_comment_ids from src.database.queries import get_channel_id_from_comment_id -from src.database.queries import get_hidden_claim_comments +from src.database.queries import get_claim_hidden_comments from src.server.misc import is_valid_base_comment from src.server.misc import is_valid_credential_input from src.server.misc import make_error @@ -43,8 +43,8 @@ def handle_get_comments_by_id(app, kwargs): return get_comments_by_id(app['reader'], **kwargs) -def handle_get_hidden_claim_comments(app, kwargs): - return get_hidden_claim_comments(app['reader'], **kwargs) +def handle_get_claim_hidden_comments(app, kwargs): + return get_claim_hidden_comments(app['reader'], **kwargs) async def handle_create_comment(app, params): @@ -66,7 +66,7 @@ async def handle_hide_comment(app, params): METHODS = { 'ping': ping, 'get_claim_comments': handle_get_claim_comments, - 'get_hidden_claim_comments': handle_get_hidden_claim_comments, + 'get_claim_hidden_comments': handle_get_claim_hidden_comments, 'get_comment_ids': handle_get_comment_ids, 'get_comments_by_id': handle_get_comments_by_id, 'get_channel_from_comment_id': handle_get_channel_from_comment_id, diff --git a/tests/database_test.py b/tests/database_test.py index 02050a0..ebf3477 100644 --- a/tests/database_test.py +++ b/tests/database_test.py @@ -8,7 +8,7 @@ from faker.providers import misc from src.database.queries import get_comments_by_id from src.database.queries import get_comment_ids from src.database.queries import get_claim_comments -from src.database.queries import get_hidden_claim_comments +from src.database.queries import get_claim_hidden_comments from src.database.writes import create_comment_or_error from src.database.queries import hide_comment_by_id from src.database.queries import delete_comment_by_id @@ -263,17 +263,17 @@ class ListDatabaseTest(DatabaseTestCase): self.assertFalse(comment_list['has_hidden_comments']) hide_comment_by_id(self.conn, comm2['comment_id']) - default_comments = get_hidden_claim_comments(self.conn, claim_id) + default_comments = get_claim_hidden_comments(self.conn, claim_id) self.assertIn('has_hidden_comments', default_comments) - hidden_comments = get_hidden_claim_comments(self.conn, claim_id, hidden=True) + hidden_comments = get_claim_hidden_comments(self.conn, claim_id, hidden=True) self.assertIn('has_hidden_comments', hidden_comments) self.assertEqual(default_comments, hidden_comments) hidden_comment = hidden_comments['items'][0] self.assertEqual(hidden_comment['comment_id'], comm2['comment_id']) - visible_comments = get_hidden_claim_comments(self.conn, claim_id, hidden=False) + visible_comments = get_claim_hidden_comments(self.conn, claim_id, hidden=False) self.assertIn('has_hidden_comments', visible_comments) self.assertNotIn(hidden_comment, visible_comments['items'])