public override void Execute() { var notifications = ActivityNotifications.GetByUserId(_userId).Select(n => new NotificationWrapper(n)).ToArray();; foreach (var notification in notifications) { if (notification.object_type == "activity_action") { var activity = ActivityActions.GetById(notification.object_id); Feed f = new Feed(new Activity(activity), notification.subject_id, notification.subject_type, false); notification._object = new ActivityActionWrapper(activity); notification.feed_title = f.feed_title; notification.action_type_body_params = f.action_type_body_params; notification.url = f.Subject.Url; } else { } } var response = new { recentUpdateTotalItemCount = notifications.Length, recentUpdates = notifications }; Response = JsonConvert.SerializeObject(response); }
protected virtual void RemoveActivityAction(ActivityAction action) { Activity activity = new Activity(action); activity.Source.ActivityFeed.RemoveActivity(activity, true); //remove it from the feeds ActivityCache.Instance.Remove(action.action_id); ActivityActions.Delete(action.action_id, deleteAttachments: true); HiddenActivities.RemoveForActivity(action.action_id); ActivityNotifications.RemoveForActivity(action.action_id); }
protected override void SendNotifications() { var notification = CreateNotification(); if (notification.subject_id == notification.user_id) { Logger.Instance.Debug($"user:{userId} will not be notified on his own actions"); return; } //Logger.Instance.Debug($"sending notification:{JsonConvert.SerializeObject(notification)}"); ActivityNotifications.Add(notification); }
protected virtual void SendNotifications() { return; //currently do nothing because notifications are made outside var notification = CreateNotification(); if (notification.subject_id == notification.user_id) { Logger.Instance.Debug($"user:{userId} will not be notified on his own actions"); return; } //Logger.Instance.Debug($"sending notification:{JsonConvert.SerializeObject(notification)}"); ActivityNotifications.Add(notification); }
protected override void SendNotifications() { base.SendNotifications(); //also send notifications for tagges users var composer = reqParams.GetComposer(); if (composer != null) { foreach (var taggedUser in composer.GetTaggedUsers()) { Logger.Instance.Debug($"sending notification to tagged user {taggedUser}"); var tagNotification = CreateNotification(); tagNotification.user_id = (uint)taggedUser; tagNotification.type = "tagged"; tagNotification.subject_id = userId; tagNotification.@params = "{\"object_type_name\":\"activity_comment\",\"label\":\"comment\"}"; ActivityNotifications.Add(tagNotification); } } }
public void TestActivityNotifications2(int[] test1, int days) { var result = ActivityNotifications.Solution(test1, days); result.Should().Be(1); }