Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 167 additions & 0 deletions __tests__/__snapshots__/Storyshots.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -42988,6 +42988,173 @@ exports[`Storyshots Message list message 1`] = `
</View>
</View>
</View>
<Text
style={
Array [
Object {
"fontSize": 20,
"fontWeight": "300",
"marginLeft": 10,
"marginVertical": 30,
},
Object {
"color": "#0d0e12",
},
Object {
"marginBottom": 0,
"marginTop": 30,
},
]
}
>
Ignored
</Text>
<View
accessible={true}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"opacity": 1,
}
}
>
<View>
<View
style={
Array [
Object {
"flexDirection": "column",
"paddingHorizontal": 14,
"paddingVertical": 4,
"width": "100%",
},
undefined,
]
}
>
<View
style={
Array [
Object {
"flexDirection": "row",
},
Object {
"alignItems": "center",
},
]
}
>
<View
style={
Array [
Object {
"borderRadius": 2,
"height": 20,
"width": 20,
},
Object {
"marginLeft": 16,
},
]
}
>
<View
accessible={true}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"opacity": 1,
}
}
>
<View
style={
Array [
Object {
"overflow": "hidden",
},
Object {
"borderRadius": 2,
"height": 20,
"width": 20,
},
]
}
>
<FastImageView
resizeMode="cover"
source={
Object {
"headers": undefined,
"priority": "high",
"uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=100",
}
}
style={
Object {
"bottom": 0,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
}
}
/>
</View>
</View>
</View>
<View
style={
Array [
Object {
"flex": 1,
"marginLeft": 46,
},
Object {
"marginLeft": 10,
},
]
}
>
<View>
<Text
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontStyle": "italic",
"fontWeight": "400",
},
Object {
"color": "#9ca2a8",
},
]
}
>
Message ignored. Tap to display it.
</Text>
</View>
</View>
</View>
</View>
</View>
</View>
<Text
style={
Array [
Expand Down
Binary file modified android/app/src/main/assets/fonts/custom.ttf
Binary file not shown.
8 changes: 8 additions & 0 deletions app/containers/message/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ const Content = React.memo((props) => {
);
}

if (props.isIgnored) {
content = <Text style={[styles.textInfo, { color: themes[props.theme].auxiliaryText }]}>{I18n.t('Message_Ignored')}</Text>;
}

return (
<View style={props.isTemp && styles.temp}>
{content}
Expand All @@ -88,6 +92,9 @@ const Content = React.memo((props) => {
if (prevProps.isEncrypted !== nextProps.isEncrypted) {
return false;
}
if (prevProps.isIgnored !== nextProps.isIgnored) {
return false;
}
if (!equal(prevProps.mentions, nextProps.mentions)) {
return false;
}
Expand All @@ -111,6 +118,7 @@ Content.propTypes = {
mentions: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
navToRoomInfo: PropTypes.func,
useRealName: PropTypes.bool,
isIgnored: PropTypes.bool,
type: PropTypes.string
};
Content.displayName = 'MessageContent';
Expand Down
6 changes: 4 additions & 2 deletions app/containers/message/Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const MessageInner = React.memo((props) => {
MessageInner.displayName = 'MessageInner';

const Message = React.memo((props) => {
if (props.isThreadReply || props.isThreadSequential || props.isInfo) {
if (props.isThreadReply || props.isThreadSequential || props.isInfo || props.isIgnored) {
const thread = props.isThreadReply ? <RepliedThread {...props} /> : null;
return (
<View style={[styles.container, props.style]}>
Expand All @@ -82,6 +82,7 @@ const Message = React.memo((props) => {
</View>
);
}

return (
<View style={[styles.container, props.style]}>
<View style={styles.flex}>
Expand Down Expand Up @@ -146,7 +147,8 @@ Message.propTypes = {
onLongPress: PropTypes.func,
isReadReceiptEnabled: PropTypes.bool,
unread: PropTypes.bool,
theme: PropTypes.string
theme: PropTypes.string,
isIgnored: PropTypes.bool
};

MessageInner.propTypes = {
Expand Down
30 changes: 28 additions & 2 deletions app/containers/message/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class MessageContainer extends React.Component {
autoTranslateRoom: PropTypes.bool,
autoTranslateLanguage: PropTypes.string,
status: PropTypes.number,
isIgnored: PropTypes.bool,
getCustomEmoji: PropTypes.func,
onLongPress: PropTypes.func,
onReactionPress: PropTypes.func,
Expand Down Expand Up @@ -70,9 +71,12 @@ class MessageContainer extends React.Component {
blockAction: () => {},
archived: false,
broadcast: false,
isIgnored: false,
theme: 'light'
}

state = { isManualUnignored: false };

componentDidMount() {
const { item } = this.props;
if (item && item.observe) {
Expand All @@ -83,14 +87,21 @@ class MessageContainer extends React.Component {
}
}

shouldComponentUpdate(nextProps) {
const { theme, threadBadgeColor } = this.props;
shouldComponentUpdate(nextProps, nextState) {
const { isManualUnignored } = this.state;
const { theme, threadBadgeColor, isIgnored } = this.props;
if (nextProps.theme !== theme) {
return true;
}
if (nextProps.threadBadgeColor !== threadBadgeColor) {
return true;
}
if (nextProps.isIgnored !== isIgnored) {
return true;
}
if (nextState.isManualUnignored !== isManualUnignored) {
return true;
}
return false;
}

Expand All @@ -101,6 +112,10 @@ class MessageContainer extends React.Component {
}

onPress = debounce(() => {
if (this.isIgnored) {
return this.onIgnoredMessagePress();
}

const { item, isThreadRoom } = this.props;
KeyboardUtils.dismiss();

Expand Down Expand Up @@ -161,6 +176,10 @@ class MessageContainer extends React.Component {
}
}

onIgnoredMessagePress = () => {
this.setState({ isManualUnignored: true });
}

get isHeader() {
const {
item, previousItem, broadcast, Message_GroupingPeriod
Expand Down Expand Up @@ -226,6 +245,12 @@ class MessageContainer extends React.Component {
return item.status === messagesStatus.TEMP || item.status === messagesStatus.ERROR;
}

get isIgnored() {
const { isManualUnignored } = this.state;
const { isIgnored } = this.props;
return isManualUnignored ? false : isIgnored;
}

get hasError() {
const { item } = this.props;
return item.status === messagesStatus.ERROR;
Expand Down Expand Up @@ -311,6 +336,7 @@ class MessageContainer extends React.Component {
fetchThreadName={fetchThreadName}
mentions={mentions}
channels={channels}
isIgnored={this.isIgnored}
isEdited={editedBy && !!editedBy.username}
isHeader={this.isHeader}
isThreadReply={this.isThreadReply}
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/locales/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ export default {
Users: 'Benutzer',
User_added_by: 'Benutzer {{userAdded}} hinzugefügt von {{userBy}}',
User_Info: 'Benutzerinfo',
User_has_been_key: 'Benutzer wurde {{key}}!',
User_has_been_key: 'Benutzer wurde {{key}}',
User_is_no_longer_role_by_: '{{user}} ist nicht länger {{role}} von {{userBy}}',
User_muted_by: 'Benutzer {{userMuted}} von {{userBy}} stummgeschaltet',
User_removed_by: 'Benutzer {{userRemoved}} wurde von {{userBy}} entfernt',
Expand Down
26 changes: 24 additions & 2 deletions app/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ export default {
Users: 'Users',
User_added_by: 'User {{userAdded}} added by {{userBy}}',
User_Info: 'User Info',
User_has_been_key: 'User has been {{key}}!',
User_has_been_key: 'User has been {{key}}',
User_is_no_longer_role_by_: '{{user}} is no longer {{role}} by {{userBy}}',
User_muted_by: 'User {{userMuted}} muted by {{userBy}}',
User_removed_by: 'User {{userRemoved}} removed by {{userBy}}',
Expand Down Expand Up @@ -680,5 +680,27 @@ export default {
No_threads: 'There are no threads',
No_threads_following: 'You are not following any threads',
No_threads_unread: 'There are no unread threads',
Messagebox_Send_to_channel: 'Send to channel'
Messagebox_Send_to_channel: 'Send to channel',
Set_as_leader: 'Set as leader',
Set_as_moderator: 'Set as moderator',
Set_as_owner: 'Set as owner',
Remove_as_leader: 'Remove as leader',
Remove_as_moderator: 'Remove as moderator',
Remove_as_owner: 'Remove as owner',
Remove_from_room: 'Remove from room',
Ignore: 'Ignore',
Unignore: 'Unignore',
User_has_been_ignored: 'User has been ignored',
User_has_been_unignored: 'User is no longer ignored',
User_has_been_removed_from_s: 'User has been removed from {{s}}',
User__username__is_now_a_leader_of__room_name_: 'User {{username}} is now a leader of {{room_name}}',
User__username__is_now_a_moderator_of__room_name_: 'User {{username}} is now a moderator of {{room_name}}',
User__username__is_now_a_owner_of__room_name_: 'User {{username}} is now a owner of {{room_name}}',
User__username__removed_from__room_name__leaders: 'User {{username}} removed from {{room_name}} leaders',
User__username__removed_from__room_name__moderators: 'User {{username}} removed from {{room_name}} moderators',
User__username__removed_from__room_name__owners: 'User {{username}} removed from {{room_name}} owners',
The_user_will_be_removed_from_s: 'The user will be removed from {{s}}',
Yes_remove_user: 'Yes, remove user!',
Direct_message: 'Direct message',
Message_Ignored: 'Message ignored. Tap to display it.'
};
2 changes: 1 addition & 1 deletion app/i18n/locales/es-ES.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ export default {
Upload_file_question_mark: 'Subir fichero?',
Users: 'Usuarios',
User_added_by: 'Usuario {{userAdded}} añadido por {{userBy}}',
User_has_been_key: 'El usuario ha sido {{key}}!',
User_has_been_key: 'El usuario ha sido {{key}}',
User_is_no_longer_role_by_: '{{user}} ha dejado de ser {{role}} por {{userBy}}',
User_muted_by: 'Usuario {{userMuted}} muteado por {{userBy}}',
User_removed_by: 'Usuario {{userRemoved}} eliminado por {{userBy}}',
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/locales/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ export default {
Users: 'Utilisateurs',
User_added_by: 'L\'utilisateur {{userAdded}} a été ajouté par {{userBy}}',
User_Info: 'Info d\'utilisateur',
User_has_been_key: 'L\'utilisateur a été {{key}}!',
User_has_been_key: 'L\'utilisateur a été {{key}}',
User_is_no_longer_role_by_: '{{user}} n\'est plus {{role}} par {{userBy}}',
User_muted_by: 'L\'utilisateur {{userMuted}} a été rendu muet par {{userBy}}',
User_removed_by: 'L\'utilisateur {{userRemoved}} a été retiré par {{userBy}}',
Expand Down
2 changes: 1 addition & 1 deletion app/i18n/locales/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ export default {
Users: 'Utenti',
User_added_by: 'Utente {{userAdded}} aggiunto da {{userBy}}',
User_Info: 'Informazioni utente',
User_has_been_key: 'Utente {{key}}!',
User_has_been_key: 'Utente {{key}}',
User_is_no_longer_role_by_: '{{user}} non è più {{role}} da {{userBy}}',
User_muted_by: 'Utente {{userMuted}} silenziato da {{userBy}}',
User_removed_by: 'Utente {{userRemoved}} rimosso da {{userBy}}',
Expand Down
Loading