switch back to simple TextForEvent

I haven't found anyone who can justify to me why we need
more complicated plurals for i18n (even in Polish) for
%(senderName)s added %(addedAddresses)s and removed %(removedAddresses)s as addresses for this room.
This commit is contained in:
Matthew Hodgson 2018-09-17 18:20:12 +01:00
parent 003083d9fc
commit dc7212ec2b
5 changed files with 36 additions and 25 deletions

View file

@ -14,6 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
/****************************************************************
** **
** THIS CLASS IS NOT USED TO RENDER ALIAS CHANGES, IN ORDER **
** TO TRY TO KEEP THINGS SIMPLE AND JUST USE TextualEvent. **
** **
** The code is kept here for ease of reference in future **
** should we need the GenericEventListSummary stuff **
** **
****************************************************************/
'use strict';
import React from 'react';
@ -69,10 +79,8 @@ export class GenericEventListSummary extends React.Component {
let summaryContainer = null;
if (showSummary) {
summaryContainer = (
<div className="mx_EventTile_line">
<div className="mx_EventTile_info">
{this.props.summary}
</div>
<div>
{this.props.summary}
</div>
);
}
@ -140,10 +148,14 @@ export default class RoomAliasesEvent extends React.Component {
const changes = [];
addedAliases.forEach((alias) => {
changes.push(<div key={'+' + alias}>Added {alias}</div>);
changes.push(<div key={'+' + alias}>{_t('%(senderName)s added %(alias)s', {
senderName, alias,
})}</div>);
});
removedAliases.forEach((alias) => {
changes.push(<div key={'-' + alias}>Removed {alias}</div>);
changes.push(<div key={'-' + alias}>{_t('%(senderName)s removed %(alias)s', {
senderName, alias,
})}</div>);
});
const summary = _t('%(senderName)s changed the addresses of this room.', {senderName});

View file

@ -47,7 +47,8 @@ const eventTileTypes = {
};
const stateEventTileTypes = {
'm.room.aliases': 'messages.RoomAliasesEvent',
'm.room.aliases': 'messages.TextualEvent',
// 'm.room.aliases': 'messages.RoomAliasesEvent', // too complex
'm.room.create': 'messages.RoomCreate',
'm.room.member': 'messages.TextualEvent',
'm.room.name': 'messages.TextualEvent',
@ -484,7 +485,9 @@ module.exports = withMatrixClient(React.createClass({
const eventType = this.props.mxEvent.getType();
// Info messages are basically information about commands processed on a room
const isInfoMessage = (eventType !== 'm.room.message' && eventType !== 'm.sticker' && eventType != 'm.room.create');
const isInfoMessage = (
eventType !== 'm.room.message' && eventType !== 'm.sticker' && eventType != 'm.room.create'
);
const tileHandler = getHandlerTile(this.props.mxEvent);
// This shouldn't happen: the caller should check we support this type