{"action":"created","comment":{"url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/comments/197409017","pull_request_review_id":131147906,"id":197409017,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NzQwOTAxNw==","diff_hunk":"@@ -0,0 +1,122 @@\n+/*\n+Copyright 2018 New Vector Ltd\n+\n+Licensed under the Apache License, Version 2.0 (the \"License\");\n+you may not use this file except in compliance with the License.\n+You may obtain a copy of the License at\n+\n+    http://www.apache.org/licenses/LICENSE-2.0\n+\n+Unless required by applicable law or agreed to in writing, software\n+distributed under the License is distributed on an \"AS IS\" BASIS,\n+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+See the License for the specific language governing permissions and\n+limitations under the License.\n+*/\n+\n+import React from 'react';\n+import { _t } from '../languageHandler';\n+import AutocompleteProvider from './AutocompleteProvider';\n+import MatrixClientPeg from '../MatrixClientPeg';\n+import FuzzyMatcher from './FuzzyMatcher';\n+import {PillCompletion} from './Components';\n+import sdk from '../index';\n+import _sortBy from 'lodash/sortBy';\n+import {makeGroupPermalink} from \"../matrix-to\";\n+import type {Completion, SelectionRange} from \"./Autocompleter\";\n+import FlairStore from \"../stores/FlairStore\";\n+\n+const COMMUNITY_REGEX = /(?=\\+)(\\S*)/g;\n+\n+function score(query, space) {\n+    const index = space.indexOf(query);\n+    if (index === -1) {\n+        return Infinity;\n+    } else {\n+        return index;\n+    }\n+}\n+\n+export default class CommunityProvider extends AutocompleteProvider {\n+    constructor() {\n+        super(COMMUNITY_REGEX);\n+        this.matcher = new FuzzyMatcher([], {\n+            keys: ['groupId', 'name', 'shortDescription'],\n+        });\n+    }\n+\n+    async getCompletions(query: string, selection: SelectionRange, force?: boolean = false): Array<Completion> {\n+        const BaseAvatar = sdk.getComponent('views.avatars.BaseAvatar');\n+\n+        // Disable autocompletions when composing commands because of various issues\n+        // (see https://github.com/vector-im/riot-web/issues/4762)\n+        if (/^(\\/join|\\/leave)/.test(query)) {\n+            return [];\n+        }\n+\n+        const cli = MatrixClientPeg.get();\n+        let completions = [];\n+        const {command, range} = this.getCurrentCommand(query, selection, force);\n+        if (command) {\n+            const joinedGroups = cli.getGroups().filter(({myMembership}) => myMembership !== 'invite');","path":"src/autocomplete/CommunityProvider.js","position":61,"original_position":61,"commit_id":"287745f8c6315c7f5a8183f5e24142e249cb3379","original_commit_id":"b79cd205a06fed509544e4d927aa0e01fe0a26fb","user":{"login":"lukebarnard1","id":6750344,"node_id":"MDQ6VXNlcjY3NTAzNDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6750344?v=4","gravatar_id":"","url":"https://api.github.com/users/lukebarnard1","html_url":"https://github.com/lukebarnard1","followers_url":"https://api.github.com/users/lukebarnard1/followers","following_url":"https://api.github.com/users/lukebarnard1/following{/other_user}","gists_url":"https://api.github.com/users/lukebarnard1/gists{/gist_id}","starred_url":"https://api.github.com/users/lukebarnard1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukebarnard1/subscriptions","organizations_url":"https://api.github.com/users/lukebarnard1/orgs","repos_url":"https://api.github.com/users/lukebarnard1/repos","events_url":"https://api.github.com/users/lukebarnard1/events{/privacy}","received_events_url":"https://api.github.com/users/lukebarnard1/received_events","type":"User","site_admin":false},"body":"Oh, true. ","created_at":"2018-06-22T10:36:49Z","updated_at":"2018-06-22T10:36:49Z","html_url":"https://github.com/matrix-org/matrix-react-sdk/pull/1993#discussion_r197409017","pull_request_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/1993","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/comments/197409017"},"html":{"href":"https://github.com/matrix-org/matrix-react-sdk/pull/1993#discussion_r197409017"},"pull_request":{"href":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/1993"}},"in_reply_to_id":197398108},"pull_request":{"url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/1993","id":195790546,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1NzkwNTQ2","html_url":"https://github.com/matrix-org/matrix-react-sdk/pull/1993","diff_url":"https://github.com/matrix-org/matrix-react-sdk/pull/1993.diff","patch_url":"https://github.com/matrix-org/matrix-react-sdk/pull/1993.patch","issue_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues/1993","number":1993,"state":"open","locked":false,"title":"Autocomplete and Pillify Communities","user":{"login":"t3chguy","id":2403652,"node_id":"MDQ6VXNlcjI0MDM2NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/2403652?v=4","gravatar_id":"","url":"https://api.github.com/users/t3chguy","html_url":"https://github.com/t3chguy","followers_url":"https://api.github.com/users/t3chguy/followers","following_url":"https://api.github.com/users/t3chguy/following{/other_user}","gists_url":"https://api.github.com/users/t3chguy/gists{/gist_id}","starred_url":"https://api.github.com/users/t3chguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t3chguy/subscriptions","organizations_url":"https://api.github.com/users/t3chguy/orgs","repos_url":"https://api.github.com/users/t3chguy/repos","events_url":"https://api.github.com/users/t3chguy/events{/privacy}","received_events_url":"https://api.github.com/users/t3chguy/received_events","type":"User","site_admin":false},"body":"### Fixes https://github.com/vector-im/riot-web/issues/5960 and https://github.com/vector-im/riot-web/issues/5253","created_at":"2018-06-19T11:08:16Z","updated_at":"2018-06-22T10:36:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c592c5e86edac62f8bac5c3882587e14b845c4fa","assignee":{"login":"t3chguy","id":2403652,"node_id":"MDQ6VXNlcjI0MDM2NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/2403652?v=4","gravatar_id":"","url":"https://api.github.com/users/t3chguy","html_url":"https://github.com/t3chguy","followers_url":"https://api.github.com/users/t3chguy/followers","following_url":"https://api.github.com/users/t3chguy/following{/other_user}","gists_url":"https://api.github.com/users/t3chguy/gists{/gist_id}","starred_url":"https://api.github.com/users/t3chguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t3chguy/subscriptions","organizations_url":"https://api.github.com/users/t3chguy/orgs","repos_url":"https://api.github.com/users/t3chguy/repos","events_url":"https://api.github.com/users/t3chguy/events{/privacy}","received_events_url":"https://api.github.com/users/t3chguy/received_events","type":"User","site_admin":false},"assignees":[{"login":"t3chguy","id":2403652,"node_id":"MDQ6VXNlcjI0MDM2NTI=","avatar_url":"https://avatars2.githubusercontent.com/u/2403652?v=4","gravatar_id":"","url":"https://api.github.com/users/t3chguy","html_url":"https://github.com/t3chguy","followers_url":"https://api.github.com/users/t3chguy/followers","following_url":"https://api.github.com/users/t3chguy/following{/other_user}","gists_url":"https://api.github.com/users/t3chguy/gists{/gist_id}","starred_url":"https://api.github.com/users/t3chguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t3chguy/subscriptions","organizations_url":"https://api.github.com/users/t3chguy/orgs","repos_url":"https://api.github.com/users/t3chguy/repos","events_url":"https://api.github.com/users/t3chguy/events{/privacy}","received_events_url":"https://api.github.com/users/t3chguy/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/1993/commits","review_comments_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/1993/comments","review_comment_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues/1993/comments","statuses_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/statuses/287745f8c6315c7f5a8183f5e24142e249cb3379","head":{"label":"matrix-org:t3chguy/community_autocomplete","ref":"t3chguy/community_autocomplete","sha":"287745f8c6315c7f5a8183f5e24142e249cb3379","user":{"login":"matrix-org","id":8418310,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0MTgzMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/8418310?v=4","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"repo":{"id":37144575,"node_id":"MDEwOlJlcG9zaXRvcnkzNzE0NDU3NQ==","name":"matrix-react-sdk","full_name":"matrix-org/matrix-react-sdk","owner":{"login":"matrix-org","id":8418310,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0MTgzMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/8418310?v=4","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matrix-org/matrix-react-sdk","description":"Matrix SDK for React Javascript","fork":false,"url":"https://api.github.com/repos/matrix-org/matrix-react-sdk","forks_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/forks","keys_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/teams","hooks_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/hooks","issue_events_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/events","assignees_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/tags","blobs_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/languages","stargazers_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/stargazers","contributors_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/contributors","subscribers_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/subscribers","subscription_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/subscription","commits_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/merges","archive_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/downloads","issues_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/labels{/name}","releases_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/deployments","created_at":"2015-06-09T16:37:07Z","updated_at":"2018-06-20T02:30:08Z","pushed_at":"2018-06-22T10:32:11Z","git_url":"git://github.com/matrix-org/matrix-react-sdk.git","ssh_url":"git@github.com:matrix-org/matrix-react-sdk.git","clone_url":"https://github.com/matrix-org/matrix-react-sdk.git","svn_url":"https://github.com/matrix-org/matrix-react-sdk","homepage":null,"size":19700,"stargazers_count":195,"watchers_count":195,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":136,"mirror_url":null,"archived":false,"open_issues_count":45,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":136,"open_issues":45,"watchers":195,"default_branch":"master"}},"base":{"label":"matrix-org:develop","ref":"develop","sha":"1352abf3175c35406629b2f0c9acc06e1bfdbcc6","user":{"login":"matrix-org","id":8418310,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0MTgzMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/8418310?v=4","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"repo":{"id":37144575,"node_id":"MDEwOlJlcG9zaXRvcnkzNzE0NDU3NQ==","name":"matrix-react-sdk","full_name":"matrix-org/matrix-react-sdk","owner":{"login":"matrix-org","id":8418310,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg0MTgzMTA=","avatar_url":"https://avatars2.githubusercontent.com/u/8418310?v=4","gravatar_id":"","url":"https://api.github.com/users/matrix-org","html_url":"https://github.com/matrix-org","followers_url":"https://api.github.com/users/matrix-org/followers","following_url":"https://api.github.com/users/matrix-org/following{/other_user}","gists_url":"https://api.github.com/users/matrix-org/gists{/gist_id}","starred_url":"https://api.github.com/users/matrix-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matrix-org/subscriptions","organizations_url":"https://api.github.com/users/matrix-org/orgs","repos_url":"https://api.github.com/users/matrix-org/repos","events_url":"https://api.github.com/users/matrix-org/events{/privacy}","received_events_url":"https://api.github.com/users/matrix-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matrix-org/matrix-react-sdk","description":"Matrix SDK for React Javascript","fork":false,"url":"https://api.github.com/repos/matrix-org/matrix-react-sdk","forks_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/forks","keys_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/teams","hooks_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/hooks","issue_events_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/events","assignees_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/tags","blobs_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/languages","stargazers_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/stargazers","contributors_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/contributors","subscribers_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/subscribers","subscription_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/subscription","commits_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/merges","archive_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/downloads","issues_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/labels{/name}","releases_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/releases{/id}","deployments_url":"https://api.github.com/repos/matrix-org/matrix-react-sdk/deployments","created_at":"2015-06-09T16:37:07Z","updated_at":"2018-06-20T02:30:08Z","pushed_at":"2018-06-22T10:32:11Z","git_url":"git://github.com/matrix-org/matrix-react-sdk.git","ssh_url":"git@github.com:matrix-org/matrix-react-sdk.git","clone_url":"https://github.com/matrix-org/matrix-react-sdk.git","svn_url":"https://github.com/matrix-org/matrix-react-sdk","homepage":null,"size":19700,"stargazers_count":195,"watchers_count":195,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":136,"mirror_url":null,"archived":false,"open_issues_count":45,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":136,"open_issues":45,"watchers":195,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/1993"},"html":{"href":"https://github.com/matrix-org/matrix-react-sdk/pull/1993"},"issue":{"href":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues/1993"},"comments":{"href":"https://api.github.com/repos/matrix-org/matrix-react-sdk/issues/1993/comments"},"review_comments":{"href":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/1993/comments"},"review_comment":{"href":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/matrix-org/matrix-react-sdk/pulls/1993/commits"},"statuses":{"href":"https://api.github.com/repos/matrix-org/matrix-react-sdk/statuses/287745f8c6315c7f5a8183f5e24142e249cb3379"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"lukebarnard1"}}