{"action":"created","comment":{"url":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/comments/186490024","pull_request_review_id":118073032,"id":186490024,"diff_hunk":"@@ -1,24 +1,140 @@\n <template>\n     <v-card tile height=\"100%\">\n-        <v-card-title primary-title>\n-            <div v-if=\"chatId\">\n-                {{ chatId }}\n-            </div>\n-            <div v-else>\n-                Select chat...\n-            </div>\n-        </v-card-title>\n+        <div v-if=\"chatId\" class=\"chat-body\">\n+            <v-toolbar color=\"white\" card dense>\n+                <v-toolbar-title class=\"chat-title primary--text text--lighten-2\">\n+                    {{ chat.type === 'dialog' ?\n+                        $t('chat.title') + chat.name :\n+                        chat.name\n+                    }}\n+                </v-toolbar-title>\n+                <v-spacer/>\n+                <v-btn icon>\n+                    <v-icon>settings</v-icon>\n+                </v-btn>\n+            </v-toolbar>\n+            <v-divider/>\n+\n+            <v-list two-line>\n+                <virtual-list :size=\"60\" :remain=\"6\" :bench=\"5\">\n+                    <template v-for=\"message of chat.messages\">\n+                        <v-list-tile avatar :key=\"message.id\">\n+                            <v-list-tile-avatar>\n+                                <img :src=\"getUserById(message.fromId).avatar\">\n+                            </v-list-tile-avatar>\n+                            <v-list-tile-content>\n+                                <v-list-tile-action-text>{{ $d(message.dateMsg, 'long') }}</v-list-tile-action-text>\n+                                <v-list-tile-sub-title v-html=\"getUserById(message.fromId).name\"/>\n+                                <v-list-tile-title v-html=\"message.body\"/>\n+                            </v-list-tile-content>\n+                        </v-list-tile>\n+                    </template>\n+                </virtual-list>\n+            </v-list>\n+            <v-card-actions>\n+                <v-layout class=\"chat-actions\" align-end justify-space-around>\n+                    <v-flex>\n+                        <v-btn icon><v-icon>attach_file</v-icon></v-btn>\n+                    </v-flex>\n+                    <v-flex xs10>\n+                        <v-text-field\n+                            :label=\"$t('chat.label')\"\n+                            class=\"chat-textarea\"\n+                            multi-line\n+                            no-resize\n+                            rows=\"2\"\n+                            autofocus\n+                            full-width\n+                            clearable\n+                            v-model=\"newMsg\"\n+                            @keyup.enter=\"addMessageNClear\"\n+                            :rules=\"[(v) => v.length <= 150 || $t('chat.errors.max')]\"\n+                            :counter=\"150\"\n+                            v-validate=\"{ required: true, max: 150 }\"\n+                        />\n+                    </v-flex>\n+                    <v-flex>\n+                        <v-btn icon @click=\"addMessageNClear\"><v-icon>send</v-icon></v-btn>\n+                    </v-flex>\n+                </v-layout>\n+            </v-card-actions>\n+        </div>\n+        <v-layout v-else fill-height>\n+            <v-flex d-flex xs12 align-center text-xs-center>\n+                <v-card flat>\n+                    <v-icon x-large>chat</v-icon>\n+                    <v-card-text>{{ $t('chat.welcome') }}</v-card-text>\n+                </v-card>\n+            </v-flex>\n+        </v-layout>\n     </v-card>\n </template>\n <script>\n+import virtualList from 'vue-virtual-scroll-list';\n+import { mapActions, mapGetters } from 'vuex';\n+\n export default {\n     name: 'Chat',\n+    components: { 'virtual-list': virtualList },\n     props: {\n         chatId: {\n             type: String,\n             required: false,\n             default: ''\n         }\n+    },\n+    data: function () {\n+        return {\n+            chat: {},\n+            newMsg: ''\n+        };\n+    },\n+    computed: {\n+        ...mapGetters({\n+            getChatById: 'chats/getChatById',\n+            getUserById: 'friends/getUserById'\n+        })\n+    },\n+    async beforeMount() {\n+        if (this.chatId !== '') {\n+            this.chat = await this.getChatById(this.chatId);\n+        }\n+    },\n+    async beforeUpdate() {\n+        if (this.chatId !== '') {\n+            this.chat = await this.getChatById(this.chatId);\n+        }\n+    },\n+    methods: {\n+        ...mapActions('chats', [\n+            'addMessage'\n+        ]),\n+        addMessageNClear() {\n+            this.$validator.validateAll().then((result) => {\n+                if (result) {\n+                    let safeMsg = this.newMsg.replace(/<[^>]*>/, '&tag');\n+                    this.addMessage(\n+                        {\n+                            chat: this.chat,\n+                            newMsg: safeMsg\n+                        });\n+                    this.newMsg = '';\n+                    this.$validator.reset();\n+                }\n+            });\n+        }\n     }\n };\n </script>\n+<style scoped>\n+    .chat-title{\n+        font: normal 1.2em Tahoma, sans-serif;","path":"src/main/vue/src/components/Chat.vue","position":139,"original_position":139,"commit_id":"1d209d9de57e926a8985bdc4a1ebeb289ce886a9","original_commit_id":"1d209d9de57e926a8985bdc4a1ebeb289ce886a9","user":{"login":"ocassio","id":6851647,"avatar_url":"https://avatars1.githubusercontent.com/u/6851647?v=4","gravatar_id":"","url":"https://api.github.com/users/ocassio","html_url":"https://github.com/ocassio","followers_url":"https://api.github.com/users/ocassio/followers","following_url":"https://api.github.com/users/ocassio/following{/other_user}","gists_url":"https://api.github.com/users/ocassio/gists{/gist_id}","starred_url":"https://api.github.com/users/ocassio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocassio/subscriptions","organizations_url":"https://api.github.com/users/ocassio/orgs","repos_url":"https://api.github.com/users/ocassio/repos","events_url":"https://api.github.com/users/ocassio/events{/privacy}","received_events_url":"https://api.github.com/users/ocassio/received_events","type":"User","site_admin":false},"body":"А из готовых ничего не подошло?","created_at":"2018-05-07T17:26:58Z","updated_at":"2018-05-07T17:31:38Z","html_url":"https://github.com/ncedu-tlt/social-network/pull/41#discussion_r186490024","pull_request_url":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/41","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/comments/186490024"},"html":{"href":"https://github.com/ncedu-tlt/social-network/pull/41#discussion_r186490024"},"pull_request":{"href":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/41"}}},"pull_request":{"url":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/41","id":186228803,"html_url":"https://github.com/ncedu-tlt/social-network/pull/41","diff_url":"https://github.com/ncedu-tlt/social-network/pull/41.diff","patch_url":"https://github.com/ncedu-tlt/social-network/pull/41.patch","issue_url":"https://api.github.com/repos/ncedu-tlt/social-network/issues/41","number":41,"state":"open","locked":false,"title":"39 Chat ui","user":{"login":"Tadoma","id":8876801,"avatar_url":"https://avatars3.githubusercontent.com/u/8876801?v=4","gravatar_id":"","url":"https://api.github.com/users/Tadoma","html_url":"https://github.com/Tadoma","followers_url":"https://api.github.com/users/Tadoma/followers","following_url":"https://api.github.com/users/Tadoma/following{/other_user}","gists_url":"https://api.github.com/users/Tadoma/gists{/gist_id}","starred_url":"https://api.github.com/users/Tadoma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tadoma/subscriptions","organizations_url":"https://api.github.com/users/Tadoma/orgs","repos_url":"https://api.github.com/users/Tadoma/repos","events_url":"https://api.github.com/users/Tadoma/events{/privacy}","received_events_url":"https://api.github.com/users/Tadoma/received_events","type":"User","site_admin":false},"body":"Closes #39 ","created_at":"2018-05-06T22:01:21Z","updated_at":"2018-05-07T17:31:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f09a26809d1465c8b7163b8c98c96adb70aab55a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/41/commits","review_comments_url":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/41/comments","review_comment_url":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ncedu-tlt/social-network/issues/41/comments","statuses_url":"https://api.github.com/repos/ncedu-tlt/social-network/statuses/1d209d9de57e926a8985bdc4a1ebeb289ce886a9","head":{"label":"ncedu-tlt:39-feature-chat-ui","ref":"39-feature-chat-ui","sha":"1d209d9de57e926a8985bdc4a1ebeb289ce886a9","user":{"login":"ncedu-tlt","id":16236844,"avatar_url":"https://avatars2.githubusercontent.com/u/16236844?v=4","gravatar_id":"","url":"https://api.github.com/users/ncedu-tlt","html_url":"https://github.com/ncedu-tlt","followers_url":"https://api.github.com/users/ncedu-tlt/followers","following_url":"https://api.github.com/users/ncedu-tlt/following{/other_user}","gists_url":"https://api.github.com/users/ncedu-tlt/gists{/gist_id}","starred_url":"https://api.github.com/users/ncedu-tlt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncedu-tlt/subscriptions","organizations_url":"https://api.github.com/users/ncedu-tlt/orgs","repos_url":"https://api.github.com/users/ncedu-tlt/repos","events_url":"https://api.github.com/users/ncedu-tlt/events{/privacy}","received_events_url":"https://api.github.com/users/ncedu-tlt/received_events","type":"Organization","site_admin":false},"repo":{"id":122637666,"name":"social-network","full_name":"ncedu-tlt/social-network","owner":{"login":"ncedu-tlt","id":16236844,"avatar_url":"https://avatars2.githubusercontent.com/u/16236844?v=4","gravatar_id":"","url":"https://api.github.com/users/ncedu-tlt","html_url":"https://github.com/ncedu-tlt","followers_url":"https://api.github.com/users/ncedu-tlt/followers","following_url":"https://api.github.com/users/ncedu-tlt/following{/other_user}","gists_url":"https://api.github.com/users/ncedu-tlt/gists{/gist_id}","starred_url":"https://api.github.com/users/ncedu-tlt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncedu-tlt/subscriptions","organizations_url":"https://api.github.com/users/ncedu-tlt/orgs","repos_url":"https://api.github.com/users/ncedu-tlt/repos","events_url":"https://api.github.com/users/ncedu-tlt/events{/privacy}","received_events_url":"https://api.github.com/users/ncedu-tlt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ncedu-tlt/social-network","description":"Social network for developers","fork":false,"url":"https://api.github.com/repos/ncedu-tlt/social-network","forks_url":"https://api.github.com/repos/ncedu-tlt/social-network/forks","keys_url":"https://api.github.com/repos/ncedu-tlt/social-network/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ncedu-tlt/social-network/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ncedu-tlt/social-network/teams","hooks_url":"https://api.github.com/repos/ncedu-tlt/social-network/hooks","issue_events_url":"https://api.github.com/repos/ncedu-tlt/social-network/issues/events{/number}","events_url":"https://api.github.com/repos/ncedu-tlt/social-network/events","assignees_url":"https://api.github.com/repos/ncedu-tlt/social-network/assignees{/user}","branches_url":"https://api.github.com/repos/ncedu-tlt/social-network/branches{/branch}","tags_url":"https://api.github.com/repos/ncedu-tlt/social-network/tags","blobs_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/refs{/sha}","trees_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ncedu-tlt/social-network/statuses/{sha}","languages_url":"https://api.github.com/repos/ncedu-tlt/social-network/languages","stargazers_url":"https://api.github.com/repos/ncedu-tlt/social-network/stargazers","contributors_url":"https://api.github.com/repos/ncedu-tlt/social-network/contributors","subscribers_url":"https://api.github.com/repos/ncedu-tlt/social-network/subscribers","subscription_url":"https://api.github.com/repos/ncedu-tlt/social-network/subscription","commits_url":"https://api.github.com/repos/ncedu-tlt/social-network/commits{/sha}","git_commits_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/commits{/sha}","comments_url":"https://api.github.com/repos/ncedu-tlt/social-network/comments{/number}","issue_comment_url":"https://api.github.com/repos/ncedu-tlt/social-network/issues/comments{/number}","contents_url":"https://api.github.com/repos/ncedu-tlt/social-network/contents/{+path}","compare_url":"https://api.github.com/repos/ncedu-tlt/social-network/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ncedu-tlt/social-network/merges","archive_url":"https://api.github.com/repos/ncedu-tlt/social-network/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ncedu-tlt/social-network/downloads","issues_url":"https://api.github.com/repos/ncedu-tlt/social-network/issues{/number}","pulls_url":"https://api.github.com/repos/ncedu-tlt/social-network/pulls{/number}","milestones_url":"https://api.github.com/repos/ncedu-tlt/social-network/milestones{/number}","notifications_url":"https://api.github.com/repos/ncedu-tlt/social-network/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ncedu-tlt/social-network/labels{/name}","releases_url":"https://api.github.com/repos/ncedu-tlt/social-network/releases{/id}","deployments_url":"https://api.github.com/repos/ncedu-tlt/social-network/deployments","created_at":"2018-02-23T15:21:13Z","updated_at":"2018-05-07T14:11:48Z","pushed_at":"2018-05-07T14:11:50Z","git_url":"git://github.com/ncedu-tlt/social-network.git","ssh_url":"git@github.com:ncedu-tlt/social-network.git","clone_url":"https://github.com/ncedu-tlt/social-network.git","svn_url":"https://github.com/ncedu-tlt/social-network","homepage":"https://ncedu-social-network.herokuapp.com","size":2825,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"base":{"label":"ncedu-tlt:master","ref":"master","sha":"1cecc7a46e33500e66e42024aea6724e3e964434","user":{"login":"ncedu-tlt","id":16236844,"avatar_url":"https://avatars2.githubusercontent.com/u/16236844?v=4","gravatar_id":"","url":"https://api.github.com/users/ncedu-tlt","html_url":"https://github.com/ncedu-tlt","followers_url":"https://api.github.com/users/ncedu-tlt/followers","following_url":"https://api.github.com/users/ncedu-tlt/following{/other_user}","gists_url":"https://api.github.com/users/ncedu-tlt/gists{/gist_id}","starred_url":"https://api.github.com/users/ncedu-tlt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncedu-tlt/subscriptions","organizations_url":"https://api.github.com/users/ncedu-tlt/orgs","repos_url":"https://api.github.com/users/ncedu-tlt/repos","events_url":"https://api.github.com/users/ncedu-tlt/events{/privacy}","received_events_url":"https://api.github.com/users/ncedu-tlt/received_events","type":"Organization","site_admin":false},"repo":{"id":122637666,"name":"social-network","full_name":"ncedu-tlt/social-network","owner":{"login":"ncedu-tlt","id":16236844,"avatar_url":"https://avatars2.githubusercontent.com/u/16236844?v=4","gravatar_id":"","url":"https://api.github.com/users/ncedu-tlt","html_url":"https://github.com/ncedu-tlt","followers_url":"https://api.github.com/users/ncedu-tlt/followers","following_url":"https://api.github.com/users/ncedu-tlt/following{/other_user}","gists_url":"https://api.github.com/users/ncedu-tlt/gists{/gist_id}","starred_url":"https://api.github.com/users/ncedu-tlt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ncedu-tlt/subscriptions","organizations_url":"https://api.github.com/users/ncedu-tlt/orgs","repos_url":"https://api.github.com/users/ncedu-tlt/repos","events_url":"https://api.github.com/users/ncedu-tlt/events{/privacy}","received_events_url":"https://api.github.com/users/ncedu-tlt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ncedu-tlt/social-network","description":"Social network for developers","fork":false,"url":"https://api.github.com/repos/ncedu-tlt/social-network","forks_url":"https://api.github.com/repos/ncedu-tlt/social-network/forks","keys_url":"https://api.github.com/repos/ncedu-tlt/social-network/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ncedu-tlt/social-network/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ncedu-tlt/social-network/teams","hooks_url":"https://api.github.com/repos/ncedu-tlt/social-network/hooks","issue_events_url":"https://api.github.com/repos/ncedu-tlt/social-network/issues/events{/number}","events_url":"https://api.github.com/repos/ncedu-tlt/social-network/events","assignees_url":"https://api.github.com/repos/ncedu-tlt/social-network/assignees{/user}","branches_url":"https://api.github.com/repos/ncedu-tlt/social-network/branches{/branch}","tags_url":"https://api.github.com/repos/ncedu-tlt/social-network/tags","blobs_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/refs{/sha}","trees_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ncedu-tlt/social-network/statuses/{sha}","languages_url":"https://api.github.com/repos/ncedu-tlt/social-network/languages","stargazers_url":"https://api.github.com/repos/ncedu-tlt/social-network/stargazers","contributors_url":"https://api.github.com/repos/ncedu-tlt/social-network/contributors","subscribers_url":"https://api.github.com/repos/ncedu-tlt/social-network/subscribers","subscription_url":"https://api.github.com/repos/ncedu-tlt/social-network/subscription","commits_url":"https://api.github.com/repos/ncedu-tlt/social-network/commits{/sha}","git_commits_url":"https://api.github.com/repos/ncedu-tlt/social-network/git/commits{/sha}","comments_url":"https://api.github.com/repos/ncedu-tlt/social-network/comments{/number}","issue_comment_url":"https://api.github.com/repos/ncedu-tlt/social-network/issues/comments{/number}","contents_url":"https://api.github.com/repos/ncedu-tlt/social-network/contents/{+path}","compare_url":"https://api.github.com/repos/ncedu-tlt/social-network/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ncedu-tlt/social-network/merges","archive_url":"https://api.github.com/repos/ncedu-tlt/social-network/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ncedu-tlt/social-network/downloads","issues_url":"https://api.github.com/repos/ncedu-tlt/social-network/issues{/number}","pulls_url":"https://api.github.com/repos/ncedu-tlt/social-network/pulls{/number}","milestones_url":"https://api.github.com/repos/ncedu-tlt/social-network/milestones{/number}","notifications_url":"https://api.github.com/repos/ncedu-tlt/social-network/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ncedu-tlt/social-network/labels{/name}","releases_url":"https://api.github.com/repos/ncedu-tlt/social-network/releases{/id}","deployments_url":"https://api.github.com/repos/ncedu-tlt/social-network/deployments","created_at":"2018-02-23T15:21:13Z","updated_at":"2018-05-07T14:11:48Z","pushed_at":"2018-05-07T14:11:50Z","git_url":"git://github.com/ncedu-tlt/social-network.git","ssh_url":"git@github.com:ncedu-tlt/social-network.git","clone_url":"https://github.com/ncedu-tlt/social-network.git","svn_url":"https://github.com/ncedu-tlt/social-network","homepage":"https://ncedu-social-network.herokuapp.com","size":2825,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/41"},"html":{"href":"https://github.com/ncedu-tlt/social-network/pull/41"},"issue":{"href":"https://api.github.com/repos/ncedu-tlt/social-network/issues/41"},"comments":{"href":"https://api.github.com/repos/ncedu-tlt/social-network/issues/41/comments"},"review_comments":{"href":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/41/comments"},"review_comment":{"href":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ncedu-tlt/social-network/pulls/41/commits"},"statuses":{"href":"https://api.github.com/repos/ncedu-tlt/social-network/statuses/1d209d9de57e926a8985bdc4a1ebeb289ce886a9"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ocassio"}}