Skip to content

Commit 03f2a41

Browse files
author
Chad Little
committed
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
1 parent ada9046 commit 03f2a41

File tree

5 files changed

+62
-120
lines changed

5 files changed

+62
-120
lines changed

resources/celerity/map.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
return array(
99
'names' => array(
10-
'conpherence.pkg.css' => 'b5ee2073',
10+
'conpherence.pkg.css' => 'f8390290',
1111
'conpherence.pkg.js' => '281b1a73',
1212
'core.pkg.css' => '30a64ed6',
1313
'core.pkg.js' => 'fbc1c380',
@@ -49,7 +49,7 @@
4949
'rsrc/css/application/conpherence/header-pane.css' => '4082233d',
5050
'rsrc/css/application/conpherence/menu.css' => '5abfb32d',
5151
'rsrc/css/application/conpherence/message-pane.css' => 'd1fc13e1',
52-
'rsrc/css/application/conpherence/notification.css' => '965db05b',
52+
'rsrc/css/application/conpherence/notification.css' => 'cef0a3fc',
5353
'rsrc/css/application/conpherence/participant-pane.css' => '604a8b02',
5454
'rsrc/css/application/conpherence/transaction.css' => '85129c68',
5555
'rsrc/css/application/contentsource/content-source-view.css' => '4b8b05d4',
@@ -556,7 +556,7 @@
556556
'conpherence-header-pane-css' => '4082233d',
557557
'conpherence-menu-css' => '5abfb32d',
558558
'conpherence-message-pane-css' => 'd1fc13e1',
559-
'conpherence-notification-css' => '965db05b',
559+
'conpherence-notification-css' => 'cef0a3fc',
560560
'conpherence-participant-pane-css' => '604a8b02',
561561
'conpherence-thread-manager' => 'c8b5ee6f',
562562
'conpherence-transaction-css' => '85129c68',

src/applications/conpherence/controller/ConpherenceNotificationPanelController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function handleRequest(AphrontRequest $request) {
2020
->withPHIDs(array_keys($participant_data))
2121
->needProfileImage(true)
2222
->needTransactions(true)
23-
->setTransactionLimit(50)
23+
->setTransactionLimit(100)
2424
->needParticipantCache(true)
2525
->execute();
2626
}

src/applications/conpherence/editor/ConpherenceEditor.php

Lines changed: 32 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public function generateTransactionsFromText(
8787
public function getTransactionTypes() {
8888
$types = parent::getTransactionTypes();
8989

90-
$types[] = PhabricatorTransactions::TYPE_COMMENT;
91-
9290
$types[] = ConpherenceTransaction::TYPE_PARTICIPANTS;
91+
92+
$types[] = PhabricatorTransactions::TYPE_COMMENT;
9393
$types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
9494
$types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
9595
$types[] = PhabricatorTransactions::TYPE_JOIN_POLICY;
@@ -101,25 +101,6 @@ public function getCreateObjectTitle($author, $object) {
101101
return pht('%s created this room.', $author);
102102
}
103103

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-
123104
protected function getCustomTransactionOldValue(
124105
PhabricatorLiskDAO $object,
125106
PhabricatorApplicationTransaction $xaction) {
@@ -338,40 +319,40 @@ protected function applyFinalEffects(
338319
switch ($xaction->getTransactionType()) {
339320
case PhabricatorTransactions::TYPE_COMMENT:
340321
$message_count++;
341-
break;
342-
}
343-
}
344322

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;
367353
}
368-
$participant->save();
369354
}
370355

371-
PhabricatorUserCache::clearCaches(
372-
PhabricatorUserMessageCountCacheType::KEY_COUNT,
373-
array_keys($participants));
374-
375356
if ($xactions) {
376357
$data = array(
377358
'type' => 'message',

src/applications/conpherence/storage/ConpherenceThread.php

Lines changed: 21 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -240,71 +240,33 @@ public function getDisplayData(PhabricatorUser $viewer) {
240240
$transactions = array();
241241
}
242242

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-
257243
$img_src = $this->getProfileImageURI();
258244

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) {
281247
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;
290249
}
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;
295256
}
296257
}
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');
308270
}
309271

310272
$user_participation = $this->getParticipantIfExists($viewer->getPHID());

webroot/rsrc/css/application/conpherence/notification.css

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
.phabricator-notification .conpherence-menu-item-view {
1010
display: block;
11-
height: 46px;
11+
height: 48px;
1212
overflow: hidden;
1313
position: relative;
1414
text-decoration: none;
@@ -23,8 +23,8 @@
2323
left: 8px;
2424
display: block;
2525
position: absolute;
26-
width: 30px;
27-
height: 30px;
26+
width: 32px;
27+
height: 32px;
2828
background-size: 100%;
2929
border-radius: 3px;
3030
}
@@ -33,7 +33,7 @@
3333
.conpherence-menu-item-title {
3434
display: block;
3535
margin-top: 8px;
36-
margin-left: 46px;
36+
margin-left: 48px;
3737
text-align: left;
3838
font-weight: bold;
3939
font-size: {$normalfontsize};
@@ -49,8 +49,7 @@
4949
display: block;
5050
color: {$lightgreytext};
5151
font-size: {$smallestfontsize};
52-
margin-top: 2px;
53-
margin-left: 46px;
52+
margin-left: 48px;
5453
width: 290px;
5554
text-overflow: ellipsis;
5655
white-space: nowrap;

0 commit comments

Comments
 (0)