From 9e5f37952c54da6d9c3a612aeb1da16c8bc263b3 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jan 25 2018 00:29:11 +0000 Subject: remove about widget the about for a user functionality was moved into the hub header, so no real need for this widget anymore. We also have the sticky widget for free-form text on a hub still too. --- diff --git a/hubs/default_config.py b/hubs/default_config.py index 1ee9a73..9bb6573 100644 --- a/hubs/default_config.py +++ b/hubs/default_config.py @@ -56,7 +56,6 @@ EMAIL_HOST = "localhost" EMAIL_PORT = 25 WIDGETS = [ - 'hubs.widgets.about:About', 'hubs.widgets.badges:Badges', 'hubs.widgets.bugzilla:Bugzilla', 'hubs.widgets.library:Library', diff --git a/hubs/tests/__init__.py b/hubs/tests/__init__.py index 53ae181..f85d4cb 100644 --- a/hubs/tests/__init__.py +++ b/hubs/tests/__init__.py @@ -77,7 +77,7 @@ class APPTest(unittest.TestCase): hub = hubs.models.Hub.by_name('ralph', "user") widget = hubs.models.Widget( - plugin='about', + plugin='sticky', index=500, _config=json.dumps({"text": "Testing."}), ) diff --git a/hubs/tests/test_widget_base.py b/hubs/tests/test_widget_base.py index bc3d8ad..cbade4a 100644 --- a/hubs/tests/test_widget_base.py +++ b/hubs/tests/test_widget_base.py @@ -152,32 +152,32 @@ class WidgetTest(APPTest): self.assertEqual(rules[0].rule, "/widgets/testing//test-2") def test_get_props(self): - widget = widget_instance('ralph', "about") + widget = widget_instance('ralph', "sticky") with app.test_request_context('/'): props = widget.get_props() self.assertDictEqual(props, { 'config': {'text': 'Testing.'}, - 'contentUrl': '/widgets/about/{}/'.format(widget.idx), + 'contentUrl': '/widgets/sticky/{}/'.format(widget.idx), 'cssClass': None, 'hiddenIfEmpty': False, 'hub_types': HUB_TYPES, 'idx': widget.idx, 'index': 500, 'isReact': False, - 'isLarge': False, - 'label': 'About', - 'name': 'about', + 'isLarge': True, + 'label': 'Sticky Note', + 'name': 'sticky', 'params': [ - {'default': 'I am a Fedora user, and this is my about', - 'help': 'Text about a user.', + {'default': 'Lorem ipsum dolor...', + 'help': 'Some dummy text to display.', 'label': 'Text', 'name': 'text', - 'renderTag': 'input', - 'renderAttributes': {'type': 'text'}, + 'renderTag': 'textarea', + 'renderAttributes': {'rows': '30'}, }, ], 'position': 'right', 'selfUrl': '/api/hubs/{}/widgets/{}/'.format( widget.hub.id, widget.idx), - 'title': 'About', + 'title': None, }) diff --git a/hubs/tests/test_widget_caching.py b/hubs/tests/test_widget_caching.py index 076bb87..5827e74 100644 --- a/hubs/tests/test_widget_caching.py +++ b/hubs/tests/test_widget_caching.py @@ -28,7 +28,7 @@ class CachedFunctionTest(APPTest): replace_existing_backend=True) self.w_instance = Widget.query.filter( Hub.name == "ralph", - Widget.plugin == "about", + Widget.plugin == "sticky", ).one() self.fn = DummyFunction(self.w_instance) cache.delete(self.fn.get_cache_key()) diff --git a/hubs/tests/utils/test_views.py b/hubs/tests/utils/test_views.py index aae8ba6..835041c 100644 --- a/hubs/tests/utils/test_views.py +++ b/hubs/tests/utils/test_views.py @@ -56,7 +56,7 @@ class ViewUtilsTest(APPTest): def test_move_widget(self): hub = Hub(name="testing", hub_type="team") self.session.add(hub) - widget_names = ["about", "badges", "bugzilla", "my_hubs", "sticky"] + widget_names = ["meetings", "badges", "bugzilla", "my_hubs", "sticky"] def get_names(): return [ @@ -83,23 +83,23 @@ class ViewUtilsTest(APPTest): # From middle to middle forwards check_move( "badges", 3, - ["about", "bugzilla", "my_hubs", "badges", "sticky"]) + ["meetings", "bugzilla", "my_hubs", "badges", "sticky"]) # From middle to middle backwards check_move( "badges", 1, - ["about", "badges", "bugzilla", "my_hubs", "sticky"]) + ["meetings", "badges", "bugzilla", "my_hubs", "sticky"]) # From middle to start check_move( "my_hubs", 0, - ["my_hubs", "about", "badges", "bugzilla", "sticky"]) + ["my_hubs", "meetings", "badges", "bugzilla", "sticky"]) # From middle to end check_move( "badges", 5, - ["my_hubs", "about", "bugzilla", "sticky", "badges"]) + ["my_hubs", "meetings", "bugzilla", "sticky", "badges"]) # From start to end check_move( "my_hubs", 5, - ["about", "bugzilla", "sticky", "badges", "my_hubs"]) + ["meetings", "bugzilla", "sticky", "badges", "my_hubs"]) def test_move_widget_disabled(self): # Make sure moving works even if there are disabled widgets diff --git a/hubs/tests/views/test_api_hub_widget.py b/hubs/tests/views/test_api_hub_widget.py index be4a286..ee5a57c 100644 --- a/hubs/tests/views/test_api_hub_widget.py +++ b/hubs/tests/views/test_api_hub_widget.py @@ -14,7 +14,7 @@ class TestAPIHubWidgets(APPTest): def test_get_widgets(self): hub = Hub.by_name('ralph', "user") expected_widgets = [ - 'feed', 'my_hubs', 'badges', 'about', + 'feed', 'my_hubs', 'badges', 'sticky', ] response = self.check_url("/api/hubs/%s/widgets/" % hub.id) response_data = json.loads(response.get_data(as_text=True)) @@ -178,9 +178,9 @@ class TestAPIHubWidgets(APPTest): def test_post_valid_widget_name_with_config(self): hub = Hub.by_name("ralph", "user") self.assertEqual( - Widget.query.filter_by(hub=hub, plugin="about").count(), 1) + Widget.query.filter_by(hub=hub, plugin="sticky").count(), 1) data = { - "name": "about", + "name": "sticky", "config": {'text': 'text of widget'}, 'position': 'right', } @@ -195,7 +195,7 @@ class TestAPIHubWidgets(APPTest): json.loads(result.get_data(as_text=True)), {"status": "OK"}) self.assertEqual( - Widget.query.filter_by(hub=hub, plugin="about").count(), 2) + Widget.query.filter_by(hub=hub, plugin="sticky").count(), 2) def test_post_invalid_config(self): hub = Hub.by_name("ralph", "user") diff --git a/hubs/tests/widgets/test_about.py b/hubs/tests/widgets/test_about.py deleted file mode 100644 index 703af25..0000000 --- a/hubs/tests/widgets/test_about.py +++ /dev/null @@ -1,10 +0,0 @@ -from __future__ import unicode_literals - -from . import WidgetTest - - -class TestAbout(WidgetTest): - plugin = 'about' # The name in hubs.widgets.registry - - def test_view_authz(self): - self._test_view_authz() diff --git a/hubs/widgets/about/__init__.py b/hubs/widgets/about/__init__.py deleted file mode 100644 index 4610541..0000000 --- a/hubs/widgets/about/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -from __future__ import unicode_literals - -from hubs.utils import validators -from hubs.widgets.base import Widget -from hubs.widgets.view import RootWidgetView - - -class About(Widget): - - name = "about" - position = "both" - parameters = [dict( - name="text", - label="Text", - default="I am a Fedora user, and this is my about", - validator=validators.Text, - help="Text about a user.", - )] - - -class BaseView(RootWidgetView): - - def get_context(self, instance, *args, **kwargs): - return dict( - text=instance.config["text"], - ) diff --git a/hubs/widgets/about/templates/root.html b/hubs/widgets/about/templates/root.html deleted file mode 100644 index 9089da2..0000000 --- a/hubs/widgets/about/templates/root.html +++ /dev/null @@ -1 +0,0 @@ -

{{text}}