Unmute notifications for a status.

        Returns a `toot dict`_ with the status that used to be muted.
495493
def status_unmute(self, id):
        
        id = self.__unpack_id(id)
        url = '/api/v1/statuses/{0}/unmute'.format(str(id))
        return self.__api_request('POST', url)
1060615
def live_unread_notification_list(request):
    '''  '''
    try:
        user_is_authenticated = request.user.is_authenticated()
    except TypeError:  # Django >= 1.11
        user_is_authenticated = request.user.is_authenticated

    if not user_is_authenticated:
        data = {
            'unread_count': 0,
            'unread_list': []
        }
        return JsonResponse(data)

    default_num_to_fetch = get_config()['NUM_TO_FETCH']
    try:
        # If they don't specify, make it 5.
        num_to_fetch = request.GET.get('max', default_num_to_fetch)
        num_to_fetch = int(num_to_fetch)
        if not (1 <= num_to_fetch <= 100):
            num_to_fetch = default_num_to_fetch
    except ValueError:  # If casting to an int fails.
        num_to_fetch = default_num_to_fetch

    unread_list = []

    for notification in request.user.notifications.unread()[0:num_to_fetch]:
        struct = model_to_dict(notification)
        struct['slug'] = id2slug(notification.id)
        if notification.actor:
            struct['actor'] = str(notification.actor)
        if notification.target:
            struct['target'] = str(notification.target)
        if notification.action_object:
            struct['action_object'] = str(notification.action_object)
        if notification.data:
            struct['data'] = notification.data
        unread_list.append(struct)
        if request.GET.get('mark_as_read'):
            notification.mark_as_read()
    data = {
        'unread_count': request.user.notifications.unread().count(),
        'unread_list': unread_list
    }
    return JsonResponse(data)
1208132
def filter_silenced(self):
        '''
        
        '''
        stashes = [
            ('client', '/silence/{}'.format(self.event['client']['name'])),
            ('check', '/silence/{}/{}'.format(
                self.event['client']['name'],
                self.event['check']['name'])),
            ('check', '/silence/all/{}'.format(self.event['check']['name']))
        ]
        for scope, path in stashes:
            if self.stash_exists(path):
                self.bail(scope + ' alerts silenced')
1071208
def _as_decode(self, msg):
        """"""
        return {'armed_statuses': [x for x in msg[4:12]],
                'arm_up_states': [x for x in msg[12:20]],
                'alarm_states': [x for x in msg[20:28]]}
6875
def skip_status(*skipped):
  """"""
  def decorator(func):
    @functools.wraps(func)
    def _skip_status(self, *args, **kwargs):
      if self.status not in skipped:
        return func(self, *args, **kwargs)
    return _skip_status
  return decorator
286533
def nosound_notification(text, options = {})
      base = {
        aps: {
          alert: {
            title: nil,
            subtitle: nil,
            body: text
          },
          badge: 1,
          'mutable-content': 1,
          'content-available': 1
        }
      }
      base.merge(options)
    end
835817
def _unregister_hid_notification(self):
        ""
        if not int(self.__h_notify):
            return #invalid
        result          = UnregisterDeviceNotification(self.__h_notify)
        self.__h_notify = None
        return int(result)
1303044
def account_unmute(self, id):
        
        id = self.__unpack_id(id)
        url = '/api/v1/accounts/{0}/unmute'.format(str(id))
        return self.__api_request('POST', url)
1010425
def on_status(self, status):
        """"""
        self.out.write(json.dumps(status))
        self.out.write(os.linesep)

        self.received += 1
        return not self.terminate
842777
def clear_notify(self, messages):
        
        newpile = self._notificationbar.widget_list
        for l in messages:
            if l in newpile:
                newpile.remove(l)
        if newpile:
            self._notificationbar = urwid.Pile(newpile)
        else:
            self._notificationbar = None
        self.update()
676493
def _get_notifications_status(self, notifications):
        
        if notifications:
            size = len(notifications["activeNotifications"])
        else:
            size = 0
        status = self.status_notif if size > 0 else self.status_no_notif

        return (size, status)
306818
public function actionUnreadNotifications()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        if (Yii::$app->user->isGuest) {
            $total = 0;
        } else {
            $total = Notification::getDb()->cache(function ($db) {
                return Notification::find()->where(['to_user_id' => Yii::$app->user->id, 'status' => Notification::STATUS_UNREAD])->count();
            }, 60);
        }
        return ['total' => $total];
    }
1322957
def _report_status(self):
        
        for listener in self._status_listeners:
            try:
                listener.new_cast_status(self.status)
            except Exception:  # pylint: disable=broad-except
                self.logger.exception(
                    "Exception thrown when calling cast status listener")
281574
def normal_notification(text, options = {})
      base = {
        aps: {
          alert: {
            title: nil,
            subtitle: nil,
            body: text
          },
          sound: options.delete(:sound),
          badge: 1,
          'mutable-content': 1,
          'content-available': 1
        }
      }
      base.merge(options)
    end
967726
def stopMessage(self, apiMsgId):
        
        content =  self.parseLegacy(self.request('http/delmsg', {'apimsgid': apiMsgId}))

        return {
            'id': content['ID'],
            'status': content['Status'],
            'description': self.getStatus(content['Status'])
        }
447530
def getStatusMsg(self):
        

        if 'status' in self._response.keys():
            if (self._response['status'] is not None) and ('msg' in self._response['status'].keys()) and (self._response['status']['msg'] is not None):
                return self._response['status']['msg']
            else:
                return ''
209354
def _op_msg_uncompressed(flags, command, identifier, docs, check_keys, opts):
    """"""
    data, total_size, max_bson_size = _op_msg_no_header(
        flags, command, identifier, docs, check_keys, opts)
    request_id, op_message = __pack_message(2013, data)
    return request_id, op_message, total_size, max_bson_size