diff --git a/app/components/post_list/post/system_message/__snapshots__/system_message_helpers.test.js.snap b/app/components/post_list/post/system_message/__snapshots__/system_message_helpers.test.js.snap
index 8d468555c..7f0b75b40 100644
--- a/app/components/post_list/post/system_message/__snapshots__/system_message_helpers.test.js.snap
+++ b/app/components/post_list/post/system_message/__snapshots__/system_message_helpers.test.js.snap
@@ -112,6 +112,124 @@ exports[`renderSystemMessage uses renderer for Channel Purpose update 1`] = `
`;
+exports[`renderSystemMessage uses renderer for Guest added and join to channel 1`] = `
+
+
+
+
+ @username
+
+
+
+ joined the channel as a guest.
+
+
+
+`;
+
+exports[`renderSystemMessage uses renderer for Guest added and join to channel 2`] = `
+
+
+
+
+ @other.user
+
+
+
+ added to the channel as a guest by
+
+
+
+ @username.
+
+
+
+
+`;
+
exports[`renderSystemMessage uses renderer for OLD archived channel without a username 1`] = `
{
+ if (!post.props.username || !post.props.addedUsername) {
+ return null;
+ }
+
+ const username = renderUsername(post.props.username);
+ const addedUsername = renderUsername(post.props.addedUsername);
+
+ const localeHolder = {
+ id: t('api.channel.add_guest.added'),
+ defaultMessage: '{addedUsername} added to the channel as a guest by {username}.',
+ };
+
+ const values = {username, addedUsername};
+ return renderMessage({post, styles, intl, localeHolder, values});
+};
+
+const renderGuestJoinChannelMessage = ({post, styles, intl}: RenderersProps) => {
+ if (!post.props.username) {
+ return null;
+ }
+
+ const username = renderUsername(post.props.username);
+ const localeHolder = {
+ id: t('api.channel.guest_join_channel.post_and_forget'),
+ defaultMessage: '{username} joined the channel as a guest.',
+ };
+
+ const values = {username};
+ return renderMessage({post, styles, intl, localeHolder, values});
+};
+
const systemMessageRenderers = {
[Posts.POST_TYPES.HEADER_CHANGE]: renderHeaderChangeMessage,
[Posts.POST_TYPES.DISPLAYNAME_CHANGE]: renderDisplayNameChangeMessage,
[Posts.POST_TYPES.PURPOSE_CHANGE]: renderPurposeChangeMessage,
[Posts.POST_TYPES.CHANNEL_DELETED]: renderArchivedMessage,
[Posts.POST_TYPES.CHANNEL_UNARCHIVED]: renderUnarchivedMessage,
+ [Posts.POST_TYPES.GUEST_JOIN_CHANNEL]: renderGuestJoinChannelMessage,
+ [Posts.POST_TYPES.ADD_GUEST_TO_CHANNEL]: renderAddGuestToChannelMessage,
};
const SystemMessage = ({post, ownerUsername, theme, intl}: SystemMessageProps) => {
diff --git a/app/components/post_list/post/system_message/system_message_helpers.test.js b/app/components/post_list/post/system_message/system_message_helpers.test.js
index 91d829369..07c9c9532 100644
--- a/app/components/post_list/post/system_message/system_message_helpers.test.js
+++ b/app/components/post_list/post/system_message/system_message_helpers.test.js
@@ -143,4 +143,39 @@ describe('renderSystemMessage', () => {
);
expect(renderedMessage.toJSON()).toBeNull();
});
+
+ test('uses renderer for Guest added and join to channel', () => {
+ const post = {
+ props: {
+ username: 'username',
+ },
+ type: Posts.POST_TYPES.GUEST_JOIN_CHANNEL,
+ };
+ const joined = renderWithReduxIntl(
+ ,
+ );
+ expect(joined.toJSON()).toMatchSnapshot();
+ expect(joined.getByText('@username')).toBeTruthy();
+ expect(joined.getByText(' joined the channel as a guest.')).toBeTruthy();
+
+ post.type = Posts.POST_TYPES.ADD_GUEST_TO_CHANNEL;
+ post.props = {
+ username: 'username',
+ addedUsername: 'other.user',
+ };
+
+ const added = renderWithReduxIntl(
+ ,
+ );
+ expect(added.toJSON()).toMatchSnapshot();
+ expect(added.getByText('@other.user')).toBeTruthy();
+ expect(added.getByText(' added to the channel as a guest by ')).toBeTruthy();
+ expect(added.getByText('@username.')).toBeTruthy();
+ });
});
diff --git a/assets/base/i18n/en.json b/assets/base/i18n/en.json
index 7a75a05e7..556036ae0 100644
--- a/assets/base/i18n/en.json
+++ b/assets/base/i18n/en.json
@@ -11,7 +11,9 @@
"about.teamEditiont1": "Enterprise Edition",
"about.title": "About {appTitle}",
"announcment_banner.dont_show_again": "Don't show again",
+ "api.channel.add_guest.added": "{addedUsername} added to the channel as a guest by {username}.",
"api.channel.add_member.added": "{addedUsername} added to the channel by {username}.",
+ "api.channel.guest_join_channel.post_and_forget": "{username} joined the channel as a guest.",
"apps.error": "Error: {error}",
"apps.error.command.field_missing": "Required fields missing: `{fieldName}`.",
"apps.error.command.unknown_channel": "Unknown channel for field `{fieldName}`: `{option}`.",