Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

Commit 58b64ce

Browse files
authored
feat: remove feature flag for phabricator (#290)
1 parent 3e01bca commit 58b64ce

File tree

5 files changed

+30
-802
lines changed

5 files changed

+30
-802
lines changed

src/extension/scripts/inject.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { injectBitbucketServer } from '../../libs/bitbucket/inject'
2020
import { injectCodeIntelligence } from '../../libs/code_intelligence'
2121
import { injectGitHubApplication } from '../../libs/github/inject'
2222
import { checkIsGitlab } from '../../libs/gitlab/code_intelligence'
23-
import { injectPhabricatorApplication } from '../../libs/phabricator/app'
2423
import { injectSourcegraphApp } from '../../libs/sourcegraph/inject'
2524
import { assertEnv } from '../envAssertion'
2625

@@ -94,7 +93,6 @@ function injectApplication(): void {
9493
} else if (isPhabricator) {
9594
window.SOURCEGRAPH_PHABRICATOR_EXTENSION = true
9695
setSourcegraphUrl(sourcegraphServerUrl)
97-
injectPhabricatorApplication()
9896
} else if (
9997
document.querySelector('.bitbucket-header-logo') ||
10098
document.querySelector('.aui-header-logo.aui-header-logo-bitbucket')

src/libs/phabricator/app.tsx

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/libs/phabricator/extension.tsx

Lines changed: 30 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import '../../config/polyfill'
22

33
import { setSourcegraphUrl } from '../../shared/util/context'
4-
import { featureFlags } from '../../shared/util/featureFlags'
54
import { injectCodeIntelligence } from '../code_intelligence'
65
import { getPhabricatorCSS, getSourcegraphURLFromConduit } from './backend'
7-
import { injectPhabricatorBlobAnnotators } from './inject_old'
8-
import { expanderListen, metaClickOverride, setupPageLoadListener } from './util'
6+
import { metaClickOverride } from './util'
97

108
// NOTE: injectModules is idempotent, so safe to call multiple times on the same page.
119
async function injectModules(): Promise<void> {
@@ -14,52 +12,43 @@ async function injectModules(): Promise<void> {
1412
extensionMarker.style.display = 'none'
1513
document.body.appendChild(extensionMarker)
1614

17-
if (await featureFlags.isEnabled('newInject')) {
18-
await injectCodeIntelligence()
19-
} else {
20-
await injectPhabricatorBlobAnnotators()
21-
}
15+
await injectCodeIntelligence()
2216
}
2317

2418
export function init(): void {
2519
/**
2620
* This is the main entry point for the phabricator in-page JavaScript plugin.
2721
*/
2822
if (window.localStorage && window.localStorage.getItem('SOURCEGRAPH_DISABLED') !== 'true') {
29-
document.addEventListener('phabPageLoaded', () => {
30-
// Backwards compat: Support Legacy Phabricator extension. Check that the Phabricator integration
31-
// passed the bundle url. Legacy Phabricator extensions inject CSS via the loader.js script
32-
// so we do not need to do this here.
33-
if (!window.SOURCEGRAPH_BUNDLE_URL && !window.localStorage.getItem('SOURCEGRAPH_BUNDLE_URL')) {
34-
injectModules().catch(err => console.error('Unable to inject modules', err))
35-
metaClickOverride()
36-
expanderListen()
37-
return
38-
}
23+
// Backwards compat: Support Legacy Phabricator extension. Check that the Phabricator integration
24+
// passed the bundle url. Legacy Phabricator extensions inject CSS via the loader.js script
25+
// so we do not need to do this here.
26+
if (!window.SOURCEGRAPH_BUNDLE_URL && !window.localStorage.getItem('SOURCEGRAPH_BUNDLE_URL')) {
27+
injectModules().catch(err => console.error('Unable to inject modules', err))
28+
metaClickOverride()
29+
return
30+
}
3931

40-
getSourcegraphURLFromConduit()
41-
.then(sourcegraphUrl => {
42-
getPhabricatorCSS()
43-
.then(css => {
44-
const style = document.createElement('style') as HTMLStyleElement
45-
style.setAttribute('type', 'text/css')
46-
style.id = 'sourcegraph-styles'
47-
style.textContent = css
48-
document.getElementsByTagName('head')[0].appendChild(style)
49-
window.localStorage.setItem('SOURCEGRAPH_URL', sourcegraphUrl)
50-
window.SOURCEGRAPH_URL = sourcegraphUrl
51-
setSourcegraphUrl(sourcegraphUrl)
52-
expanderListen()
53-
metaClickOverride()
54-
injectModules().catch(err => console.error('Unable to inject modules', err))
55-
})
56-
.catch(e => {
57-
console.error(e)
58-
})
59-
})
60-
.catch(e => console.error(e))
61-
})
62-
setupPageLoadListener()
32+
getSourcegraphURLFromConduit()
33+
.then(sourcegraphUrl => {
34+
getPhabricatorCSS()
35+
.then(css => {
36+
const style = document.createElement('style') as HTMLStyleElement
37+
style.setAttribute('type', 'text/css')
38+
style.id = 'sourcegraph-styles'
39+
style.textContent = css
40+
document.getElementsByTagName('head')[0].appendChild(style)
41+
window.localStorage.setItem('SOURCEGRAPH_URL', sourcegraphUrl)
42+
window.SOURCEGRAPH_URL = sourcegraphUrl
43+
setSourcegraphUrl(sourcegraphUrl)
44+
metaClickOverride()
45+
injectModules().catch(err => console.error('Unable to inject modules', err))
46+
})
47+
.catch(e => {
48+
console.error(e)
49+
})
50+
})
51+
.catch(e => console.error(e))
6352
} else {
6453
// tslint:disable-next-line
6554
console.log(

0 commit comments

Comments
 (0)