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

Adding official Feed stories for Calendar event invite/uninvite actions

Summary: Closes T7988, Adding official Feed stories for Calendar event invite/uninvite actions.

Test Plan: Invite/uninvite users to Calendar events, save, go to Feed, inspect stories.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T7988

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

+97 -10
+97 -10
src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
··· 138 138 $this->renderHandleLink($author_phid)); 139 139 } 140 140 case self::TYPE_INVITE: 141 + $text = null; 142 + 141 143 if (count($old) === 1 142 144 && count($new) === 1 143 145 && isset($old[$author_phid])) { ··· 176 178 $self_declined = null; 177 179 $added = array(); 178 180 $uninvited = array(); 179 - $text = null; 180 181 181 182 foreach ($new as $phid => $status) { 182 183 if ($status == PhabricatorCalendarEventInvitee::STATUS_INVITED ··· 197 198 198 199 if ($count_added > 0 && $count_uninvited == 0) { 199 200 $added_text = $this->renderHandleList($added); 200 - $text = pht('%s invited: %s.', 201 + $text = pht('%s invited %s.', 201 202 $this->renderHandleLink($author_phid), 202 203 $added_text); 203 204 } else if ($count_added > 0 && $count_uninvited > 0) { 204 205 $added_text = $this->renderHandleList($added); 205 206 $uninvited_text = $this->renderHandleList($uninvited); 206 - $text = pht('%s invited: %s and uninvited: %s', 207 + $text = pht('%s invited %s and uninvited: %s', 207 208 $this->renderHandleLink($author_phid), 208 209 $added_text, 209 210 $uninvited_text); 210 211 } else if ($count_added == 0 && $count_uninvited > 0) { 211 212 $uninvited_text = $this->renderHandleList($uninvited); 212 - $text = pht('%s uninvited: %s.', 213 + $text = pht('%s uninvited %s.', 213 214 $this->renderHandleLink($author_phid), 214 215 $uninvited_text); 215 216 } else { ··· 218 219 } 219 220 } 220 221 return $text; 221 - break; 222 - } 222 + } 223 223 return parent::getTitle(); 224 224 } 225 225 ··· 299 299 $this->renderHandleLink($object_phid)); 300 300 } 301 301 case self::TYPE_INVITE: 302 - return pht( 303 - '%s updated the invitee list of %s.', 304 - $this->renderHandleLink($author_phid), 305 - $this->renderHandleLink($object_phid)); 302 + $text = null; 303 + 304 + if (count($old) === 1 305 + && count($new) === 1 306 + && isset($old[$author_phid])) { 307 + // user joined/declined/accepted event themself 308 + $old_status = $old[$author_phid]; 309 + $new_status = $new[$author_phid]; 310 + 311 + if ($old_status !== $new_status) { 312 + switch ($new_status) { 313 + case PhabricatorCalendarEventInvitee::STATUS_INVITED: 314 + $text = pht( 315 + '%s has joined %s.', 316 + $this->renderHandleLink($author_phid), 317 + $this->renderHandleLink($object_phid)); 318 + break; 319 + case PhabricatorCalendarEventInvitee::STATUS_ATTENDING: 320 + $text = pht( 321 + '%s is attending %s.', 322 + $this->renderHandleLink($author_phid), 323 + $this->renderHandleLink($object_phid)); 324 + break; 325 + case PhabricatorCalendarEventInvitee::STATUS_DECLINED: 326 + case PhabricatorCalendarEventInvitee::STATUS_UNINVITED: 327 + $text = pht( 328 + '%s has declined %s.', 329 + $this->renderHandleLink($author_phid), 330 + $this->renderHandleLink($object_phid)); 331 + break; 332 + default: 333 + $text = pht( 334 + '%s has changed their status of %s.', 335 + $this->renderHandleLink($author_phid), 336 + $this->renderHandleLink($object_phid)); 337 + break; 338 + } 339 + } 340 + } else { 341 + // user changed status for many users 342 + $self_joined = null; 343 + $self_declined = null; 344 + $added = array(); 345 + $uninvited = array(); 346 + 347 + // $event = $this->renderHandleLink($object_phid); 348 + 349 + foreach ($new as $phid => $status) { 350 + if ($status == PhabricatorCalendarEventInvitee::STATUS_INVITED 351 + || $status == PhabricatorCalendarEventInvitee::STATUS_ATTENDING) { 352 + // added users 353 + $added[] = $phid; 354 + } else if ( 355 + $status == PhabricatorCalendarEventInvitee::STATUS_DECLINED 356 + || $status == PhabricatorCalendarEventInvitee::STATUS_UNINVITED) { 357 + $uninvited[] = $phid; 358 + } 359 + } 360 + 361 + $count_added = count($added); 362 + $count_uninvited = count($uninvited); 363 + $added_text = null; 364 + $uninvited_text = null; 365 + 366 + if ($count_added > 0 && $count_uninvited == 0) { 367 + $added_text = $this->renderHandleList($added); 368 + $text = pht('%s invited %s to %s.', 369 + $this->renderHandleLink($author_phid), 370 + $added_text, 371 + $this->renderHandleLink($object_phid)); 372 + } else if ($count_added > 0 && $count_uninvited > 0) { 373 + $added_text = $this->renderHandleList($added); 374 + $uninvited_text = $this->renderHandleList($uninvited); 375 + $text = pht('%s invited %s and uninvited %s to %s', 376 + $this->renderHandleLink($author_phid), 377 + $added_text, 378 + $uninvited_text, 379 + $this->renderHandleLink($object_phid)); 380 + } else if ($count_added == 0 && $count_uninvited > 0) { 381 + $uninvited_text = $this->renderHandleList($uninvited); 382 + $text = pht('%s uninvited %s to %s.', 383 + $this->renderHandleLink($author_phid), 384 + $uninvited_text, 385 + $this->renderHandleLink($object_phid)); 386 + } else { 387 + $text = pht('%s updated the invitee list of %s.', 388 + $this->renderHandleLink($author_phid), 389 + $this->renderHandleLink($object_phid)); 390 + } 391 + } 392 + return $text; 306 393 } 307 394 308 395 return parent::getTitleForFeed();