@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
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Conpherence - fix recent participant cache

Summary: Ref T7795. This fixes the behavior where you end up with a "a, b, c..." as the list of participants, and yet user a just left.

Test Plan: joined and left a thread. verified database had correct values. observed correct behavior in messages dropdown

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7795

Differential Revision: https://secure.phabricator.com/D12338

+21 -5
+21 -5
src/applications/conpherence/editor/ConpherenceEditor.php
··· 235 235 PhabricatorLiskDAO $object, 236 236 PhabricatorApplicationTransaction $xaction) { 237 237 238 + $make_author_recent_participant = true; 238 239 switch ($xaction->getTransactionType()) { 239 240 case PhabricatorTransactions::TYPE_COMMENT: 240 241 $object->setMessageCount((int)$object->getMessageCount() + 1); ··· 244 245 break; 245 246 case ConpherenceTransactionType::TYPE_PARTICIPANTS: 246 247 if (!$this->getIsNewObject()) { 247 - // if we added people, add them to the end of "recent" participants 248 248 $old_map = array_fuse($xaction->getOldValue()); 249 249 $new_map = array_fuse($xaction->getNewValue()); 250 + // if we added people, add them to the end of "recent" participants 250 251 $add = array_keys(array_diff_key($new_map, $old_map)); 251 - if ($add) { 252 + // if we remove people, then definintely remove them from "recent" 253 + // participants 254 + $del = array_keys(array_diff_key($old_map, $new_map)); 255 + if ($add || $del) { 252 256 $participants = $object->getRecentParticipantPHIDs(); 253 - $participants = array_merge($participants, $add); 257 + if ($add) { 258 + $participants = array_merge($participants, $add); 259 + } 260 + if ($del) { 261 + $participants = array_diff($participants, $del); 262 + $actor = $this->requireActor(); 263 + if (in_array($actor->getPHID(), $del)) { 264 + $make_author_recent_participant = false; 265 + } 266 + } 254 267 $participants = array_slice(array_unique($participants), 0, 10); 255 268 $object->setRecentParticipantPHIDs($participants); 256 269 } 257 270 } 258 271 break; 259 272 } 260 - $this->updateRecentParticipantPHIDs($object, $xaction); 273 + 274 + if ($make_author_recent_participant) { 275 + $this->makeAuthorMostRecentParticipant($object, $xaction); 276 + } 261 277 } 262 278 263 - private function updateRecentParticipantPHIDs( 279 + private function makeAuthorMostRecentParticipant( 264 280 PhabricatorLiskDAO $object, 265 281 PhabricatorApplicationTransaction $xaction) { 266 282