Skip to content

Commit e314362

Browse files
author
Amin Mahboubi
authored
Merge branch 'master' into vishal/docs-fix
2 parents 7c06976 + d0f07a3 commit e314362

File tree

13 files changed

+7800
-151
lines changed

13 files changed

+7800
-151
lines changed

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [3.0.0](https://github.com/GetStream/stream-chat-react/releases/tag/v3.0.0) 2020-09-30
4+
5+
### BREAKING CHANGES
6+
7+
- Image component renamed to ImageComponent [#554](https://github.com/GetStream/stream-chat-react/pull/554)
8+
9+
## [2.6.2](https://github.com/GetStream/stream-chat-react/releases/tag/v2.6.2) 2020-09-29
10+
11+
### Fix
12+
13+
- Fixed several type issues [#552](https://github.com/GetStream/stream-chat-react/pull/552)
14+
15+
## [2.6.1](https://github.com/GetStream/stream-chat-react/releases/tag/v2.6.1) 2020-09-29
16+
17+
### Fix
18+
19+
- Fixed an issue with MessageLivestream where mutes and flags were not happening [#551](https://github.com/GetStream/stream-chat-react/pull/551)
20+
321
## [2.6.0](https://github.com/GetStream/stream-chat-react/releases/tag/v2.6.0) 2020-09-29
422

523
### Feature

docs/build/bundle.852685aa.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/build/bundle.852685aa.js.LICENSE.txt

Lines changed: 7615 additions & 0 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "stream-chat-react",
3-
"version": "2.6.0",
3+
"version": "3.0.0",
44
"description": "React components to create chat conversations or livestream style chat",
55
"author": "GetStream",
66
"homepage": "https://getstream.io/chat/",

src/components/Attachment/Attachment.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ import DefaultAudio from './Audio';
1010
import DefaultCard from './Card';
1111
import DefaultFile from './FileAttachment';
1212

13-
import { Image as DefaultImage, Gallery as DefaultGallery } from '../Gallery';
13+
import {
14+
ImageComponent as DefaultImage,
15+
Gallery as DefaultGallery,
16+
} from '../Gallery';
1417

1518
export const SUPPORTED_VIDEO_FORMATS = [
1619
'video/mp4',
@@ -127,7 +130,7 @@ export const renderAttachmentActions = (props) => {
127130
export const renderGallery = (props) => {
128131
const { attachment: a, Gallery } = props;
129132
return renderAttachmentWithinContainer(
130-
<Gallery images={a.images} key="gallery" />,
133+
<Gallery images={a.images || []} key="gallery" />,
131134
a,
132135
'gallery',
133136
);

src/components/ChannelList/hooks/usePaginatedChannels.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useEffect, useState } from 'react';
44
import { MAX_QUERY_CHANNELS_LIMIT } from '../utils';
55
/**
66
* @typedef {import('stream-chat').Channel} Channel
7-
* @param {import('stream-chat').StreamChat} client
7+
* @param {import('types').StreamChatReactClient} client
88
* @param {import('stream-chat').ChannelFilters} filters
99
* @param {import('stream-chat').ChannelSort} [sort]
1010
* @param {import('stream-chat').ChannelOptions} [options]

src/components/ChannelList/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const moveChannelUp = (cid, channels) => {
2222
};
2323

2424
/**
25-
* @param {import('stream-chat').StreamChat} client
25+
* @param {import('types').StreamChatReactClient} client
2626
* @param {string} type
2727
* @param {string} id
2828
*/

src/components/Gallery/Image.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { sanitizeUrl } from '@braintree/sanitize-url';
1111
* @example ../../docs/Image.md
1212
* @extends {React.PureComponent<import('type').ImageProps>}
1313
*/
14-
class Image extends React.PureComponent {
14+
class ImageComponent extends React.PureComponent {
1515
static propTypes = {
1616
/** The full size image url */
1717
image_url: PropTypes.string,
@@ -56,4 +56,4 @@ class Image extends React.PureComponent {
5656
}
5757
}
5858

59-
export default Image;
59+
export default ImageComponent;

src/components/Gallery/__tests__/Image.test.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,27 @@ import { cleanup, render, fireEvent, waitFor } from '@testing-library/react';
55

66
import '@testing-library/jest-dom';
77

8-
import Image from '../Image';
8+
import ImageComponent from '../Image';
99

1010
const mockImageAssets = 'https://placeimg.com/640/480/any';
1111

1212
afterEach(cleanup); // eslint-disable-line
1313

1414
describe('Image', () => {
1515
it('should render component with default props', () => {
16-
const tree = renderer.create(<Image images={mockImageAssets} />).toJSON();
16+
const tree = renderer
17+
.create(<ImageComponent images={mockImageAssets} />)
18+
.toJSON();
1719
expect(tree).toMatchSnapshot();
1820
});
1921

2022
describe('it should prevent unsafe image uri protocols in the rendered image src', () => {
2123
it('should prevent javascript protocol in image src', () => {
2224
// eslint-disable-next-line no-script-url
2325
const xssJavascriptUri = 'javascript:alert("p0wn3d")';
24-
const { getByTestId } = render(<Image image_url={xssJavascriptUri} />);
26+
const { getByTestId } = render(
27+
<ImageComponent image_url={xssJavascriptUri} />,
28+
);
2529
expect(getByTestId('image-test')).not.toHaveAttribute(
2630
'src',
2731
xssJavascriptUri,
@@ -30,28 +34,30 @@ describe('Image', () => {
3034
it('should prevent javascript protocol in thumbnail src', () => {
3135
// eslint-disable-next-line no-script-url
3236
const xssJavascriptUri = 'javascript:alert("p0wn3d")';
33-
const { getByTestId } = render(<Image thumb_url={xssJavascriptUri} />);
37+
const { getByTestId } = render(
38+
<ImageComponent thumb_url={xssJavascriptUri} />,
39+
);
3440
expect(getByTestId('image-test')).not.toHaveAttribute(
3541
'src',
3642
xssJavascriptUri,
3743
);
3844
});
3945
it('should prevent dataUris in image src', () => {
4046
const xssDataUri = 'data:image/svg+xml;base64,DANGEROUSENCODEDSVG';
41-
const { getByTestId } = render(<Image image_url={xssDataUri} />);
47+
const { getByTestId } = render(<ImageComponent image_url={xssDataUri} />);
4248
expect(getByTestId('image-test')).not.toHaveAttribute('src', xssDataUri);
4349
});
4450
it('should prevent dataUris in thumb src', () => {
4551
const xssDataUri = 'data:image/svg+xml;base64,DANGEROUSENCODEDSVG';
46-
const { getByTestId } = render(<Image thumb_url={xssDataUri} />);
52+
const { getByTestId } = render(<ImageComponent thumb_url={xssDataUri} />);
4753
expect(getByTestId('image-test')).not.toHaveAttribute('src', xssDataUri);
4854
});
4955
});
5056

5157
it('should open modal on image click', async () => {
5258
jest.spyOn(console, 'warn').mockImplementation(() => null);
5359
const { getByTestId, getByTitle } = render(
54-
<Image images={mockImageAssets} />,
60+
<ImageComponent images={mockImageAssets} />,
5561
);
5662
fireEvent.click(getByTestId('image-test'));
5763

src/components/Gallery/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export { default as Gallery } from './Gallery';
2-
export { default as Image } from './Image';
2+
export { default as ImageComponent } from './Image';
33
export { default as ModalImage } from './ModalImage';
44
export { default as ModalWrapper } from './ModalWrapper';

0 commit comments

Comments
 (0)