#601 Remove FMN handling
Opened 6 years ago by shaily. Modified 6 years ago
shaily/fedora-hubs develop  into  develop

file modified
-9
@@ -47,15 +47,6 @@ 

              log.debug("  Dropping junk %r", topic)

              return

  

-     # Handle user notifications.

-     # XXX: use the proper topic pattern when it's chosen

-     if ".fmn.notification." in topic:

-         yield retask.task.Task(json.dumps({

-             'type': 'notification',

-             'msg': msg,

-         }))

-         return  # Notifications don't appear anywhere else, stop here.

- 

      # Handle FAS changes.

      if '.fas.group.member.' in topic:

          hub = hubs.models.Hub.by_name(msg["msg"]["group"], "team")

file modified
-9
@@ -121,15 +121,6 @@ 

                      item["idx"],

                      "hub/{}".format(item["hub"]),

                  )

-             elif item_type == "notification":

-                 hubs.feed.on_new_notification(item["msg"])

-                 username = fedmsg.meta.msg2agent(item["msg"])

-                 add_sse_task(

-                     sse_queue,

-                     "hubs:new-notification",

-                     username,

-                     "user/{}".format(username),

-                 )

              elif item_type == "sync-team-hub":

                  with hubs.app.app.app_context():  # so url_for works

                      affected_users = fas.sync_team_hub(

file modified
+3 -29
@@ -7,9 +7,8 @@ 

  

  from hubs.app import app

  from hubs.models import User, Hub, Association

- from hubs.feed import (

-     Notifications, Activity, add_notif_id, format_msgs, get_hubs_for_msg,

-     on_new_message, on_new_notification)

+ from hubs.feed import (Activity, add_notif_id, format_msgs,

+                        get_hubs_for_msg, on_new_message)

  from hubs.tests import APPTest

  

  
@@ -18,7 +17,6 @@ 

      def setUp(self):

          super(FeedTest, self).setUp()

          self.feed_classes = [

-             (Notifications, "notif"),

              (Activity, "activity"),

              ]

  
@@ -67,9 +65,7 @@ 

              feed.db.insert_one.assert_called_once()

              insert_call_args = feed.db.insert_one.call_args_list[0][0]

              inserted_msg = json.loads(insert_call_args[0]["msg"])

-             if feed_class == Notifications:

-                 self.assertIn("msg_ids", inserted_msg)

-             elif feed_class == Activity:

+             if feed_class == Activity:

                  self.assertEqual(inserted_msg, msg)

  

      def test_length(self):
@@ -100,28 +96,6 @@ 

          self.assertEqual(feed.add.call_count, 2)

          feed.add.assert_called_with(msg)

  

-     @patch("hubs.feed.Notifications")

-     def test_on_new_notification(self, mock_notifications):

-         feed = Mock()

-         mock_notifications.return_value = feed

-         msg = {"msg_id": "testmsg"}

-         with patch("hubs.feed.fedmsg.meta.msg2agent") as msg2agent:

-             msg2agent.return_value = "ralph"

-             on_new_notification(msg)

-         msg2agent.assert_called()

-         stream = Hub.by_name("ralph", "stream")

-         mock_notifications.assert_called_with(stream.id)

-         feed.add.assert_called_with(msg)

- 

-     @patch("hubs.feed.Notifications")

-     def test_on_new_notification_unknown_user(self, mock_notifications):

-         with patch("hubs.feed.fedmsg.meta.msg2agent") as msg2agent:

-             msg2agent.return_value = "unknown_user"

-             on_new_notification({"msg_id": "testmsg"})

-         msg2agent.assert_called()

-         # User does not exist, no feed instance should have been created.

-         mock_notifications.assert_not_called()

- 

      def test_add_notif_id(self):

          msg = {

              "msg_ids": {

@@ -40,12 +40,10 @@ 

  

  

  export const WIDGET_NEEDS_UPDATE = 'WIDGET_NEEDS_UPDATE';

- export const NEW_NOTIFICATION = 'NEW_NOTIFICATION';

  export const MESSAGE_TYPES = [

    "hubs:widget-updated",

    "hubs:user-updated",

    "hubs:hub-updated",

-   "hubs:new-notification",

  ];

  

  export function sseEvent(type, data) {
@@ -68,13 +66,6 @@ 

          break;

        case "hubs:hub-updated":

          return dispatch(fetchHub());

-       case "hubs:new-notification":

-         // TODO: implement the reducers for this action

-         const username = data;

-         return dispatch({

-           type: NEW_NOTIFICATION,

-           username,

-         });

        default:

          return;

      }