Select the types of activity you want to include in your feed.
@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
···11+<?php
22+/**
33+ * This file is automatically generated. Lint this module to rebuild it.
44+ * @generated
55+ */
66+77+88+99+phutil_require_module('phabricator', 'applications/phid/constants');
1010+1111+1212+phutil_require_source('utils.php');
+54
src/applications/phid/utils/utils.php
···11+<?php
22+33+/*
44+ * Copyright 2012 Facebook, Inc.
55+ *
66+ * Licensed under the Apache License, Version 2.0 (the "License");
77+ * you may not use this file except in compliance with the License.
88+ * You may obtain a copy of the License at
99+ *
1010+ * http://www.apache.org/licenses/LICENSE-2.0
1111+ *
1212+ * Unless required by applicable law or agreed to in writing, software
1313+ * distributed under the License is distributed on an "AS IS" BASIS,
1414+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1515+ * See the License for the specific language governing permissions and
1616+ * limitations under the License.
1717+ */
1818+1919+/**
2020+ * Look up the type of a PHID. Returns
2121+ * PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN if it fails to look up the type
2222+ *
2323+ * @param phid Anything.
2424+ * @return A value from PhabricatorPHIDConstants (ideally)
2525+ */
2626+function phid_get_type($phid) {
2727+ $matches = null;
2828+ if (is_string($phid) && preg_match('/^PHID-([^-]{4})-/', $phid, $matches)) {
2929+ return $matches[1];
3030+ }
3131+ return PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN;
3232+}
3333+3434+/**
3535+ * Group a list of phids by type. Given:
3636+ *
3737+ * phid_group_by_type([PHID-USER-1, PHID-USER-2, PHID-PROJ-3])
3838+ *
3939+ * phid_group_by_type would return:
4040+ *
4141+ * [PhabricatorPHIDConstants::PHID_TYPE_USER => [PHID-USER-1, PHID-USER-2],
4242+ * PhabricatorPHIDConstants::PHID_TYPE_PROJ => [PHID-PROJ-3]]
4343+ *
4444+ * @param phids array of phids
4545+ * @return map of phid type => list of phids
4646+ */
4747+function phid_group_by_type($phids) {
4848+ $result = array();
4949+ foreach ($phids as $phid) {
5050+ $type = phid_get_type($phid);
5151+ $result[$type][] = $phid;
5252+ }
5353+ return $result;
5454+}