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
···771771 $this->updatedEpochMax);
772772 }
773773774774+ // NOTE: Although the status constants are integers in PHP, the column is a
775775+ // string column in MySQL, and MySQL won't use keys on string columns if
776776+ // you put integers in the query.
777777+774778 switch ($this->status) {
775779 case self::STATUS_ANY:
776780 break;
777781 case self::STATUS_OPEN:
778782 $where[] = qsprintf(
779783 $conn_r,
780780- 'r.status IN (%Ld)',
784784+ 'r.status IN (%Ls)',
781785 DifferentialRevisionStatus::getOpenStatuses());
782786 break;
783787 case self::STATUS_NEEDS_REVIEW:
784788 $where[] = qsprintf(
785789 $conn_r,
786786- 'r.status IN (%Ld)',
790790+ 'r.status IN (%Ls)',
787791 array(
788792 ArcanistDifferentialRevisionStatus::NEEDS_REVIEW,
789793 ));
···791795 case self::STATUS_NEEDS_REVISION:
792796 $where[] = qsprintf(
793797 $conn_r,
794794- 'r.status IN (%Ld)',
798798+ 'r.status IN (%Ls)',
795799 array(
796800 ArcanistDifferentialRevisionStatus::NEEDS_REVISION,
797801 ));
···799803 case self::STATUS_ACCEPTED:
800804 $where[] = qsprintf(
801805 $conn_r,
802802- 'r.status IN (%Ld)',
806806+ 'r.status IN (%Ls)',
803807 array(
804808 ArcanistDifferentialRevisionStatus::ACCEPTED,
805809 ));
···807811 case self::STATUS_CLOSED:
808812 $where[] = qsprintf(
809813 $conn_r,
810810- 'r.status IN (%Ld)',
814814+ 'r.status IN (%Ls)',
811815 DifferentialRevisionStatus::getClosedStatuses());
812816 break;
813817 case self::STATUS_ABANDONED:
814818 $where[] = qsprintf(
815819 $conn_r,
816816- 'r.status IN (%Ld)',
820820+ 'r.status IN (%Ls)',
817821 array(
818822 ArcanistDifferentialRevisionStatus::ABANDONED,
819823 ));
···102102 'repositoryPHID' => array(
103103 'columns' => array('repositoryPHID'),
104104 ),
105105+ // If you (or a project you are a member of) is reviewing a significant
106106+ // fraction of the revisions on an install, the result set of open
107107+ // revisions may be smaller than the result set of revisions where you
108108+ // are a reviewer. In these cases, this key is better than keys on the
109109+ // edge table.
110110+ 'key_status' => array(
111111+ 'columns' => array('status', 'phid'),
112112+ ),
105113 ),
106114 ) + parent::getConfiguration();
107115 }
···362362 }
363363364364365365+ /**
366366+ * Return `true` if this policy is stronger (more restrictive) than some
367367+ * other policy.
368368+ *
369369+ * Because policies are complicated, determining which policies are
370370+ * "stronger" is not trivial. This method uses a very coarse working
371371+ * definition of policy strength which is cheap to compute, unambiguous,
372372+ * and intuitive in the common cases.
373373+ *
374374+ * This method returns `true` if the //class// of this policy is stronger
375375+ * than the other policy, even if the policies are (or might be) the same in
376376+ * practice. For example, "Members of Project X" is considered a stronger
377377+ * policy than "All Users", even though "Project X" might (in some rare
378378+ * cases) contain every user.
379379+ *
380380+ * Generally, the ordering here is:
381381+ *
382382+ * - Public
383383+ * - All Users
384384+ * - (Everything Else)
385385+ * - No One
386386+ *
387387+ * In the "everything else" bucket, we can't make any broad claims about
388388+ * which policy is stronger (and we especially can't make those claims
389389+ * cheaply).
390390+ *
391391+ * Even if we fully evaluated each policy, the two policies might be
392392+ * "Members of X" and "Members of Y", each of which permits access to some
393393+ * set of unique users. In this case, neither is strictly stronger than
394394+ * the other.
395395+ *
396396+ * @param PhabricatorPolicy Other policy.
397397+ * @return bool `true` if this policy is more restrictive than the other
398398+ * policy.
399399+ */
400400+ public function isStrongerThan(PhabricatorPolicy $other) {
401401+ $this_policy = $this->getPHID();
402402+ $other_policy = $other->getPHID();
403403+404404+ $strengths = array(
405405+ PhabricatorPolicies::POLICY_PUBLIC => -2,
406406+ PhabricatorPolicies::POLICY_USER => -1,
407407+ // (Default policies have strength 0.)
408408+ PhabricatorPolicies::POLICY_NOONE => 1,
409409+ );
410410+411411+ $this_strength = idx($strengths, $this->getPHID(), 0);
412412+ $other_strength = idx($strengths, $other->getPHID(), 0);
413413+414414+ return ($this_strength > $other_strength);
415415+ }
416416+417417+418418+365419/* -( PhabricatorPolicyInterface )----------------------------------------- */
366420367421
+26
src/view/phui/PHUIHeaderView.php
···355355 return null;
356356 }
357357358358+ // If an object is in a Space with a strictly stronger (more restrictive)
359359+ // policy, we show the more restrictive policy. This better aligns the
360360+ // UI hint with the actual behavior.
361361+362362+ // NOTE: We'll do this even if the viewer has access to only one space, and
363363+ // show them information about the existence of spaces if they click
364364+ // through.
365365+ if ($object instanceof PhabricatorSpacesInterface) {
366366+ $space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID(
367367+ $object);
368368+369369+ $spaces = PhabricatorSpacesNamespaceQuery::getViewerSpaces($viewer);
370370+ $space = idx($spaces, $space_phid);
371371+ if ($space) {
372372+ $space_policies = PhabricatorPolicyQuery::loadPolicies(
373373+ $viewer,
374374+ $space);
375375+ $space_policy = idx($space_policies, $view_capability);
376376+ if ($space_policy) {
377377+ if ($space_policy->isStrongerThan($policy)) {
378378+ $policy = $space_policy;
379379+ }
380380+ }
381381+ }
382382+ }
383383+358384 $phid = $object->getPHID();
359385360386 $icon = id(new PHUIIconView())