def put(): """Will mark all clusters selected by the filter as read.""" attrs = mark_as_read_parser.parse_args() filters = _get_filters(attrs) clu_ctrl = ClusterController(current_identity.id) clusters = [ clu for clu in clu_ctrl.join_read(limit=None, **filters) if not attrs.get("only_singles") or len(clu["feeds_id"]) == 1 ] if clusters: clu_ctrl.update({'id__in': [clu['id'] for clu in clusters]}, { 'read': True, 'read_reason': ReadReason.mass_marked }) READ.labels(ReadReason.mass_marked.value).inc(len(clusters)) return ClusterController(current_identity.id).get_unreads(), 200
def get(): """Will list all cluster extract for the middle pannel.""" attrs = filter_parser.parse_args() clu_ctrl = ClusterController(current_identity.id) return list(clu_ctrl.join_read(**_get_filters(attrs)))