{"action":"created","comment":{"url":"https://api.github.com/repos/mattermost/platform/pulls/comments/45078166","id":45078166,"diff_hunk":"@@ -0,0 +1,48 @@\n+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.\n+// See License.txt for license information.\n+\n+export default class Modal extends ReactBootstrap.Modal {","path":"web/react/components/modal.jsx","position":4,"original_position":4,"commit_id":"fabdaace05706aee3ad1e77bb58998fe9b3672ce","original_commit_id":"e4ab542a259e4b55f30306406bae56096a3f6843","user":{"login":"hmhealey","id":3277310,"avatar_url":"https://avatars.githubusercontent.com/u/3277310?v=3","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},"body":"I agree that we'll need to be careful about how we use onShow, but it's no different than what we can currently do in componentDidUpdate or other lifecycle methods.\r\n\r\nSome of the examples that I gave aren't the best (we still need to come up with a better way to set the max height of modals), but there's still cases where it's valuable. Looking at the AccessHistoryModal, it requests stuff from the server when its shown since we don't need that data pulled otherwise and I think that's a good use case for this. There's also occasionally setup of UI state like clearing error messages which doesn't need to go back to the full stores.\r\n\r\nIn those cases, onShow is roughly equivalent to componentDidMount for these modal components. React-Bootstrap modals are mounted as soon as their parents are, even if they're not shown until much later. Having onShow lets us delay stuff until it's actually needed and allows it to trigger again if the dialog is hidden and then shown a second time.\r\n\r\nAlso, I looked into why they haven't included it in React-Bootstrap and they do have onEntering/onEntered which work like onPreshow/onShow, but they require that the modal is animated to work. There was some discussion about onShow, but they wanted something that was more similar to the existing onHide. They did say that a custom [ReactBootstrap.ModalDialog](https://github.com/react-bootstrap/react-bootstrap/blob/master/src/ModalDialog.js) could have proper lifecycle handles attached to it, but that seems like it's unnecessary for what we're doing since it would necessitate having two components for each modal.\r\n\r\nFor reference, I think using a custom ModalDialog would look like this:\r\n```javascript\r\nclass StuffModal extends React.Component {\r\n    render() {\r\n        return (\r\n            <Modal show={this.props.show} dialogComponent={StuffModalDialog}>\r\n                <Contents />\r\n            </Modal>\r\n        );\r\n    }\r\n}\r\n\r\nclass StuffModalDialog extends ReactBootstrap.ModalDialog {\r\n    componentDidMount() {\r\n        doStuff();\r\n    }\r\n}\r\n```\r\nAlternatively, Contents could be owned by StuffModalDialog, but that would require re-implementing the render method of ModalDialog.","created_at":"2015-11-17T16:03:09Z","updated_at":"2015-11-17T16:03:09Z","html_url":"https://github.com/mattermost/platform/pull/1423#discussion_r45078166","pull_request_url":"https://api.github.com/repos/mattermost/platform/pulls/1423","_links":{"self":{"href":"https://api.github.com/repos/mattermost/platform/pulls/comments/45078166"},"html":{"href":"https://github.com/mattermost/platform/pull/1423#discussion_r45078166"},"pull_request":{"href":"https://api.github.com/repos/mattermost/platform/pulls/1423"}}},"pull_request":{"url":"https://api.github.com/repos/mattermost/platform/pulls/1423","id":50648845,"html_url":"https://github.com/mattermost/platform/pull/1423","diff_url":"https://github.com/mattermost/platform/pull/1423.diff","patch_url":"https://github.com/mattermost/platform/pull/1423.patch","issue_url":"https://api.github.com/repos/mattermost/platform/issues/1423","number":1423,"state":"open","locked":false,"title":"PLT-737 Converted first set of Modals to ReactBootstrap","user":{"login":"hmhealey","id":3277310,"avatar_url":"https://avatars.githubusercontent.com/u/3277310?v=3","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},"body":"1. Adds the new Modal component with some extra events that ReactBootstrap.Modal doesn't normally provide\r\n2. Adds the ToggleModalButton component that encapsulates a bunch of repeated state changing logic used for modals\r\n3. Refactors the ChannelInfoModal, ChannelNotificationsModal, and DeleteChannelModal to use the new Modal class","created_at":"2015-11-13T14:52:15Z","updated_at":"2015-11-17T16:03:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3928f81b423475ea0e51778c710c3f19231fe05e","assignee":{"login":"crspeller","id":3191642,"avatar_url":"https://avatars.githubusercontent.com/u/3191642?v=3","gravatar_id":"","url":"https://api.github.com/users/crspeller","html_url":"https://github.com/crspeller","followers_url":"https://api.github.com/users/crspeller/followers","following_url":"https://api.github.com/users/crspeller/following{/other_user}","gists_url":"https://api.github.com/users/crspeller/gists{/gist_id}","starred_url":"https://api.github.com/users/crspeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crspeller/subscriptions","organizations_url":"https://api.github.com/users/crspeller/orgs","repos_url":"https://api.github.com/users/crspeller/repos","events_url":"https://api.github.com/users/crspeller/events{/privacy}","received_events_url":"https://api.github.com/users/crspeller/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/mattermost/platform/milestones/7","html_url":"https://github.com/mattermost/platform/milestones/v1.3.0","labels_url":"https://api.github.com/repos/mattermost/platform/milestones/7/labels","id":1389557,"number":7,"title":"v1.3.0","description":"","creator":{"login":"crspeller","id":3191642,"avatar_url":"https://avatars.githubusercontent.com/u/3191642?v=3","gravatar_id":"","url":"https://api.github.com/users/crspeller","html_url":"https://github.com/crspeller","followers_url":"https://api.github.com/users/crspeller/followers","following_url":"https://api.github.com/users/crspeller/following{/other_user}","gists_url":"https://api.github.com/users/crspeller/gists{/gist_id}","starred_url":"https://api.github.com/users/crspeller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crspeller/subscriptions","organizations_url":"https://api.github.com/users/crspeller/orgs","repos_url":"https://api.github.com/users/crspeller/repos","events_url":"https://api.github.com/users/crspeller/events{/privacy}","received_events_url":"https://api.github.com/users/crspeller/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":39,"state":"open","created_at":"2015-11-02T18:18:35Z","updated_at":"2015-11-17T01:55:13Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/mattermost/platform/pulls/1423/commits","review_comments_url":"https://api.github.com/repos/mattermost/platform/pulls/1423/comments","review_comment_url":"https://api.github.com/repos/mattermost/platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mattermost/platform/issues/1423/comments","statuses_url":"https://api.github.com/repos/mattermost/platform/statuses/fabdaace05706aee3ad1e77bb58998fe9b3672ce","head":{"label":"hmhealey:plt737","ref":"plt737","sha":"fabdaace05706aee3ad1e77bb58998fe9b3672ce","user":{"login":"hmhealey","id":3277310,"avatar_url":"https://avatars.githubusercontent.com/u/3277310?v=3","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},"repo":{"id":38433989,"name":"mattermost-platform","full_name":"hmhealey/mattermost-platform","owner":{"login":"hmhealey","id":3277310,"avatar_url":"https://avatars.githubusercontent.com/u/3277310?v=3","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},"private":false,"html_url":"https://github.com/hmhealey/mattermost-platform","description":"Open source team communication across PC & phones, with archiving & search, in Golang and React","fork":true,"url":"https://api.github.com/repos/hmhealey/mattermost-platform","forks_url":"https://api.github.com/repos/hmhealey/mattermost-platform/forks","keys_url":"https://api.github.com/repos/hmhealey/mattermost-platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hmhealey/mattermost-platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hmhealey/mattermost-platform/teams","hooks_url":"https://api.github.com/repos/hmhealey/mattermost-platform/hooks","issue_events_url":"https://api.github.com/repos/hmhealey/mattermost-platform/issues/events{/number}","events_url":"https://api.github.com/repos/hmhealey/mattermost-platform/events","assignees_url":"https://api.github.com/repos/hmhealey/mattermost-platform/assignees{/user}","branches_url":"https://api.github.com/repos/hmhealey/mattermost-platform/branches{/branch}","tags_url":"https://api.github.com/repos/hmhealey/mattermost-platform/tags","blobs_url":"https://api.github.com/repos/hmhealey/mattermost-platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hmhealey/mattermost-platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hmhealey/mattermost-platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/hmhealey/mattermost-platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hmhealey/mattermost-platform/statuses/{sha}","languages_url":"https://api.github.com/repos/hmhealey/mattermost-platform/languages","stargazers_url":"https://api.github.com/repos/hmhealey/mattermost-platform/stargazers","contributors_url":"https://api.github.com/repos/hmhealey/mattermost-platform/contributors","subscribers_url":"https://api.github.com/repos/hmhealey/mattermost-platform/subscribers","subscription_url":"https://api.github.com/repos/hmhealey/mattermost-platform/subscription","commits_url":"https://api.github.com/repos/hmhealey/mattermost-platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/hmhealey/mattermost-platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/hmhealey/mattermost-platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/hmhealey/mattermost-platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/hmhealey/mattermost-platform/contents/{+path}","compare_url":"https://api.github.com/repos/hmhealey/mattermost-platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hmhealey/mattermost-platform/merges","archive_url":"https://api.github.com/repos/hmhealey/mattermost-platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hmhealey/mattermost-platform/downloads","issues_url":"https://api.github.com/repos/hmhealey/mattermost-platform/issues{/number}","pulls_url":"https://api.github.com/repos/hmhealey/mattermost-platform/pulls{/number}","milestones_url":"https://api.github.com/repos/hmhealey/mattermost-platform/milestones{/number}","notifications_url":"https://api.github.com/repos/hmhealey/mattermost-platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hmhealey/mattermost-platform/labels{/name}","releases_url":"https://api.github.com/repos/hmhealey/mattermost-platform/releases{/id}","created_at":"2015-07-02T13:21:29Z","updated_at":"2015-07-08T20:07:52Z","pushed_at":"2015-11-16T15:12:48Z","git_url":"git://github.com/hmhealey/mattermost-platform.git","ssh_url":"git@github.com:hmhealey/mattermost-platform.git","clone_url":"https://github.com/hmhealey/mattermost-platform.git","svn_url":"https://github.com/hmhealey/mattermost-platform","homepage":"http://mattermost.org","size":20241,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mattermost:master","ref":"master","sha":"675e4e714971af7bc0525ad9dfe2eef3f7ed7562","user":{"login":"mattermost","id":9828093,"avatar_url":"https://avatars.githubusercontent.com/u/9828093?v=3","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://avatars.githubusercontent.com/u/9828093?v=3","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}","created_at":"2015-06-15T06:50:02Z","updated_at":"2015-11-17T09:55:49Z","pushed_at":"2015-11-17T12:58:20Z","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":"http://mattermost.org","size":21677,"stargazers_count":5650,"watchers_count":5650,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":491,"mirror_url":null,"open_issues_count":56,"forks":491,"open_issues":56,"watchers":5650,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mattermost/platform/pulls/1423"},"html":{"href":"https://github.com/mattermost/platform/pull/1423"},"issue":{"href":"https://api.github.com/repos/mattermost/platform/issues/1423"},"comments":{"href":"https://api.github.com/repos/mattermost/platform/issues/1423/comments"},"review_comments":{"href":"https://api.github.com/repos/mattermost/platform/pulls/1423/comments"},"review_comment":{"href":"https://api.github.com/repos/mattermost/platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mattermost/platform/pulls/1423/commits"},"statuses":{"href":"https://api.github.com/repos/mattermost/platform/statuses/fabdaace05706aee3ad1e77bb58998fe9b3672ce"}}}}