@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.

Clean up Conpherence Transactions and notifications

Summary: Does a few things. Turns off feed stories (again), removes "action" transactions from notificiations, and only updates message count on actual messages. This feels a bit cleaner and less spammy... I guess... I think @epriestley will really like it and do me a favor or something.

Test Plan: Pull up two windows. test a message, see message count on second screen. Edit a topic or title, get no notification. At all. Ever.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

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

+62 -120
+3 -3
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'conpherence.pkg.css' => 'b5ee2073', 10 + 'conpherence.pkg.css' => 'f8390290', 11 11 'conpherence.pkg.js' => '281b1a73', 12 12 'core.pkg.css' => '30a64ed6', 13 13 'core.pkg.js' => 'fbc1c380', ··· 49 49 'rsrc/css/application/conpherence/header-pane.css' => '4082233d', 50 50 'rsrc/css/application/conpherence/menu.css' => '5abfb32d', 51 51 'rsrc/css/application/conpherence/message-pane.css' => 'd1fc13e1', 52 - 'rsrc/css/application/conpherence/notification.css' => '965db05b', 52 + 'rsrc/css/application/conpherence/notification.css' => 'cef0a3fc', 53 53 'rsrc/css/application/conpherence/participant-pane.css' => '604a8b02', 54 54 'rsrc/css/application/conpherence/transaction.css' => '85129c68', 55 55 'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4', ··· 556 556 'conpherence-header-pane-css' => '4082233d', 557 557 'conpherence-menu-css' => '5abfb32d', 558 558 'conpherence-message-pane-css' => 'd1fc13e1', 559 - 'conpherence-notification-css' => '965db05b', 559 + 'conpherence-notification-css' => 'cef0a3fc', 560 560 'conpherence-participant-pane-css' => '604a8b02', 561 561 'conpherence-thread-manager' => 'c8b5ee6f', 562 562 'conpherence-transaction-css' => '85129c68',
+1 -1
src/applications/conpherence/controller/ConpherenceNotificationPanelController.php
··· 20 20 ->withPHIDs(array_keys($participant_data)) 21 21 ->needProfileImage(true) 22 22 ->needTransactions(true) 23 - ->setTransactionLimit(50) 23 + ->setTransactionLimit(100) 24 24 ->needParticipantCache(true) 25 25 ->execute(); 26 26 }
+32 -51
src/applications/conpherence/editor/ConpherenceEditor.php
··· 87 87 public function getTransactionTypes() { 88 88 $types = parent::getTransactionTypes(); 89 89 90 - $types[] = PhabricatorTransactions::TYPE_COMMENT; 91 - 92 90 $types[] = ConpherenceTransaction::TYPE_PARTICIPANTS; 91 + 92 + $types[] = PhabricatorTransactions::TYPE_COMMENT; 93 93 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY; 94 94 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY; 95 95 $types[] = PhabricatorTransactions::TYPE_JOIN_POLICY; ··· 100 100 public function getCreateObjectTitle($author, $object) { 101 101 return pht('%s created this room.', $author); 102 102 } 103 - 104 - protected function shouldPublishFeedStory( 105 - PhabricatorLiskDAO $object, 106 - array $xactions) { 107 - 108 - foreach ($xactions as $xaction) { 109 - switch ($xaction->getTransactionType()) { 110 - case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE: 111 - case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE: 112 - case ConpherenceThreadPictureTransaction::TRANSACTIONTYPE: 113 - return true; 114 - default: 115 - return false; 116 - } 117 - } 118 - return true; 119 - } 120 - 121 - 122 103 123 104 protected function getCustomTransactionOldValue( 124 105 PhabricatorLiskDAO $object, ··· 338 319 switch ($xaction->getTransactionType()) { 339 320 case PhabricatorTransactions::TYPE_COMMENT: 340 321 $message_count++; 341 - break; 342 - } 343 - } 344 322 345 - // update everyone's participation status on the last xaction -only- 346 - $xaction = end($xactions); 347 - $xaction_phid = $xaction->getPHID(); 348 - $behind = ConpherenceParticipationStatus::BEHIND; 349 - $up_to_date = ConpherenceParticipationStatus::UP_TO_DATE; 350 - $participants = $object->getParticipants(); 351 - $user = $this->getActor(); 352 - $time = time(); 353 - foreach ($participants as $phid => $participant) { 354 - if ($phid != $user->getPHID()) { 355 - if ($participant->getParticipationStatus() != $behind) { 356 - $participant->setBehindTransactionPHID($xaction_phid); 357 - $participant->setSeenMessageCount( 358 - $object->getMessageCount() - $message_count); 359 - } 360 - $participant->setParticipationStatus($behind); 361 - $participant->setDateTouched($time); 362 - } else { 363 - $participant->setSeenMessageCount($object->getMessageCount()); 364 - $participant->setBehindTransactionPHID($xaction_phid); 365 - $participant->setParticipationStatus($up_to_date); 366 - $participant->setDateTouched($time); 323 + // update everyone's participation status on a message -only- 324 + $xaction_phid = $xaction->getPHID(); 325 + $behind = ConpherenceParticipationStatus::BEHIND; 326 + $up_to_date = ConpherenceParticipationStatus::UP_TO_DATE; 327 + $participants = $object->getParticipants(); 328 + $user = $this->getActor(); 329 + $time = time(); 330 + foreach ($participants as $phid => $participant) { 331 + if ($phid != $user->getPHID()) { 332 + if ($participant->getParticipationStatus() != $behind) { 333 + $participant->setBehindTransactionPHID($xaction_phid); 334 + $participant->setSeenMessageCount( 335 + $object->getMessageCount() - $message_count); 336 + } 337 + $participant->setParticipationStatus($behind); 338 + $participant->setDateTouched($time); 339 + } else { 340 + $participant->setSeenMessageCount($object->getMessageCount()); 341 + $participant->setBehindTransactionPHID($xaction_phid); 342 + $participant->setParticipationStatus($up_to_date); 343 + $participant->setDateTouched($time); 344 + } 345 + $participant->save(); 346 + } 347 + 348 + PhabricatorUserCache::clearCaches( 349 + PhabricatorUserMessageCountCacheType::KEY_COUNT, 350 + array_keys($participants)); 351 + 352 + break; 367 353 } 368 - $participant->save(); 369 354 } 370 - 371 - PhabricatorUserCache::clearCaches( 372 - PhabricatorUserMessageCountCacheType::KEY_COUNT, 373 - array_keys($participants)); 374 355 375 356 if ($xactions) { 376 357 $data = array(
+21 -59
src/applications/conpherence/storage/ConpherenceThread.php
··· 240 240 $transactions = array(); 241 241 } 242 242 243 - if ($transactions) { 244 - $subtitle_mode = 'message'; 245 - } else { 246 - $subtitle_mode = 'recent'; 247 - } 248 - 249 - $lucky_phid = head($this->getOtherRecentParticipantPHIDs($viewer)); 250 - if ($lucky_phid) { 251 - $lucky_handle = $handles[$lucky_phid]; 252 - } else { 253 - // This will be just the user talking to themselves. Weirdo. 254 - $lucky_handle = reset($handles); 255 - } 256 - 257 243 $img_src = $this->getProfileImageURI(); 258 244 259 - $message_title = null; 260 - if ($subtitle_mode == 'message') { 261 - $message_transaction = null; 262 - $action_transaction = null; 263 - foreach ($transactions as $transaction) { 264 - if ($message_transaction || $action_transaction) { 265 - break; 266 - } 267 - switch ($transaction->getTransactionType()) { 268 - case PhabricatorTransactions::TYPE_COMMENT: 269 - $message_transaction = $transaction; 270 - break; 271 - case ConpherenceThreadTitleTransaction::TRANSACTIONTYPE: 272 - case ConpherenceThreadTopicTransaction::TRANSACTIONTYPE: 273 - case ConpherenceThreadPictureTransaction::TRANSACTIONTYPE: 274 - case ConpherenceTransaction::TYPE_PARTICIPANTS: 275 - $action_transaction = $transaction; 276 - break; 277 - default: 278 - break; 279 - } 280 - } 245 + $message_transaction = null; 246 + foreach ($transactions as $transaction) { 281 247 if ($message_transaction) { 282 - $message_handle = $handles[$message_transaction->getAuthorPHID()]; 283 - $message_title = sprintf( 284 - '%s: %s', 285 - $message_handle->getName(), 286 - id(new PhutilUTF8StringTruncator()) 287 - ->setMaximumGlyphs(60) 288 - ->truncateString( 289 - $message_transaction->getComment()->getContent())); 248 + break; 290 249 } 291 - if ($action_transaction) { 292 - $message_title = id(clone $action_transaction) 293 - ->setRenderingTarget(PhabricatorApplicationTransaction::TARGET_TEXT) 294 - ->getTitle(); 250 + switch ($transaction->getTransactionType()) { 251 + case PhabricatorTransactions::TYPE_COMMENT: 252 + $message_transaction = $transaction; 253 + break; 254 + default: 255 + break; 295 256 } 296 257 } 297 - switch ($subtitle_mode) { 298 - case 'recent': 299 - $subtitle = $this->getRecentParticipantsString($viewer); 300 - break; 301 - case 'message': 302 - if ($message_title) { 303 - $subtitle = $message_title; 304 - } else { 305 - $subtitle = $this->getRecentParticipantsString($viewer); 306 - } 307 - break; 258 + if ($message_transaction) { 259 + $message_handle = $handles[$message_transaction->getAuthorPHID()]; 260 + $subtitle = sprintf( 261 + '%s: %s', 262 + $message_handle->getName(), 263 + id(new PhutilUTF8StringTruncator()) 264 + ->setMaximumGlyphs(60) 265 + ->truncateString( 266 + $message_transaction->getComment()->getContent())); 267 + } else { 268 + // Kinda lame, but maybe add last message to cache? 269 + $subtitle = pht('No recent messages'); 308 270 } 309 271 310 272 $user_participation = $this->getParticipantIfExists($viewer->getPHID());
+5 -6
webroot/rsrc/css/application/conpherence/notification.css
··· 8 8 9 9 .phabricator-notification .conpherence-menu-item-view { 10 10 display: block; 11 - height: 46px; 11 + height: 48px; 12 12 overflow: hidden; 13 13 position: relative; 14 14 text-decoration: none; ··· 23 23 left: 8px; 24 24 display: block; 25 25 position: absolute; 26 - width: 30px; 27 - height: 30px; 26 + width: 32px; 27 + height: 32px; 28 28 background-size: 100%; 29 29 border-radius: 3px; 30 30 } ··· 33 33 .conpherence-menu-item-title { 34 34 display: block; 35 35 margin-top: 8px; 36 - margin-left: 46px; 36 + margin-left: 48px; 37 37 text-align: left; 38 38 font-weight: bold; 39 39 font-size: {$normalfontsize}; ··· 49 49 display: block; 50 50 color: {$lightgreytext}; 51 51 font-size: {$smallestfontsize}; 52 - margin-top: 2px; 53 - margin-left: 46px; 52 + margin-left: 48px; 54 53 width: 290px; 55 54 text-overflow: ellipsis; 56 55 white-space: nowrap;