diff --git a/plugins/chat/assets/javascripts/discourse/components/chat-browse-view.js b/plugins/chat/assets/javascripts/discourse/components/chat-browse-view.js index a453ad360fe..b270b19cd0b 100644 --- a/plugins/chat/assets/javascripts/discourse/components/chat-browse-view.js +++ b/plugins/chat/assets/javascripts/discourse/components/chat-browse-view.js @@ -87,6 +87,11 @@ export default class ChatBrowseView extends Component { showModal("create-channel"); } + @action + returnToChannelsList() { + return this.router.transitionTo("chat.index"); + } + @bind filterChannels(filter) { this.canLoadMore = true; diff --git a/plugins/chat/assets/javascripts/discourse/templates/components/chat-browse-view.hbs b/plugins/chat/assets/javascripts/discourse/templates/components/chat-browse-view.hbs index e9f255c6907..e184b88167d 100644 --- a/plugins/chat/assets/javascripts/discourse/templates/components/chat-browse-view.hbs +++ b/plugins/chat/assets/javascripts/discourse/templates/components/chat-browse-view.hbs @@ -6,6 +6,14 @@
+ {{#if this.site.mobileView}} + + {{/if}}

{{i18n "chat.browse.title"}}

{{#if this.currentUser.staff}} { return helper.response([]); }); + + server.get("/chat/api/chat_channels.json", () => { + const channels = []; + return helper.response(channels); + }); }); needs.settings({ @@ -54,4 +59,14 @@ acceptance("Discourse Chat - Mobile test", function (needs) { "Clicking the left arrow button returns to the channels list" ); }); + + test("Chat browse screen back button", async function (assert) { + await visit("/chat/browse"); + await click(".chat-browse-view__back"); + assert.strictEqual( + currentURL(), + "/chat", + "Clicking the back button returns to the channels list" + ); + }); });