@@ -27,7 +27,7 @@ const NOTIFICATION_ICONS = {
2727 favourite : 'heart' ,
2828 poll : 'poll' ,
2929 update : 'pencil' ,
30- 'admin.signup ' : 'account-edit' ,
30+ 'admin.sign_up ' : 'account-edit' ,
3131 'admin.report' : 'account-warning' ,
3232 severed_relationships : 'heart-break' ,
3333 moderation_warning : 'alert' ,
@@ -256,7 +256,20 @@ const contentText = {
256256 quoted_update : ( { account } ) => (
257257 < Trans > { account } edited a post you have quoted.</ Trans >
258258 ) ,
259- 'admin.sign_up' : ( { account } ) => < Trans > { account } signed up.</ Trans > ,
259+ 'admin.sign_up' : ( { account, count, components : { Subject } } ) => (
260+ < Plural
261+ value = { count }
262+ _1 = { < Trans > { account } signed up.</ Trans > }
263+ other = {
264+ < Trans >
265+ < Subject clickable = { count > 1 } >
266+ < span title = { count } > { shortenNumber ( count ) } </ span > people
267+ </ Subject > { ' ' }
268+ signed up.
269+ </ Trans >
270+ }
271+ />
272+ ) ,
260273 'admin.report' : ( { account, targetAccount } ) => (
261274 < Trans >
262275 { account } reported { targetAccount }
@@ -399,7 +412,8 @@ function Notification({
399412
400413 if ( typeof text === 'function' ) {
401414 const count =
402- ( type === 'favourite' || type === 'reblog' ) && notificationsCount
415+ ( type === 'favourite' || type === 'reblog' || type === 'admin.sign_up' ) &&
416+ notificationsCount
403417 ? diffCount
404418 ? notificationsCount
405419 : sampleAccounts ?. length
@@ -465,14 +479,63 @@ function Notification({
465479 reblog : t `Boosted by…` ,
466480 follow : t `Followed by…` ,
467481 } [ type ] || t `Accounts` ;
482+ const showRemoteAccounts =
483+ ( type === 'favourite+reblog' ||
484+ type === 'favourite' ||
485+ type === 'reblog' ||
486+ type === 'admin.sign_up' ) &&
487+ expandAccounts === 'remote' ;
468488 const handleOpenGenericAccounts = ( ) => {
469- states . showGenericAccounts = {
470- heading : genericAccountsHeading ,
471- accounts : _accounts ,
472- showReactions : type === 'favourite+reblog' ,
473- excludeRelationshipAttrs : type === 'follow' ? [ 'followedBy' ] : [ ] ,
474- postID : statusKey ( actualStatusID , instance ) ,
475- } ;
489+ if ( showRemoteAccounts ) {
490+ states . showGenericAccounts = {
491+ heading : genericAccountsHeading ,
492+ accounts : _accounts ,
493+ fetchAccounts : async ( ) => {
494+ const keyAccounts = await Promise . allSettled (
495+ _groupKeys . map ( async ( gKey ) => {
496+ const iterator = masto . v2 . notifications
497+ . $select ( gKey )
498+ . accounts . list ( )
499+ . values ( ) ;
500+ return [ gKey , ( await iterator . next ( ) ) . value ] ;
501+ } ) ,
502+ ) ;
503+ const accounts = [ ] ;
504+ for ( const keyAccount of keyAccounts ) {
505+ const [ key , _accounts ] = keyAccount . value ;
506+ const type = / ^ f a v o u r i t e / . test ( key )
507+ ? 'favourite'
508+ : / ^ r e b l o g / . test ( key )
509+ ? 'reblog'
510+ : null ;
511+ // if (!type) continue;
512+ for ( const account of _accounts ) {
513+ const theAccount = accounts . find ( ( a ) => a . id === account . id ) ;
514+ if ( theAccount && type ) {
515+ theAccount . _types . push ( type ) ;
516+ } else {
517+ if ( type ) account . _types = [ type ] ;
518+ accounts . push ( account ) ;
519+ }
520+ }
521+ }
522+ return {
523+ done : true ,
524+ value : accounts ,
525+ } ;
526+ } ,
527+ showReactions : type === 'favourite+reblog' ,
528+ postID : statusKey ( actualStatusID , instance ) ,
529+ } ;
530+ } else {
531+ states . showGenericAccounts = {
532+ heading : genericAccountsHeading ,
533+ accounts : _accounts ,
534+ showReactions : type === 'favourite+reblog' ,
535+ excludeRelationshipAttrs : type === 'follow' ? [ 'followedBy' ] : [ ] ,
536+ postID : statusKey ( actualStatusID , instance ) ,
537+ } ;
538+ }
476539 } ;
477540
478541 console . debug ( 'RENDER Notification' , notification . id ) ;
@@ -486,12 +549,21 @@ function Notification({
486549 }
487550 }
488551
552+ const debugHover = ( e ) => {
553+ if ( e . shiftKey ) {
554+ console . log ( {
555+ ...notification ,
556+ } ) ;
557+ }
558+ } ;
559+
489560 return (
490561 < div
491562 class = { `notification notification-${ type } ` }
492563 data-notification-id = { _ids || id }
493564 data-group-key = { _groupKeys ?. join ( ' ' ) || groupKey }
494565 tabIndex = "0"
566+ onMouseEnter = { debugHover }
495567 >
496568 < div
497569 class = { `notification-type notification-${ type } ` }
@@ -621,61 +693,17 @@ function Notification({
621693 </ a > { ' ' }
622694 </ Fragment >
623695 ) ) }
624- { ( type === 'favourite+reblog' ||
625- type === 'favourite' ||
626- type === 'reblog' ) &&
627- expandAccounts === 'remote' ? (
696+ { showRemoteAccounts ? (
628697 < button
629698 type = "button"
630699 class = "small plain"
631700 data-group-keys = { _groupKeys ?. join ( ' ' ) }
632- onClick = { ( ) => {
633- states . showGenericAccounts = {
634- heading : genericAccountsHeading ,
635- accounts : _accounts ,
636- fetchAccounts : async ( ) => {
637- const keyAccounts = await Promise . allSettled (
638- _groupKeys . map ( async ( gKey ) => {
639- const iterator = masto . v2 . notifications
640- . $select ( gKey )
641- . accounts . list ( )
642- . values ( ) ;
643- return [ gKey , ( await iterator . next ( ) ) . value ] ;
644- } ) ,
645- ) ;
646- const accounts = [ ] ;
647- for ( const keyAccount of keyAccounts ) {
648- const [ key , _accounts ] = keyAccount . value ;
649- const type = / ^ f a v o u r i t e / . test ( key )
650- ? 'favourite'
651- : / ^ r e b l o g / . test ( key )
652- ? 'reblog'
653- : null ;
654- if ( ! type ) continue ;
655- for ( const account of _accounts ) {
656- const theAccount = accounts . find (
657- ( a ) => a . id === account . id ,
658- ) ;
659- if ( theAccount ) {
660- theAccount . _types . push ( type ) ;
661- } else {
662- account . _types = [ type ] ;
663- accounts . push ( account ) ;
664- }
665- }
666- }
667- return {
668- done : true ,
669- value : accounts ,
670- } ;
671- } ,
672- showReactions : type === 'favourite+reblog' ,
673- postID : statusKey ( actualStatusID , instance ) ,
674- } ;
675- } }
701+ onClick = { handleOpenGenericAccounts }
676702 >
677703 +
678- { ( type === 'favourite' || type === 'reblog' ) &&
704+ { ( type === 'favourite' ||
705+ type === 'reblog' ||
706+ type === 'admin.sign_up' ) &&
679707 notificationsCount - _accounts . length }
680708 < Icon icon = "chevron-down" />
681709 </ button >
@@ -727,7 +755,7 @@ function Notification({
727755 </ a > { ' ' }
728756 </ Fragment >
729757 ) ) }
730- { notificationsCount > sampleAccounts . length && (
758+ { notificationsCount > sampleAccounts . length && status ?. id && (
731759 < Link
732760 to = {
733761 instance ? `/${ instance } /s/${ status . id } ` : `/s/${ status . id } `
0 commit comments