Revert "[FIX] Make attachment validation compatible with web client (#2927)" (#3036)

This reverts commit d6200745c0.
This commit is contained in:
Diego Mello 2021-04-05 14:36:04 -03:00 committed by GitHub
parent 71da1e370b
commit 8649c17f0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 301 deletions

View File

@ -29093,281 +29093,6 @@ exports[`Storyshots Message list message 1`] = `
</View>
</View>
</View>
<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={
Object {
"flexDirection": "row",
}
}
>
<View
style={
Array [
Object {
"borderRadius": 4,
"height": 36,
"width": 36,
},
Object {
"marginTop": 4,
},
]
}
>
<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": 4,
"height": 36,
"width": 36,
},
]
}
>
<FastImageView
resizeMode="cover"
source={
Object {
"headers": undefined,
"priority": "high",
"uri": "https://open.rocket.chat/avatar/diego.mello?format=png&size=36",
}
}
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
style={
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
}
}
>
<View
accessible={true}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"alignItems": "center",
"flex": 1,
"flexDirection": "row",
"opacity": 1,
}
}
>
<Text
numberOfLines={1}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "500",
"lineHeight": 22,
"textAlign": "left",
},
Object {
"color": "#0d0e12",
},
]
}
>
diego.mello
</Text>
</View>
<Text
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 12,
"fontWeight": "400",
"marginLeft": 8,
"textAlign": "left",
},
Object {
"color": "#9ca2a8",
},
]
}
>
10:00 AM
</Text>
</View>
<View>
<Text
numberOfLines={0}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
undefined,
Object {
"color": "#2f343d",
},
]
}
>
<Text
accessibilityLabel="Image should not render"
numberOfLines={0}
style={
Array [
Object {
"backgroundColor": "transparent",
"fontFamily": "System",
"fontSize": 16,
"fontWeight": "400",
"textAlign": "left",
},
Array [
Object {},
Object {
"alignItems": "flex-start",
"flexDirection": "row",
"flexWrap": "wrap",
"justifyContent": "flex-start",
"marginBottom": 0,
"marginTop": 0,
},
],
]
}
>
Image should not render
</Text>
</Text>
</View>
<View
accessible={true}
focusable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"alignItems": "center",
"alignSelf": "flex-start",
"backgroundColor": "#f3f4f5",
"borderColor": "#e1e5e8",
"borderRadius": 4,
"borderWidth": 1,
"flex": 1,
"flexDirection": "row",
"marginTop": 6,
"opacity": 1,
}
}
>
<View
style={
Object {
"borderRadius": 4,
"flex": 1,
"flexDirection": "column",
"padding": 15,
}
}
/>
</View>
</View>
</View>
</View>
</View>
</View>
<Text
style={
Array [

View File

@ -15,13 +15,13 @@ const Attachments = React.memo(({
}
return attachments.map((file, index) => {
if (file.type === 'file' && file.image_url) {
if (file.image_url) {
return <Image key={file.image_url} file={file} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} theme={theme} />;
}
if (file.type === 'file' && file.audio_url) {
if (file.audio_url) {
return <Audio key={file.audio_url} file={file} getCustomEmoji={getCustomEmoji} theme={theme} />;
}
if (file.type === 'file' && file.video_url) {
if (file.video_url) {
return <Video key={file.video_url} file={file} showAttachment={showAttachment} getCustomEmoji={getCustomEmoji} theme={theme} />;
}

View File

@ -346,21 +346,13 @@ export default ({ theme }) => {
attachments={[{
title: 'This is a title',
description: 'This is a description',
image_url: '/dummypath',
type: 'file'
image_url: '/dummypath'
}]}
/>
<Message
attachments={[{
title: 'This is a title',
description: 'This is a description :nyan_rocket:',
image_url: '/dummypath',
type: 'file'
}]}
/>
<Message
msg='Image should not render'
attachments={[{
image_url: '/dummypath'
}]}
/>
@ -370,15 +362,13 @@ export default ({ theme }) => {
attachments={[{
title: 'This is a title',
description: 'This is a description :nyan_rocket:',
video_url: '/dummypath',
type: 'file'
video_url: '/dummypath'
}]}
/>
<Message
attachments={[{
title: 'This is a title',
video_url: '/dummypath',
type: 'file'
video_url: '/dummypath'
}]}
/>
@ -387,8 +377,7 @@ export default ({ theme }) => {
attachments={[{
title: 'This is a title',
description: 'This is a description :nyan_rocket:',
audio_url: '/dummypath',
type: 'file'
audio_url: '/dummypath'
}]}
/>
<Message msg='First message' isHeader={false} />
@ -396,24 +385,21 @@ export default ({ theme }) => {
attachments={[{
title: 'This is a title',
description: 'This is a description',
audio_url: '/dummypath',
type: 'file'
audio_url: '/dummypath'
}]}
isHeader={false}
/>
<Message
attachments={[{
title: 'This is a title',
audio_url: '/dummypath',
type: 'file'
audio_url: '/dummypath'
}]}
isHeader={false}
/>
<Message
attachments={[{
title: 'This is a title',
audio_url: '/dummypath',
type: 'file'
audio_url: '/dummypath'
}]}
isHeader={false}
/>
@ -579,8 +565,7 @@ export default ({ theme }) => {
attachments={[{
title: 'This is a title',
description: 'This is a description',
audio_url: '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac',
type: 'file'
audio_url: '/file-upload/c4wcNhrbXJLBvAJtN/1535569819516.aac'
}]}
tmid='1'
isThreadSequential