From 3168a46a00c41cc1c8fd219aa4600155e5717fc2 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jun 12 2018 12:16:33 +0000 Subject: [PATCH 1/5] fix formatting on the waiting pages Fixes #3292 Signed-off-by: Ryan Lerch --- diff --git a/pagure/templates/waiting.html b/pagure/templates/waiting.html index 45aab3c..dbe0a72 100644 --- a/pagure/templates/waiting.html +++ b/pagure/templates/waiting.html @@ -5,24 +5,25 @@ {% block content %}
-
-
-
- Waiting -
-
-

- We are waiting for your task to finish. - This page should be refreshed automatically, but if not click - Here -

-

- Your task is currently {{ task.status }} -

- +
+
+
+
+

+ Waiting +

+

+ We are waiting for your task to finish. + This page should be refreshed automatically, but if not click + Here +

+

+ Your task is currently {{ task.status }} +

+
@@ -53,6 +54,7 @@ function check_task_status(){ _cnt = res.count; if (_cnt > 30) { $('#slow').show(); + $('.alert.alert-info').toggleClass("alert-info alert-warning"); } $('#status').text(res.status); window.setTimeout(check_task_status, _delay); diff --git a/pagure/templates/waiting_post.html b/pagure/templates/waiting_post.html index 8c16132..80c7150 100644 --- a/pagure/templates/waiting_post.html +++ b/pagure/templates/waiting_post.html @@ -5,31 +5,32 @@ {% block content %}
-
-
-
- Waiting -
-
-
- - {% for field in form_data %} - - {% endfor %} - {{ csrf }} -

- We are waiting for your task to finish. - This page should be refreshed automatically, but if not click - . -

- - -
+
+
+
+
+

+ Waiting +

+
+ + {% for field in form_data %} + + {% endfor %} + {{ csrf }} +

+ We are waiting for your task to finish. + This page should be refreshed automatically, but if not click + . +

+ + +
@@ -62,6 +63,7 @@ _cnt = res.count; if (_cnt > 30) { $('#slow').show(); + $('.alert.alert-info').toggleClass("alert-info alert-warning"); } $('#status').text(res.status); $('#status_p').show(); From b2402519bf39274a7edfc6643a89eeeea655b4b1 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jun 12 2018 12:16:33 +0000 Subject: [PATCH 2/5] fix the test_block_user test --- diff --git a/tests/test_pagure_admin.py b/tests/test_pagure_admin.py index ea6a0a6..d554344 100644 --- a/tests/test_pagure_admin.py +++ b/tests/test_pagure_admin.py @@ -1379,6 +1379,7 @@ class PagureBlockUserTests(tests.Modeltests): user = pagure.lib.get_user(self.session, 'pingou') self.assertIsNone(user.refuse_sessions_before) + @patch('pagure.cli.admin._ask_confirmation', MagicMock(return_value=True)) def test_block_user(self): """ Test the block-user function of pagure-admin when all arguments are provided correctly. From aab6e24b52c967f7c5a20c4158d1fc1ffd96e97d Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jun 12 2018 12:16:33 +0000 Subject: [PATCH 3/5] add a full stop after the waiting message. --- diff --git a/pagure/templates/waiting.html b/pagure/templates/waiting.html index dbe0a72..06a675c 100644 --- a/pagure/templates/waiting.html +++ b/pagure/templates/waiting.html @@ -22,7 +22,7 @@ Your task is currently {{ task.status }}

diff --git a/pagure/templates/waiting_post.html b/pagure/templates/waiting_post.html index 80c7150..de45a04 100644 --- a/pagure/templates/waiting_post.html +++ b/pagure/templates/waiting_post.html @@ -28,7 +28,7 @@ Your task is currently

From dd63e40cd3bba13cf2998e09b7d3b0c01268b4d8 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 12 2018 12:16:33 +0000 Subject: [PATCH 4/5] Fix setting the refuse_sessions_before, it requires a datetime object Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/cli/admin.py b/pagure/cli/admin.py index 8b3d9ea..f12da50 100644 --- a/pagure/cli/admin.py +++ b/pagure/cli/admin.py @@ -799,7 +799,7 @@ def do_block_user(args): if not _ask_confirmation(): return - user.refuse_sessions_before = date + user.refuse_sessions_before = date.datetime session.add(user) session.commit() From 4c9301268092f2d93ae3e34ee4ffec04d36b3f40 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jun 12 2018 12:16:33 +0000 Subject: [PATCH 5/5] Fix a flake8 error and a test for pagure-admin block-user Signed-off-by: Pierre-Yves Chibon --- diff --git a/pagure/cli/admin.py b/pagure/cli/admin.py index f12da50..f112faf 100644 --- a/pagure/cli/admin.py +++ b/pagure/cli/admin.py @@ -795,7 +795,7 @@ def do_block_user(args): user = pagure.lib.get_user(session, args.username) print('The user `%s` will be blocked from all interaction with this ' - 'pagure instance until: %s.', user.username, date.isoformat()) + 'pagure instance until: %s.', user.username, date.isoformat()) if not _ask_confirmation(): return diff --git a/tests/test_pagure_admin.py b/tests/test_pagure_admin.py index d554344..0638cf6 100644 --- a/tests/test_pagure_admin.py +++ b/tests/test_pagure_admin.py @@ -1393,7 +1393,7 @@ class PagureBlockUserTests(tests.Modeltests): pagure.cli.admin.do_block_user(args) user = pagure.lib.get_user(self.session, 'pingou') - self.assertIsNone(user.refuse_sessions_before) + self.assertIsNotNone(user.refuse_sessions_before) if __name__ == '__main__':