app.filter('dashboardServices', function () {

    var reduceArray = function (arr, condition1, condition2) {
        var resultingArr = [];
        if (condition1) {
            angular.forEach(arr, function (el) {
                if (el[condition2] || el.status === 'DOWN') {
                    resultingArr.push(el);
                }
            });
        } else {
            resultingArr = arr;
        }
        return resultingArr;
    };

    var filterByStatus = function (arr, filterStatus) {
      var filtered = [];
      var remaining = [];

      angular.forEach(arr, function (el) {
          if (el.status === filterStatus) {
            filtered.push(el);
          }
          else {
            remaining.push(el);
          }
        });

      return {
        'filtered': filtered,
        'remaining': remaining
      };
    };

    return function (services, options) {
        var shownServices = reduceArray(services, options.showPublic(), "isPublic");
        var byStatus = filterByStatus(shownServices, "MAINTENANCE");
        var shortList = reduceArray(byStatus.remaining, options.showShortList, "onShortList");
        return byStatus.filtered.concat(shortList);
    };

});

app.filter('dashboardServices', function () {

    var reduceArray = function (arr, condition1, condition2) {
        var resultingArr = [];
        if (condition1) {
            angular.forEach(arr, function (el) {
                if (el[condition2]) {
                    resultingArr.push(el);
                }
            });
        } else {
            resultingArr = arr;
        }
        return resultingArr;
    };

    var filterByStatus = function (arr, filterStatus) {
      var filtered = [];
      var remaining = [];

      angular.forEach(arr, function (el) {
          if (filterStatus.indexOf(el.status) >= 0) {
            filtered.push(el);
          }
          else {
            remaining.push(el);
          }
        });

      return {
        'filtered': filtered,
        'remaining': remaining
      };
    };

    return function (services, options) {
        var shownServices = reduceArray(services, options.showPublic(), "isPublic");
        var byStatus = filterByStatus(shownServices, ["MAINTENANCE", "DOWN"]);
        var shortList = reduceArray(byStatus.remaining, options.showShortList, "onShortList");
        return byStatus.filtered.concat(shortList);
    };

});

Fix regression in D-01186, introduced by B-03523
Fix regression in D-01186, introduced by B-03523

The solution for B-03523 incorrectly tests when the status is set to "DOWN".
It appears to be testings if the service is visible to the public OR if the status is "DOWN".
This ends up exposing non-public services to anonymous, thereby re-introducing D-01186.

Change the filterByStatus() condition parameter to an array so that multiple status can be checked via a single pass.
