Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-25640 - Leaving archived channel does not return user to the last viewed channel #5755

Merged
merged 4 commits into from
Jun 24, 2020

Conversation

cpoile
Copy link
Member

@cpoile cpoile commented Jun 18, 2020

Summary

  • Archived channels are removed from local storage automatically.
  • So, only if the current channel is /not/ an archived channel, remove the previous channel name from local storage

Ticket Link

@cpoile cpoile added 2: Dev Review Requires review by a core commiter 3: QA Review Requires review by a QA tester labels Jun 18, 2020
@cpoile cpoile force-pushed the MM-25640-leave-private-channel-bug branch from acbd25a to 055b1b4 Compare June 18, 2020 17:51
@cpoile
Copy link
Member Author

cpoile commented Jun 18, 2020

I can't figure out why the tests are saying TypeError: (0 , _channel_utils2.isArchivedChannel) is not a function -- do either of you guys know?

@agarciamontoro
Copy link
Member

I have absolutely no idea. I checked what the type of the symbol is with console.log(typeof(isArchivedChannel)); and it does print undefined. But it's defined! If you copypaste the same function in that file and remove the import, it works smoothly. I am intrigued 🤔

@cpoile
Copy link
Member Author

cpoile commented Jun 22, 2020

@saturninoabril would you have a moment to take a look at this? For some reason the function is not defined when the test runs, but it is defined and works in normal use. Any ideas?

@saturninoabril
Copy link
Member

saturninoabril commented Jun 22, 2020

Probably due to the mocking here - https://github.com/mattermost/mattermost-webapp/blob/master/actions/views/channel.test.js#L24 - that made it undefined. It should include the original and only mock the function as needed. I haven't tried but it should be something like,

jest.mock('utils/channel_utils.jsx', () => {
    const original = require.requireActual('utils/channel_utils.jsx');
    return {
        ...original,
        getRedirectChannelNameForTeam: () => 'town-square',
    };
});

@cpoile
Copy link
Member Author

cpoile commented Jun 22, 2020

Thank you @saturninoabril, that fixed it!

Copy link
Member

@jespino jespino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@agarciamontoro agarciamontoro removed the 2: Dev Review Requires review by a core commiter label Jun 23, 2020
@agarciamontoro
Copy link
Member

Oh, it makes sense now. Thank you Saturnino for the explanation, I was also curious about this!

@cpoile cpoile requested a review from jgilliam17 June 24, 2020 13:20
@cpoile
Copy link
Member Author

cpoile commented Jun 24, 2020

/update-branch

@jgilliam17 jgilliam17 added the Setup Cloud Test Server Setup a test server using Mattermost Cloud label Jun 24, 2020
Copy link
Contributor

@jgilliam17 jgilliam17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @cpoile
Tested, looks good to merge.

  • Verified user is returned to last viewed channel when leaving an archived channel.

@jgilliam17 jgilliam17 added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester Setup Cloud Test Server Setup a test server using Mattermost Cloud labels Jun 24, 2020
@mm-cloud-bot
Copy link

Test server destroyed

@cpoile cpoile merged commit 03a289a into master Jun 24, 2020
@cpoile cpoile deleted the MM-25640-leave-private-channel-bug branch June 24, 2020 19:06
@amyblais amyblais added this to the v5.25.0 milestone Jun 25, 2020
@amyblais amyblais added the CherryPick/Approved Meant for the quality or patch release tracked in the milestone label Jun 25, 2020
cpoile added a commit that referenced this pull request Jun 25, 2020
…viewed channel (#5755)

* archived channels close automatically; don't remove from local store

* small fix

* fix tests

Co-authored-by: Mattermod <[email protected]>
(cherry picked from commit 03a289a)
@cpoile cpoile added CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone and removed CherryPick/Approved Meant for the quality or patch release tracked in the milestone labels Jun 25, 2020
@cpoile cpoile removed their assignment Jun 25, 2020
@amyblais amyblais added Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation labels Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4: Reviews Complete All reviewers have approved the pull request Changelog/Done Required changelog entry has been written CherryPick/Done Successfully cherry-picked to the quality or patch release tracked in the milestone Docs/Not Needed Does not require documentation
Projects
None yet
8 participants