Merge pull request #3918 from matrix-org/travis/aliases
Don't list every single alias when there's manypull/21833/head
						commit
						ed93761b00
					
				| 
						 | 
				
			
			@ -275,6 +275,8 @@ function textForRoomAliasesEvent(ev) {
 | 
			
		|||
    // This feels a bit overkill though, and it's not clear the i18n really needs it
 | 
			
		||||
    // so instead it's landing as a simple textual event.
 | 
			
		||||
 | 
			
		||||
    const maxShown = 3;
 | 
			
		||||
 | 
			
		||||
    const senderName = ev.sender && ev.sender.name ? ev.sender.name : ev.getSender();
 | 
			
		||||
    const oldAliases = ev.getPrevContent().aliases || [];
 | 
			
		||||
    const newAliases = ev.getContent().aliases || [];
 | 
			
		||||
| 
						 | 
				
			
			@ -287,18 +289,40 @@ function textForRoomAliasesEvent(ev) {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    if (addedAliases.length && !removedAliases.length) {
 | 
			
		||||
        if (addedAliases.length > maxShown) {
 | 
			
		||||
            return _t("%(senderName)s added %(addedAddresses)s and %(count)s other addresses to this room", {
 | 
			
		||||
                senderName: senderName,
 | 
			
		||||
                count: addedAliases.length - maxShown,
 | 
			
		||||
                addedAddresses: addedAliases.slice(0, maxShown).join(', '),
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        return _t('%(senderName)s added %(count)s %(addedAddresses)s as addresses for this room.', {
 | 
			
		||||
            senderName: senderName,
 | 
			
		||||
            count: addedAliases.length,
 | 
			
		||||
            addedAddresses: addedAliases.join(', '),
 | 
			
		||||
        });
 | 
			
		||||
    } else if (!addedAliases.length && removedAliases.length) {
 | 
			
		||||
        if (removedAliases.length > maxShown) {
 | 
			
		||||
            return _t("%(senderName)s removed %(removedAddresses)s and %(count)s other addresses from this room", {
 | 
			
		||||
                senderName: senderName,
 | 
			
		||||
                count: removedAliases.length - maxShown,
 | 
			
		||||
                removedAddresses: removedAliases.slice(0, maxShown).join(', '),
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        return _t('%(senderName)s removed %(count)s %(removedAddresses)s as addresses for this room.', {
 | 
			
		||||
            senderName: senderName,
 | 
			
		||||
            count: removedAliases.length,
 | 
			
		||||
            removedAddresses: removedAliases.join(', '),
 | 
			
		||||
        });
 | 
			
		||||
    } else {
 | 
			
		||||
        const combined = addedAliases.length + removedAliases.length;
 | 
			
		||||
        if (combined > maxShown) {
 | 
			
		||||
            return _t("%(senderName)s removed %(countRemoved)s and added %(countAdded)s addresses to this room", {
 | 
			
		||||
                senderName: senderName,
 | 
			
		||||
                countAdded: addedAliases.length,
 | 
			
		||||
                countRemoved: removedAliases.length,
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        return _t(
 | 
			
		||||
            '%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.', {
 | 
			
		||||
                senderName: senderName,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -235,10 +235,13 @@
 | 
			
		|||
    "%(senderDisplayName)s disabled flair for %(groups)s in this room.": "%(senderDisplayName)s disabled flair for %(groups)s in this room.",
 | 
			
		||||
    "%(senderDisplayName)s enabled flair for %(newGroups)s and disabled flair for %(oldGroups)s in this room.": "%(senderDisplayName)s enabled flair for %(newGroups)s and disabled flair for %(oldGroups)s in this room.",
 | 
			
		||||
    "%(senderDisplayName)s sent an image.": "%(senderDisplayName)s sent an image.",
 | 
			
		||||
    "%(senderName)s added %(addedAddresses)s and %(count)s other addresses to this room|other": "%(senderName)s added %(addedAddresses)s and %(count)s other addresses to this room",
 | 
			
		||||
    "%(senderName)s added %(count)s %(addedAddresses)s as addresses for this room.|other": "%(senderName)s added %(addedAddresses)s as addresses for this room.",
 | 
			
		||||
    "%(senderName)s added %(count)s %(addedAddresses)s as addresses for this room.|one": "%(senderName)s added %(addedAddresses)s as an address for this room.",
 | 
			
		||||
    "%(senderName)s removed %(removedAddresses)s and %(count)s other addresses from this room|other": "%(senderName)s removed %(removedAddresses)s and %(count)s other addresses from this room",
 | 
			
		||||
    "%(senderName)s removed %(count)s %(removedAddresses)s as addresses for this room.|other": "%(senderName)s removed %(removedAddresses)s as addresses for this room.",
 | 
			
		||||
    "%(senderName)s removed %(count)s %(removedAddresses)s as addresses for this room.|one": "%(senderName)s removed %(removedAddresses)s as an address for this room.",
 | 
			
		||||
    "%(senderName)s removed %(countRemoved)s and added %(countAdded)s addresses to this room": "%(senderName)s removed %(countRemoved)s and added %(countAdded)s addresses to this room",
 | 
			
		||||
    "%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.": "%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.",
 | 
			
		||||
    "%(senderName)s set the main address for this room to %(address)s.": "%(senderName)s set the main address for this room to %(address)s.",
 | 
			
		||||
    "%(senderName)s removed the main address for this room.": "%(senderName)s removed the main address for this room.",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue