{"action":"created","comment":{"url":"https://api.github.com/repos/mattermost/platform/pulls/comments/130119235","pull_request_review_id":52963777,"id":130119235,"diff_hunk":"@@ -0,0 +1,404 @@\n+// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.\n+// See License.txt for license information.\n+\n+import * as Utils from 'utils/channel_utils.jsx';\n+import TeamStore from 'stores/team_store.jsx';\n+import UserStore from 'stores/user_store.jsx';\n+import ChannelStore from 'stores/channel_store.jsx';\n+import Constants from 'utils/constants.jsx';\n+\n+describe('Channel Utils', () => {\n+    describe('showDeleteOption', () => {\n+        test('all users can delete channels on unlicensed instances', () => {\n+            global.window.mm_license = {IsLicensed: 'false'};\n+            expect(Utils.showDeleteOptionForCurrentUser(null)).\n+                toEqual(true);\n+        });\n+\n+        test('users cannot delete default channels', () => {\n+            global.window.mm_license = {IsLicensed: 'true'};\n+            const channel = {name: Constants.DEFAULT_CHANNEL};\n+            expect(Utils.showDeleteOptionForCurrentUser(channel)).\n+                toEqual(false);\n+        });\n+\n+        test('system admins can delete private channels, user is system admin test', () => {\n+            global.window.mm_license = {IsLicensed: 'true'};\n+            global.window.mm_config = {RestrictPrivateChannelDeletion: Constants.PERMISSIONS_SYSTEM_ADMIN};\n+            UserStore.isSystemAdminForCurrentUser = () => {\n+                return true;\n+            };","path":"webapp/tests/utils/channel_utils.test.jsx","position":30,"original_position":30,"commit_id":"c51bd362672398cfe91d40831f69898b939ba76e","original_commit_id":"c51bd362672398cfe91d40831f69898b939ba76e","user":{"login":"MusikPolice","id":1799952,"avatar_url":"https://avatars2.githubusercontent.com/u/1799952?v=4","gravatar_id":"","url":"https://api.github.com/users/MusikPolice","html_url":"https://github.com/MusikPolice","followers_url":"https://api.github.com/users/MusikPolice/followers","following_url":"https://api.github.com/users/MusikPolice/following{/other_user}","gists_url":"https://api.github.com/users/MusikPolice/gists{/gist_id}","starred_url":"https://api.github.com/users/MusikPolice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusikPolice/subscriptions","organizations_url":"https://api.github.com/users/MusikPolice/orgs","repos_url":"https://api.github.com/users/MusikPolice/repos","events_url":"https://api.github.com/users/MusikPolice/events{/privacy}","received_events_url":"https://api.github.com/users/MusikPolice/received_events","type":"User","site_admin":false},"body":"Same question as above: I'm trying to create a mock UserStore that always returns true, regardless of the current user. The code under test accesses isSystemAdminForCurrentUser in a static way - it doesn't have an instance of UserStore, so the concern is that if I make isSystemAdminForCurrentUser a mock method in this test, it might still be that mock method in a later test. Or is that not a problem because of some scoping behaviour that I don't know about?","created_at":"2017-07-28T15:32:23Z","updated_at":"2017-07-28T15:32:23Z","html_url":"https://github.com/mattermost/platform/pull/7050#discussion_r130119235","pull_request_url":"https://api.github.com/repos/mattermost/platform/pulls/7050","_links":{"self":{"href":"https://api.github.com/repos/mattermost/platform/pulls/comments/130119235"},"html":{"href":"https://github.com/mattermost/platform/pull/7050#discussion_r130119235"},"pull_request":{"href":"https://api.github.com/repos/mattermost/platform/pulls/7050"}}},"pull_request":{"url":"https://api.github.com/repos/mattermost/platform/pulls/7050","id":132994116,"html_url":"https://github.com/mattermost/platform/pull/7050","diff_url":"https://github.com/mattermost/platform/pull/7050.diff","patch_url":"https://github.com/mattermost/platform/pull/7050.patch","issue_url":"https://api.github.com/repos/mattermost/platform/issues/7050","number":7050,"state":"open","locked":false,"title":"PLT-7206: Remove the \"Delete Channel\" option for private channels if you're the last channel member and policy setting restricts channel deletion","user":{"login":"MusikPolice","id":1799952,"avatar_url":"https://avatars2.githubusercontent.com/u/1799952?v=4","gravatar_id":"","url":"https://api.github.com/users/MusikPolice","html_url":"https://github.com/MusikPolice","followers_url":"https://api.github.com/users/MusikPolice/followers","following_url":"https://api.github.com/users/MusikPolice/following{/other_user}","gists_url":"https://api.github.com/users/MusikPolice/gists{/gist_id}","starred_url":"https://api.github.com/users/MusikPolice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusikPolice/subscriptions","organizations_url":"https://api.github.com/users/MusikPolice/orgs","repos_url":"https://api.github.com/users/MusikPolice/repos","events_url":"https://api.github.com/users/MusikPolice/events{/privacy}","received_events_url":"https://api.github.com/users/MusikPolice/received_events","type":"User","site_admin":false},"body":"#### Summary\r\nUI changes. Removed last user in channel loophole, refactored code to clean it up, added differentiated support for public and private channels, added unit tests. \r\n\r\n**NOTE:** Still need to implement server-side checks\r\n\r\n#### Ticket Link\r\nhttps://mattermost.atlassian.net/browse/PLT-7206\r\n\r\n#### Checklist\r\n[Place an '[x]' (no spaces) in all applicable fields. Please remove unrelated fields.]\r\n- [x] Added or updated unit tests (required for all new features)\r\n- [x] Has enterprise changes (please link)","created_at":"2017-07-28T15:28:34Z","updated_at":"2017-07-28T15:32:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c59949afa72d8b7fa7019ed7b0f077e0c28e96a","assignee":{"login":"MusikPolice","id":1799952,"avatar_url":"https://avatars2.githubusercontent.com/u/1799952?v=4","gravatar_id":"","url":"https://api.github.com/users/MusikPolice","html_url":"https://github.com/MusikPolice","followers_url":"https://api.github.com/users/MusikPolice/followers","following_url":"https://api.github.com/users/MusikPolice/following{/other_user}","gists_url":"https://api.github.com/users/MusikPolice/gists{/gist_id}","starred_url":"https://api.github.com/users/MusikPolice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusikPolice/subscriptions","organizations_url":"https://api.github.com/users/MusikPolice/orgs","repos_url":"https://api.github.com/users/MusikPolice/repos","events_url":"https://api.github.com/users/MusikPolice/events{/privacy}","received_events_url":"https://api.github.com/users/MusikPolice/received_events","type":"User","site_admin":false},"assignees":[{"login":"MusikPolice","id":1799952,"avatar_url":"https://avatars2.githubusercontent.com/u/1799952?v=4","gravatar_id":"","url":"https://api.github.com/users/MusikPolice","html_url":"https://github.com/MusikPolice","followers_url":"https://api.github.com/users/MusikPolice/followers","following_url":"https://api.github.com/users/MusikPolice/following{/other_user}","gists_url":"https://api.github.com/users/MusikPolice/gists{/gist_id}","starred_url":"https://api.github.com/users/MusikPolice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MusikPolice/subscriptions","organizations_url":"https://api.github.com/users/MusikPolice/orgs","repos_url":"https://api.github.com/users/MusikPolice/repos","events_url":"https://api.github.com/users/MusikPolice/events{/privacy}","received_events_url":"https://api.github.com/users/MusikPolice/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"grundleborg","id":1198059,"avatar_url":"https://avatars1.githubusercontent.com/u/1198059?v=4","gravatar_id":"","url":"https://api.github.com/users/grundleborg","html_url":"https://github.com/grundleborg","followers_url":"https://api.github.com/users/grundleborg/followers","following_url":"https://api.github.com/users/grundleborg/following{/other_user}","gists_url":"https://api.github.com/users/grundleborg/gists{/gist_id}","starred_url":"https://api.github.com/users/grundleborg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grundleborg/subscriptions","organizations_url":"https://api.github.com/users/grundleborg/orgs","repos_url":"https://api.github.com/users/grundleborg/repos","events_url":"https://api.github.com/users/grundleborg/events{/privacy}","received_events_url":"https://api.github.com/users/grundleborg/received_events","type":"User","site_admin":false},{"login":"hmhealey","id":3277310,"avatar_url":"https://avatars3.githubusercontent.com/u/3277310?v=4","gravatar_id":"","url":"https://api.github.com/users/hmhealey","html_url":"https://github.com/hmhealey","followers_url":"https://api.github.com/users/hmhealey/followers","following_url":"https://api.github.com/users/hmhealey/following{/other_user}","gists_url":"https://api.github.com/users/hmhealey/gists{/gist_id}","starred_url":"https://api.github.com/users/hmhealey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmhealey/subscriptions","organizations_url":"https://api.github.com/users/hmhealey/orgs","repos_url":"https://api.github.com/users/hmhealey/repos","events_url":"https://api.github.com/users/hmhealey/events{/privacy}","received_events_url":"https://api.github.com/users/hmhealey/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/mattermost/platform/milestones/25","html_url":"https://github.com/mattermost/platform/milestone/25","labels_url":"https://api.github.com/repos/mattermost/platform/milestones/25/labels","id":2610705,"number":25,"title":"v4.1.0","description":"","creator":{"login":"jasonblais","id":13119842,"avatar_url":"https://avatars1.githubusercontent.com/u/13119842?v=4","gravatar_id":"","url":"https://api.github.com/users/jasonblais","html_url":"https://github.com/jasonblais","followers_url":"https://api.github.com/users/jasonblais/followers","following_url":"https://api.github.com/users/jasonblais/following{/other_user}","gists_url":"https://api.github.com/users/jasonblais/gists{/gist_id}","starred_url":"https://api.github.com/users/jasonblais/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasonblais/subscriptions","organizations_url":"https://api.github.com/users/jasonblais/orgs","repos_url":"https://api.github.com/users/jasonblais/repos","events_url":"https://api.github.com/users/jasonblais/events{/privacy}","received_events_url":"https://api.github.com/users/jasonblais/received_events","type":"User","site_admin":false},"open_issues":29,"closed_issues":44,"state":"open","created_at":"2017-06-28T20:02:45Z","updated_at":"2017-07-28T15:28:34Z","due_on":"2017-08-16T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/mattermost/platform/pulls/7050/commits","review_comments_url":"https://api.github.com/repos/mattermost/platform/pulls/7050/comments","review_comment_url":"https://api.github.com/repos/mattermost/platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mattermost/platform/issues/7050/comments","statuses_url":"https://api.github.com/repos/mattermost/platform/statuses/c51bd362672398cfe91d40831f69898b939ba76e","head":{"label":"mattermost:PLT-7206","ref":"PLT-7206","sha":"c51bd362672398cfe91d40831f69898b939ba76e","user":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"repo":{"id":37448451,"name":"platform","full_name":"mattermost/platform","owner":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mattermost/platform","description":"Open source Slack-alternative in Golang and React - Mattermost","fork":false,"url":"https://api.github.com/repos/mattermost/platform","forks_url":"https://api.github.com/repos/mattermost/platform/forks","keys_url":"https://api.github.com/repos/mattermost/platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattermost/platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattermost/platform/teams","hooks_url":"https://api.github.com/repos/mattermost/platform/hooks","issue_events_url":"https://api.github.com/repos/mattermost/platform/issues/events{/number}","events_url":"https://api.github.com/repos/mattermost/platform/events","assignees_url":"https://api.github.com/repos/mattermost/platform/assignees{/user}","branches_url":"https://api.github.com/repos/mattermost/platform/branches{/branch}","tags_url":"https://api.github.com/repos/mattermost/platform/tags","blobs_url":"https://api.github.com/repos/mattermost/platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattermost/platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattermost/platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattermost/platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattermost/platform/statuses/{sha}","languages_url":"https://api.github.com/repos/mattermost/platform/languages","stargazers_url":"https://api.github.com/repos/mattermost/platform/stargazers","contributors_url":"https://api.github.com/repos/mattermost/platform/contributors","subscribers_url":"https://api.github.com/repos/mattermost/platform/subscribers","subscription_url":"https://api.github.com/repos/mattermost/platform/subscription","commits_url":"https://api.github.com/repos/mattermost/platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattermost/platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattermost/platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattermost/platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattermost/platform/contents/{+path}","compare_url":"https://api.github.com/repos/mattermost/platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattermost/platform/merges","archive_url":"https://api.github.com/repos/mattermost/platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattermost/platform/downloads","issues_url":"https://api.github.com/repos/mattermost/platform/issues{/number}","pulls_url":"https://api.github.com/repos/mattermost/platform/pulls{/number}","milestones_url":"https://api.github.com/repos/mattermost/platform/milestones{/number}","notifications_url":"https://api.github.com/repos/mattermost/platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattermost/platform/labels{/name}","releases_url":"https://api.github.com/repos/mattermost/platform/releases{/id}","deployments_url":"https://api.github.com/repos/mattermost/platform/deployments","created_at":"2015-06-15T06:50:02Z","updated_at":"2017-07-28T14:12:16Z","pushed_at":"2017-07-28T15:28:34Z","git_url":"git://github.com/mattermost/platform.git","ssh_url":"git@github.com:mattermost/platform.git","clone_url":"https://github.com/mattermost/platform.git","svn_url":"https://github.com/mattermost/platform","homepage":"https://mattermost.com","size":115271,"stargazers_count":10768,"watchers_count":10768,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1691,"mirror_url":null,"open_issues_count":197,"forks":1691,"open_issues":197,"watchers":10768,"default_branch":"master"}},"base":{"label":"mattermost:master","ref":"master","sha":"2d43e9975762b3bd4e6ede6c4db1e16ac661ab87","user":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"repo":{"id":37448451,"name":"platform","full_name":"mattermost/platform","owner":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mattermost/platform","description":"Open source Slack-alternative in Golang and React - Mattermost","fork":false,"url":"https://api.github.com/repos/mattermost/platform","forks_url":"https://api.github.com/repos/mattermost/platform/forks","keys_url":"https://api.github.com/repos/mattermost/platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattermost/platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattermost/platform/teams","hooks_url":"https://api.github.com/repos/mattermost/platform/hooks","issue_events_url":"https://api.github.com/repos/mattermost/platform/issues/events{/number}","events_url":"https://api.github.com/repos/mattermost/platform/events","assignees_url":"https://api.github.com/repos/mattermost/platform/assignees{/user}","branches_url":"https://api.github.com/repos/mattermost/platform/branches{/branch}","tags_url":"https://api.github.com/repos/mattermost/platform/tags","blobs_url":"https://api.github.com/repos/mattermost/platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattermost/platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattermost/platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattermost/platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattermost/platform/statuses/{sha}","languages_url":"https://api.github.com/repos/mattermost/platform/languages","stargazers_url":"https://api.github.com/repos/mattermost/platform/stargazers","contributors_url":"https://api.github.com/repos/mattermost/platform/contributors","subscribers_url":"https://api.github.com/repos/mattermost/platform/subscribers","subscription_url":"https://api.github.com/repos/mattermost/platform/subscription","commits_url":"https://api.github.com/repos/mattermost/platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattermost/platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattermost/platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattermost/platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattermost/platform/contents/{+path}","compare_url":"https://api.github.com/repos/mattermost/platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattermost/platform/merges","archive_url":"https://api.github.com/repos/mattermost/platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattermost/platform/downloads","issues_url":"https://api.github.com/repos/mattermost/platform/issues{/number}","pulls_url":"https://api.github.com/repos/mattermost/platform/pulls{/number}","milestones_url":"https://api.github.com/repos/mattermost/platform/milestones{/number}","notifications_url":"https://api.github.com/repos/mattermost/platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattermost/platform/labels{/name}","releases_url":"https://api.github.com/repos/mattermost/platform/releases{/id}","deployments_url":"https://api.github.com/repos/mattermost/platform/deployments","created_at":"2015-06-15T06:50:02Z","updated_at":"2017-07-28T14:12:16Z","pushed_at":"2017-07-28T15:28:34Z","git_url":"git://github.com/mattermost/platform.git","ssh_url":"git@github.com:mattermost/platform.git","clone_url":"https://github.com/mattermost/platform.git","svn_url":"https://github.com/mattermost/platform","homepage":"https://mattermost.com","size":115271,"stargazers_count":10768,"watchers_count":10768,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1691,"mirror_url":null,"open_issues_count":197,"forks":1691,"open_issues":197,"watchers":10768,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mattermost/platform/pulls/7050"},"html":{"href":"https://github.com/mattermost/platform/pull/7050"},"issue":{"href":"https://api.github.com/repos/mattermost/platform/issues/7050"},"comments":{"href":"https://api.github.com/repos/mattermost/platform/issues/7050/comments"},"review_comments":{"href":"https://api.github.com/repos/mattermost/platform/pulls/7050/comments"},"review_comment":{"href":"https://api.github.com/repos/mattermost/platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mattermost/platform/pulls/7050/commits"},"statuses":{"href":"https://api.github.com/repos/mattermost/platform/statuses/c51bd362672398cfe91d40831f69898b939ba76e"}}}}
{"actor":{"display_login":"MusikPolice"}}