{"action":"created","comment":{"url":"https://api.github.com/repos/haiwen/seahub/pulls/comments/243789246","pull_request_review_id":187648437,"id":243789246,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0Mzc4OTI0Ng==","diff_hunk":"@@ -0,0 +1,214 @@\n+import React from 'react';\n+import AsyncSelect from 'react-select/lib/Async';\n+import PropTypes from 'prop-types';\n+import { gettext } from '../../utils/constants';\n+import { Button, Modal, ModalHeader, ModalBody, ModalFooter, Table } from 'reactstrap';\n+import { seafileAPI } from '../../utils/seafile-api.js';\n+import '../../css/manage-members-dialog.css';\n+\n+class ManageMembersDialog extends React.Component {\n+\n+  constructor(props) {\n+    super(props);\n+    this.state = {\n+      groupMembers: [],\n+      selectedOption: null,\n+      errMessage: '',\n+    };\n+    this.Options = [];\n+  }\n+\n+  handleSelectChange = (option) => {\n+    this.setState({\n+      selectedOption: option,\n+      errMessage: '',\n+    });\n+    this.Options = [];\n+  }\n+\n+  loadOptions = (value, callback) => {\n+    if (value.trim().length > 0) {\n+      seafileAPI.searchUsers(value.trim()).then((res) => {\n+        this.Options = [];\n+        for (let i = 0 ; i < res.data.users.length; i++) {\n+          let obj = {};\n+          obj.value = res.data.users[i].name;\n+          obj.email = res.data.users[i].email;\n+          obj.label =\n+            <React.Fragment>\n+              <img src={res.data.users[i].avatar_url} className=\"avatar\" alt=\"\"/>\n+              <span className=\"transfer-group-name\">{res.data.users[i].name}</span>\n+            </React.Fragment>;\n+          this.Options.push(obj);\n+        }\n+        callback(this.Options);\n+      });\n+    }\n+  }\n+\n+  addGroupMember = () => {\n+    if (this.state.selectedOption.email) {\n+      this.refs.memberSelect.select.onChange([], { action: 'clear' });\n+      let that = this;\n+      seafileAPI.addGroupMember(this.props.groupID, this.state.selectedOption.email).then((res) => {\n+        that.listGroupMembers();\n+      }).catch((error) => {\n+        if (error.response) {\n+          this.setState({\n+            errMessage: error.response.data.error_msg\n+          });\n+        }\n+      });\n+      this.setState({\n+        selectedOption: null,\n+      });\n+      this.Options = [];\n+    }\n+  }\n+\n+  listGroupMembers = () => {\n+    seafileAPI.listGroupMembers(this.props.groupID).then((res) => {\n+      this.setState({\n+        groupMembers: res.data\n+      });\n+    });\n+  }\n+\n+  deleteMember = (e) => {\n+    let userName = e.target.getAttribute('name');\n+    let that = this;\n+    seafileAPI.deleteGroupMember(this.props.groupID, userName).then((res) => {\n+      that.listGroupMembers();\n+    });\n+  }\n+\n+  componentWillMount() {\n+    this.listGroupMembers();\n+  }\n+\n+  render() {\n+    return (\n+      <Modal isOpen={this.props.showManageMembersDialog}>\n+        <ModalHeader>{gettext('Manage group members')}</ModalHeader>\n+        <ModalBody>\n+          <p>{gettext('Add group member')}</p>\n+          <AsyncSelect className='group-transfer-select' isClearable classNamePrefix\n+            loadOptions={this.loadOptions} onChange={this.handleSelectChange}\n+            placeholder={gettext('Search users...')} ref=\"memberSelect\"\n+          />\n+          <span className=\"error\">{this.state.errMessage}</span>\n+          <Table hover size=\"sm\" className=\"manage-members-table\">\n+            <thead>\n+              <tr>\n+                <th width=\"15%\"></th>\n+                <th width=\"45%\">{gettext('Name')}</th>\n+                <th width=\"30%\">{gettext('Role')}</th>\n+                <th width=\"10%\"></th>\n+              </tr>\n+            </thead>\n+            <tbody>\n+              {\n+                this.state.groupMembers.length > 0 &&\n+                this.state.groupMembers.map((item, index = 0) => {\n+                  return (\n+                    <tr key={index} >\n+                      <th scope=\"row\"><img className=\"avatar\" src={item.avatar_url} alt=\"\"/></th>\n+                      <td>{item.name}</td>\n+                      <td>\n+                        { item.role === 'Owner' ?\n+                          <span className=\"group-admin\">{item.role}</span> :\n+                          <ChangeMemberAdmin item={item} listGroupMembers={this.listGroupMembers}\n+                            groupID={this.props.groupID}/>\n+                        }\n+                      </td>\n+                      <td>\n+                        { item.role !== 'Owner' &&\n+                          <i className=\"fa fa-times delete-group-member-icon\"\n+                            name={item.email} onClick={this.deleteMember}></i>","path":"frontend/src/components/dialog/manage-members-dialog.js","position":127,"original_position":127,"commit_id":"7d8cedb23341dc0745138612545d25938fc4eccd","original_commit_id":"7d8cedb23341dc0745138612545d25938fc4eccd","user":{"login":"Michael18811380328","id":37589122,"node_id":"MDQ6VXNlcjM3NTg5MTIy","avatar_url":"https://avatars3.githubusercontent.com/u/37589122?v=4","gravatar_id":"","url":"https://api.github.com/users/Michael18811380328","html_url":"https://github.com/Michael18811380328","followers_url":"https://api.github.com/users/Michael18811380328/followers","following_url":"https://api.github.com/users/Michael18811380328/following{/other_user}","gists_url":"https://api.github.com/users/Michael18811380328/gists{/gist_id}","starred_url":"https://api.github.com/users/Michael18811380328/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Michael18811380328/subscriptions","organizations_url":"https://api.github.com/users/Michael18811380328/orgs","repos_url":"https://api.github.com/users/Michael18811380328/repos","events_url":"https://api.github.com/users/Michael18811380328/events{/privacy}","received_events_url":"https://api.github.com/users/Michael18811380328/received_events","type":"User","site_admin":false},"body":"好的","created_at":"2018-12-24T05:55:36Z","updated_at":"2018-12-24T05:55:36Z","html_url":"https://github.com/haiwen/seahub/pull/2696#discussion_r243789246","pull_request_url":"https://api.github.com/repos/haiwen/seahub/pulls/2696","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/haiwen/seahub/pulls/comments/243789246"},"html":{"href":"https://github.com/haiwen/seahub/pull/2696#discussion_r243789246"},"pull_request":{"href":"https://api.github.com/repos/haiwen/seahub/pulls/2696"}},"in_reply_to_id":243788832},"pull_request":{"url":"https://api.github.com/repos/haiwen/seahub/pulls/2696","id":240618149,"node_id":"MDExOlB1bGxSZXF1ZXN0MjQwNjE4MTQ5","html_url":"https://github.com/haiwen/seahub/pull/2696","diff_url":"https://github.com/haiwen/seahub/pull/2696.diff","patch_url":"https://github.com/haiwen/seahub/pull/2696.patch","issue_url":"https://api.github.com/repos/haiwen/seahub/issues/2696","number":2696,"state":"open","locked":false,"title":"group","user":{"login":"Michael18811380328","id":37589122,"node_id":"MDQ6VXNlcjM3NTg5MTIy","avatar_url":"https://avatars3.githubusercontent.com/u/37589122?v=4","gravatar_id":"","url":"https://api.github.com/users/Michael18811380328","html_url":"https://github.com/Michael18811380328","followers_url":"https://api.github.com/users/Michael18811380328/followers","following_url":"https://api.github.com/users/Michael18811380328/following{/other_user}","gists_url":"https://api.github.com/users/Michael18811380328/gists{/gist_id}","starred_url":"https://api.github.com/users/Michael18811380328/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Michael18811380328/subscriptions","organizations_url":"https://api.github.com/users/Michael18811380328/orgs","repos_url":"https://api.github.com/users/Michael18811380328/repos","events_url":"https://api.github.com/users/Michael18811380328/events{/privacy}","received_events_url":"https://api.github.com/users/Michael18811380328/received_events","type":"User","site_admin":false},"body":"1. transfer group\r\n2. import group members\r\n3. manage group members\r\n4. show all group members","created_at":"2018-12-22T05:52:17Z","updated_at":"2018-12-24T05:55:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7fe1ce86928163d88efd20e755b05f8a157f1d94","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/haiwen/seahub/pulls/2696/commits","review_comments_url":"https://api.github.com/repos/haiwen/seahub/pulls/2696/comments","review_comment_url":"https://api.github.com/repos/haiwen/seahub/pulls/comments{/number}","comments_url":"https://api.github.com/repos/haiwen/seahub/issues/2696/comments","statuses_url":"https://api.github.com/repos/haiwen/seahub/statuses/7d8cedb23341dc0745138612545d25938fc4eccd","head":{"label":"haiwen:group-transfer","ref":"group-transfer","sha":"7d8cedb23341dc0745138612545d25938fc4eccd","user":{"login":"haiwen","id":1948782,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NDg3ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/1948782?v=4","gravatar_id":"","url":"https://api.github.com/users/haiwen","html_url":"https://github.com/haiwen","followers_url":"https://api.github.com/users/haiwen/followers","following_url":"https://api.github.com/users/haiwen/following{/other_user}","gists_url":"https://api.github.com/users/haiwen/gists{/gist_id}","starred_url":"https://api.github.com/users/haiwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haiwen/subscriptions","organizations_url":"https://api.github.com/users/haiwen/orgs","repos_url":"https://api.github.com/users/haiwen/repos","events_url":"https://api.github.com/users/haiwen/events{/privacy}","received_events_url":"https://api.github.com/users/haiwen/received_events","type":"Organization","site_admin":false},"repo":{"id":6556815,"node_id":"MDEwOlJlcG9zaXRvcnk2NTU2ODE1","name":"seahub","full_name":"haiwen/seahub","private":false,"owner":{"login":"haiwen","id":1948782,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NDg3ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/1948782?v=4","gravatar_id":"","url":"https://api.github.com/users/haiwen","html_url":"https://github.com/haiwen","followers_url":"https://api.github.com/users/haiwen/followers","following_url":"https://api.github.com/users/haiwen/following{/other_user}","gists_url":"https://api.github.com/users/haiwen/gists{/gist_id}","starred_url":"https://api.github.com/users/haiwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haiwen/subscriptions","organizations_url":"https://api.github.com/users/haiwen/orgs","repos_url":"https://api.github.com/users/haiwen/repos","events_url":"https://api.github.com/users/haiwen/events{/privacy}","received_events_url":"https://api.github.com/users/haiwen/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/haiwen/seahub","description":"The web end of seafile server.","fork":false,"url":"https://api.github.com/repos/haiwen/seahub","forks_url":"https://api.github.com/repos/haiwen/seahub/forks","keys_url":"https://api.github.com/repos/haiwen/seahub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haiwen/seahub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haiwen/seahub/teams","hooks_url":"https://api.github.com/repos/haiwen/seahub/hooks","issue_events_url":"https://api.github.com/repos/haiwen/seahub/issues/events{/number}","events_url":"https://api.github.com/repos/haiwen/seahub/events","assignees_url":"https://api.github.com/repos/haiwen/seahub/assignees{/user}","branches_url":"https://api.github.com/repos/haiwen/seahub/branches{/branch}","tags_url":"https://api.github.com/repos/haiwen/seahub/tags","blobs_url":"https://api.github.com/repos/haiwen/seahub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haiwen/seahub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haiwen/seahub/git/refs{/sha}","trees_url":"https://api.github.com/repos/haiwen/seahub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haiwen/seahub/statuses/{sha}","languages_url":"https://api.github.com/repos/haiwen/seahub/languages","stargazers_url":"https://api.github.com/repos/haiwen/seahub/stargazers","contributors_url":"https://api.github.com/repos/haiwen/seahub/contributors","subscribers_url":"https://api.github.com/repos/haiwen/seahub/subscribers","subscription_url":"https://api.github.com/repos/haiwen/seahub/subscription","commits_url":"https://api.github.com/repos/haiwen/seahub/commits{/sha}","git_commits_url":"https://api.github.com/repos/haiwen/seahub/git/commits{/sha}","comments_url":"https://api.github.com/repos/haiwen/seahub/comments{/number}","issue_comment_url":"https://api.github.com/repos/haiwen/seahub/issues/comments{/number}","contents_url":"https://api.github.com/repos/haiwen/seahub/contents/{+path}","compare_url":"https://api.github.com/repos/haiwen/seahub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haiwen/seahub/merges","archive_url":"https://api.github.com/repos/haiwen/seahub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haiwen/seahub/downloads","issues_url":"https://api.github.com/repos/haiwen/seahub/issues{/number}","pulls_url":"https://api.github.com/repos/haiwen/seahub/pulls{/number}","milestones_url":"https://api.github.com/repos/haiwen/seahub/milestones{/number}","notifications_url":"https://api.github.com/repos/haiwen/seahub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haiwen/seahub/labels{/name}","releases_url":"https://api.github.com/repos/haiwen/seahub/releases{/id}","deployments_url":"https://api.github.com/repos/haiwen/seahub/deployments","created_at":"2012-11-06T05:07:24Z","updated_at":"2018-12-24T04:24:21Z","pushed_at":"2018-12-24T04:37:39Z","git_url":"git://github.com/haiwen/seahub.git","ssh_url":"git@github.com:haiwen/seahub.git","clone_url":"https://github.com/haiwen/seahub.git","svn_url":"https://github.com/haiwen/seahub","homepage":"seafile.com","size":135216,"stargazers_count":344,"watchers_count":344,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":264,"mirror_url":null,"archived":false,"open_issues_count":81,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":264,"open_issues":81,"watchers":344,"default_branch":"master"}},"base":{"label":"haiwen:master","ref":"master","sha":"498db3a1af04043d5190a01a906f493505314fcf","user":{"login":"haiwen","id":1948782,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NDg3ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/1948782?v=4","gravatar_id":"","url":"https://api.github.com/users/haiwen","html_url":"https://github.com/haiwen","followers_url":"https://api.github.com/users/haiwen/followers","following_url":"https://api.github.com/users/haiwen/following{/other_user}","gists_url":"https://api.github.com/users/haiwen/gists{/gist_id}","starred_url":"https://api.github.com/users/haiwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haiwen/subscriptions","organizations_url":"https://api.github.com/users/haiwen/orgs","repos_url":"https://api.github.com/users/haiwen/repos","events_url":"https://api.github.com/users/haiwen/events{/privacy}","received_events_url":"https://api.github.com/users/haiwen/received_events","type":"Organization","site_admin":false},"repo":{"id":6556815,"node_id":"MDEwOlJlcG9zaXRvcnk2NTU2ODE1","name":"seahub","full_name":"haiwen/seahub","private":false,"owner":{"login":"haiwen","id":1948782,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NDg3ODI=","avatar_url":"https://avatars3.githubusercontent.com/u/1948782?v=4","gravatar_id":"","url":"https://api.github.com/users/haiwen","html_url":"https://github.com/haiwen","followers_url":"https://api.github.com/users/haiwen/followers","following_url":"https://api.github.com/users/haiwen/following{/other_user}","gists_url":"https://api.github.com/users/haiwen/gists{/gist_id}","starred_url":"https://api.github.com/users/haiwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haiwen/subscriptions","organizations_url":"https://api.github.com/users/haiwen/orgs","repos_url":"https://api.github.com/users/haiwen/repos","events_url":"https://api.github.com/users/haiwen/events{/privacy}","received_events_url":"https://api.github.com/users/haiwen/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/haiwen/seahub","description":"The web end of seafile server.","fork":false,"url":"https://api.github.com/repos/haiwen/seahub","forks_url":"https://api.github.com/repos/haiwen/seahub/forks","keys_url":"https://api.github.com/repos/haiwen/seahub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haiwen/seahub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haiwen/seahub/teams","hooks_url":"https://api.github.com/repos/haiwen/seahub/hooks","issue_events_url":"https://api.github.com/repos/haiwen/seahub/issues/events{/number}","events_url":"https://api.github.com/repos/haiwen/seahub/events","assignees_url":"https://api.github.com/repos/haiwen/seahub/assignees{/user}","branches_url":"https://api.github.com/repos/haiwen/seahub/branches{/branch}","tags_url":"https://api.github.com/repos/haiwen/seahub/tags","blobs_url":"https://api.github.com/repos/haiwen/seahub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haiwen/seahub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haiwen/seahub/git/refs{/sha}","trees_url":"https://api.github.com/repos/haiwen/seahub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haiwen/seahub/statuses/{sha}","languages_url":"https://api.github.com/repos/haiwen/seahub/languages","stargazers_url":"https://api.github.com/repos/haiwen/seahub/stargazers","contributors_url":"https://api.github.com/repos/haiwen/seahub/contributors","subscribers_url":"https://api.github.com/repos/haiwen/seahub/subscribers","subscription_url":"https://api.github.com/repos/haiwen/seahub/subscription","commits_url":"https://api.github.com/repos/haiwen/seahub/commits{/sha}","git_commits_url":"https://api.github.com/repos/haiwen/seahub/git/commits{/sha}","comments_url":"https://api.github.com/repos/haiwen/seahub/comments{/number}","issue_comment_url":"https://api.github.com/repos/haiwen/seahub/issues/comments{/number}","contents_url":"https://api.github.com/repos/haiwen/seahub/contents/{+path}","compare_url":"https://api.github.com/repos/haiwen/seahub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haiwen/seahub/merges","archive_url":"https://api.github.com/repos/haiwen/seahub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haiwen/seahub/downloads","issues_url":"https://api.github.com/repos/haiwen/seahub/issues{/number}","pulls_url":"https://api.github.com/repos/haiwen/seahub/pulls{/number}","milestones_url":"https://api.github.com/repos/haiwen/seahub/milestones{/number}","notifications_url":"https://api.github.com/repos/haiwen/seahub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haiwen/seahub/labels{/name}","releases_url":"https://api.github.com/repos/haiwen/seahub/releases{/id}","deployments_url":"https://api.github.com/repos/haiwen/seahub/deployments","created_at":"2012-11-06T05:07:24Z","updated_at":"2018-12-24T04:24:21Z","pushed_at":"2018-12-24T04:37:39Z","git_url":"git://github.com/haiwen/seahub.git","ssh_url":"git@github.com:haiwen/seahub.git","clone_url":"https://github.com/haiwen/seahub.git","svn_url":"https://github.com/haiwen/seahub","homepage":"seafile.com","size":135216,"stargazers_count":344,"watchers_count":344,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":264,"mirror_url":null,"archived":false,"open_issues_count":81,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":264,"open_issues":81,"watchers":344,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/haiwen/seahub/pulls/2696"},"html":{"href":"https://github.com/haiwen/seahub/pull/2696"},"issue":{"href":"https://api.github.com/repos/haiwen/seahub/issues/2696"},"comments":{"href":"https://api.github.com/repos/haiwen/seahub/issues/2696/comments"},"review_comments":{"href":"https://api.github.com/repos/haiwen/seahub/pulls/2696/comments"},"review_comment":{"href":"https://api.github.com/repos/haiwen/seahub/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/haiwen/seahub/pulls/2696/commits"},"statuses":{"href":"https://api.github.com/repos/haiwen/seahub/statuses/7d8cedb23341dc0745138612545d25938fc4eccd"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Michael18811380328"}}