[REGRESSION] Room View header title (#1827)

Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
Diego Mello 2020-03-05 11:35:05 -03:00 committed by GitHub
parent 74cc75a928
commit 512ffe4990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 35 additions and 57 deletions

View File

@ -375,7 +375,7 @@ class Markdown extends PureComponent {
m = shortnameToUnicode(m); m = shortnameToUnicode(m);
m = removeMarkdown(m); m = removeMarkdown(m);
return ( return (
<Text style={[styles.text, { color: themes[theme].bodyText }, ...style]} numberOfLines={numberOfLines}> <Text accessibilityLabel={m} style={[styles.text, { color: themes[theme].bodyText }, ...style]} numberOfLines={numberOfLines}>
{m} {m}
</Text> </Text>
); );

View File

@ -275,9 +275,6 @@ export default {
No_results_found: 'Keine Ergebnisse gefunden', No_results_found: 'Keine Ergebnisse gefunden',
No_starred_messages: 'Keine markierten Nachrichten', No_starred_messages: 'Keine markierten Nachrichten',
No_thread_messages: 'Keine Threadnachrichten', No_thread_messages: 'Keine Threadnachrichten',
No_announcement_provided: 'Keine Ankündigung erfolgt.',
No_description_provided: 'Keine Beschreibung angegeben.',
No_topic_provided: 'Kein Thema bereitgestellt',
No_Message: 'Keine Nachricht', No_Message: 'Keine Nachricht',
No_messages_yet: 'Noch keine Nachrichten', No_messages_yet: 'Noch keine Nachrichten',
No_Reactions: 'Keine Reaktionen', No_Reactions: 'Keine Reaktionen',

View File

@ -275,9 +275,7 @@ export default {
No_results_found: 'No results found', No_results_found: 'No results found',
No_starred_messages: 'No starred messages', No_starred_messages: 'No starred messages',
No_thread_messages: 'No thread messages', No_thread_messages: 'No thread messages',
No_announcement_provided: 'No announcement provided.', No_label_provided: 'No {{label}} provided.',
No_description_provided: 'No description provided.',
No_topic_provided: 'No topic provided.',
No_Message: 'No Message', No_Message: 'No Message',
No_messages_yet: 'No messages yet', No_messages_yet: 'No messages yet',
No_Reactions: 'No Reactions', No_Reactions: 'No Reactions',

View File

@ -255,9 +255,6 @@ export default {
No_results_found: 'No hay resultados', No_results_found: 'No hay resultados',
No_starred_messages: 'No hay mensajes destacados', No_starred_messages: 'No hay mensajes destacados',
No_thread_messages: 'No hay hilots', No_thread_messages: 'No hay hilots',
No_announcement_provided: 'No se ha indicado un anuncio',
No_description_provided: 'No se ha indicado descripción',
No_topic_provided: 'No se ha indicado asunto.',
No_Message: 'Sin mensajes', No_Message: 'Sin mensajes',
No_messages_yet: 'No hay todavía mensajes', No_messages_yet: 'No hay todavía mensajes',
No_Reactions: 'No hay reacciones', No_Reactions: 'No hay reacciones',

View File

@ -215,9 +215,6 @@ export default {
No_pinned_messages: 'Aucun message épinglé', No_pinned_messages: 'Aucun message épinglé',
No_results_found: 'Aucun résultat trouvé', No_results_found: 'Aucun résultat trouvé',
No_starred_messages: 'Pas de messages suivis', No_starred_messages: 'Pas de messages suivis',
No_announcement_provided: 'Aucune annonce fournie.',
No_description_provided: 'Aucune description fournie.',
No_topic_provided: 'Aucun sujet fourni.',
No_Message: 'Aucun message', No_Message: 'Aucun message',
No_Reactions: 'Aucune réaction', No_Reactions: 'Aucune réaction',
Not_logged: 'Non connecté', Not_logged: 'Non connecté',

View File

@ -266,9 +266,6 @@ export default {
No_results_found: 'Nessun risultato', No_results_found: 'Nessun risultato',
No_starred_messages: 'Nessun messaggio preferito', No_starred_messages: 'Nessun messaggio preferito',
No_thread_messages: 'Nessun messaggio thread', No_thread_messages: 'Nessun messaggio thread',
No_announcement_provided: 'Nessun annuncio inserito.',
No_description_provided: 'Nessuna descrizione inserita.',
No_topic_provided: 'Nessun argomento inserito.',
No_Message: 'Nessun messaggio', No_Message: 'Nessun messaggio',
No_messages_yet: 'Non ci sono ancora messaggi', No_messages_yet: 'Non ci sono ancora messaggi',
No_Reactions: 'Nessuna reazione', No_Reactions: 'Nessuna reazione',

View File

@ -296,9 +296,6 @@ export default {
No_results_found: '結果なし', No_results_found: '結果なし',
No_starred_messages: 'お気に入りされたメッセージはありません', No_starred_messages: 'お気に入りされたメッセージはありません',
No_thread_messages: 'スレッドのメッセージはありません', No_thread_messages: 'スレッドのメッセージはありません',
No_announcement_provided: 'アナウンスはありません。',
No_description_provided: '概要はありません。',
No_topic_provided: 'トピックはありません。',
No_Message: 'メッセージなし', No_Message: 'メッセージなし',
No_messages_yet: 'まだメッセージはありません', No_messages_yet: 'まだメッセージはありません',
No_Reactions: 'リアクションなし', No_Reactions: 'リアクションなし',

View File

@ -266,9 +266,6 @@ export default {
No_results_found: 'Geen resultaten gevonden', No_results_found: 'Geen resultaten gevonden',
No_starred_messages: 'Geen berichten met ster gemarkeerd', No_starred_messages: 'Geen berichten met ster gemarkeerd',
No_thread_messages: 'Geen thread berichten', No_thread_messages: 'Geen thread berichten',
No_announcement_provided: 'Geen announcement opgegeven.',
No_description_provided: 'Geen beschrijving opgegeven.',
No_topic_provided: 'Geen onderwerp opgegeven.',
No_Message: 'Geen bericht', No_Message: 'Geen bericht',
No_messages_yet: 'Nog geen berichten', No_messages_yet: 'Nog geen berichten',
No_Reactions: 'Geen reacties', No_Reactions: 'Geen reacties',

View File

@ -257,9 +257,7 @@ export default {
No_results_found: 'Nenhum resultado encontrado', No_results_found: 'Nenhum resultado encontrado',
No_starred_messages: 'Não há mensagens favoritas', No_starred_messages: 'Não há mensagens favoritas',
No_thread_messages: 'Não há tópicos', No_thread_messages: 'Não há tópicos',
No_announcement_provided: 'Sem anúncio.', No_label_provided: 'Sem {{label}}.',
No_description_provided: 'Sem descrição.',
No_topic_provided: 'Sem tópico.',
No_Message: 'Não há mensagens', No_Message: 'Não há mensagens',
No_messages_yet: 'Não há mensagens ainda', No_messages_yet: 'Não há mensagens ainda',
No_Reactions: 'Sem reações', No_Reactions: 'Sem reações',

View File

@ -216,9 +216,6 @@ export default {
No_pinned_messages: 'Nenhuma mensagem afixada', No_pinned_messages: 'Nenhuma mensagem afixada',
No_results_found: 'Nenhum resultado encontrado', No_results_found: 'Nenhum resultado encontrado',
No_starred_messages: 'Nenhuma mensagem marcada com estrela', No_starred_messages: 'Nenhuma mensagem marcada com estrela',
No_announcement_provided: 'Nenhum anúncio fornecido.',
No_description_provided: 'Nenhuma descrição fornecida.',
No_topic_provided: 'Nenhum tópico fornecido.',
No_Message: 'Nenhuma mensagem', No_Message: 'Nenhuma mensagem',
No_Reactions: 'Nenhuma reação', No_Reactions: 'Nenhuma reação',
Not_logged: 'Não ligado', Not_logged: 'Não ligado',

View File

@ -249,9 +249,6 @@ export default {
No_results_found: 'Ничего не найдено', No_results_found: 'Ничего не найдено',
No_starred_messages: 'Нет отмеченных сообщений', No_starred_messages: 'Нет отмеченных сообщений',
No_thread_messages: 'Нет сообщений в теме', No_thread_messages: 'Нет сообщений в теме',
No_announcement_provided: 'Нет объявлений.',
No_description_provided: 'Нет описания.',
No_topic_provided: 'Нет темы.',
No_Message: 'Нет сообщения', No_Message: 'Нет сообщения',
No_messages_yet: 'Пока нет сообщений', No_messages_yet: 'Пока нет сообщений',
No_Reactions: 'Нет реакций', No_Reactions: 'Нет реакций',

View File

@ -212,9 +212,6 @@ export default {
No_pinned_messages: '没有固定的消息', No_pinned_messages: '没有固定的消息',
No_snippeted_messages: '没有代码片段的消息', No_snippeted_messages: '没有代码片段的消息',
No_starred_messages: '没有加星标的消息', No_starred_messages: '没有加星标的消息',
No_announcement_provided: '没有公告.',
No_description_provided: '没有描述.',
No_topic_provided: '没有话题.',
No_Message: '没有消息', No_Message: '没有消息',
No_Reactions: '没有回复', No_Reactions: '没有回复',
Not_logged: '没有记录', Not_logged: '没有记录',

View File

@ -168,15 +168,14 @@ class RoomInfoView extends React.Component {
isDirect = () => this.t === 'd' isDirect = () => this.t === 'd'
renderItem = ({ label, content, testID }) => { renderItem = ({ label, content }) => {
const { theme } = this.props; const { theme } = this.props;
return ( return (
<View style={styles.item}> <View style={styles.item}>
<Text accessibilityLabel={label} style={[styles.itemLabel, { color: themes[theme].titleText }]}>{I18n.t(label)}</Text> <Text accessibilityLabel={label} style={[styles.itemLabel, { color: themes[theme].titleText }]}>{label}</Text>
<Markdown <Markdown
testID={testID}
style={[styles.itemContent, { color: themes[theme].auxiliaryText }]} style={[styles.itemContent, { color: themes[theme].auxiliaryText }]}
msg={content || `__${ I18n.t(`No_${ label.toLowerCase() }_provided`) }__`} msg={content || `__${ I18n.t('No_label_provided', { label: label.toLowerCase() }) }__`}
theme={theme} theme={theme}
/> />
</View> </View>
@ -222,9 +221,8 @@ class RoomInfoView extends React.Component {
return null; return null;
} }
return this.renderItem({ return this.renderItem({
label: 'Timezone', label: I18n.t('Timezone'),
content: `${ moment().utcOffset(utcOffset).format(Message_TimeFormat) } (UTC ${ utcOffset })`, content: `${ moment().utcOffset(utcOffset).format(Message_TimeFormat) } (UTC ${ utcOffset })`
testID: 'room-info-view-timezone'
}); });
} }
return null; return null;
@ -249,9 +247,8 @@ class RoomInfoView extends React.Component {
} }
renderBroadcast = () => this.renderItem({ renderBroadcast = () => this.renderItem({
label: 'Broadcast_Channel', label: I18n.t('Broadcast_Channel'),
content: I18n.t('Broadcast_channel_Description'), content: I18n.t('Broadcast_channel_Description')
testID: 'room-info-view-broadcast'
}); });
renderCustomFields = () => { renderCustomFields = () => {
@ -309,9 +306,9 @@ class RoomInfoView extends React.Component {
const { description, topic, announcement } = room; const { description, topic, announcement } = room;
return ( return (
<> <>
{this.renderItem({ label: 'Description', content: description })} {this.renderItem({ label: I18n.t('Description'), content: description })}
{this.renderItem({ label: 'Topic', content: topic })} {this.renderItem({ label: I18n.t('Topic'), content: topic })}
{this.renderItem({ label: 'Announcement', content: announcement })} {this.renderItem({ label: I18n.t('Announcement'), content: announcement })}
{room.broadcast ? this.renderBroadcast() : null} {room.broadcast ? this.renderBroadcast() : null}
</> </>
); );

View File

@ -68,18 +68,30 @@ Typing.propTypes = {
}; };
const HeaderTitle = React.memo(({ const HeaderTitle = React.memo(({
title, scale, connecting, theme title, tmid, prid, scale, connecting, theme
}) => { }) => {
if (connecting) { if (connecting) {
title = I18n.t('Connecting'); title = I18n.t('Connecting');
} }
if (!tmid && !prid) {
return (
<Text
style={[styles.title, { fontSize: TITLE_SIZE * scale, color: themes[theme].headerTitleColor }]}
numberOfLines={1}
testID={`room-view-title-${ title }`}
>
{title}
</Text>
);
}
return ( return (
<Markdown <Markdown
preview preview
msg={title} msg={title}
style={[styles.title, { fontSize: TITLE_SIZE * scale, color: themes[theme].headerTitleColor }]} style={[styles.title, { fontSize: TITLE_SIZE * scale, color: themes[theme].headerTitleColor }]}
numberOfLines={1} numberOfLines={1}
testID={`room-view-title-${ title }`}
theme={theme} theme={theme}
/> />
); );
@ -87,6 +99,8 @@ const HeaderTitle = React.memo(({
HeaderTitle.propTypes = { HeaderTitle.propTypes = {
title: PropTypes.string, title: PropTypes.string,
tmid: PropTypes.string,
prid: PropTypes.string,
scale: PropTypes.number, scale: PropTypes.number,
connecting: PropTypes.bool, connecting: PropTypes.bool,
theme: PropTypes.string theme: PropTypes.string
@ -126,6 +140,8 @@ const Header = React.memo(({
<Icon type={prid ? 'discussion' : type} status={status} theme={theme} /> <Icon type={prid ? 'discussion' : type} status={status} theme={theme} />
<HeaderTitle <HeaderTitle
title={title} title={title}
tmid={tmid}
prid={prid}
scale={scale} scale={scale}
connecting={connecting} connecting={connecting}
theme={theme} theme={theme}

View File

@ -63,18 +63,15 @@ describe('Room info screen', () => {
}); });
it('should have description', async() => { it('should have description', async() => {
// await expect(element(by.id('room-info-view-description'))).toBeVisible(); await expect(element(by.label('Description'))).toBeVisible();
await expect(element(by.label('description'))).toBeVisible();
}); });
it('should have topic', async() => { it('should have topic', async() => {
// await expect(element(by.id('room-info-view-topic'))).toBeVisible(); await expect(element(by.label('Topic'))).toBeVisible();
await expect(element(by.label('topic'))).toBeVisible();
}); });
it('should have announcement', async() => { it('should have announcement', async() => {
// await expect(element(by.id('room-info-view-announcement'))).toBeVisible(); await expect(element(by.label('Announcement'))).toBeVisible();
await expect(element(by.label('announcement'))).toBeVisible();
}); });
it('should have edit button', async() => { it('should have edit button', async() => {

View File

@ -62,8 +62,7 @@ describe('Broadcast room', () => {
await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(5000); await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(5000);
await element(by.id('room-actions-info')).tap(); await element(by.id('room-actions-info')).tap();
await waitFor(element(by.id('room-info-view'))).toBeVisible().withTimeout(2000); await waitFor(element(by.id('room-info-view'))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('room-info-view-broadcast'))).toBeVisible().withTimeout(2000); await expect(element(by.label('Broadcast Channel'))).toBeVisible();
await expect(element(by.id('room-info-view-broadcast'))).toBeVisible();
await tapBack(); await tapBack();
await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(2000); await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(2000);
await tapBack(); await tapBack();