Adapt in-app messaging to native integration (#14659)

Co-authored-by: TJ Kandala <kandalatj@gmail.com>
This commit is contained in:
Felix Becker 2020-10-14 20:47:08 +02:00 committed by GitHub
parent f43ef927de
commit c9b29a7be1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 609 additions and 83 deletions

View File

@ -138,6 +138,11 @@ export class NavLinks extends React.PureComponent<Props> {
{...this.props}
authenticatedUser={this.props.authenticatedUser}
showDotComMarketing={this.props.showDotComMarketing}
codeHostIntegrationMessaging={
(!isErrorLike(this.props.settingsCascade.final) &&
this.props.settingsCascade.final?.['alerts.codeHostIntegrationMessaging']) ||
'browser-extension'
}
keyboardShortcutForSwitchTheme={KEYBOARD_SHORTCUT_SWITCH_THEME}
/>
</li>

View File

@ -1,5 +1,5 @@
import { action } from '@storybook/addon-actions'
import { boolean } from '@storybook/addon-knobs'
import { boolean, select } from '@storybook/addon-knobs'
import { storiesOf } from '@storybook/react'
import React from 'react'
import { ThemePreference } from '../theme'
@ -47,6 +47,11 @@ add(
onThemePreferenceChange={onThemePreferenceChange}
showDotComMarketing={boolean('showDotComMarketing', true)}
isExtensionAlertAnimating={false}
codeHostIntegrationMessaging={select(
'codeHostIntegrationMessaging',
['browser-extension', 'native-integration'] as const,
'browser-extension'
)}
/>
)}
</WebStory>

View File

@ -46,6 +46,7 @@ describe('UserNavItem', () => {
authenticatedUser={USER}
showDotComMarketing={true}
isExtensionAlertAnimating={false}
codeHostIntegrationMessaging="browser-extension"
/>
</MemoryRouter>
)

View File

@ -20,6 +20,7 @@ export interface UserNavItemProps extends ThemeProps, ThemePreferenceProps, Exte
showDotComMarketing: boolean
keyboardShortcutForSwitchTheme?: KeyboardShortcut
testIsOpen?: boolean
codeHostIntegrationMessaging: 'browser-extension' | 'native-integration'
}
export interface ExtensionAlertAnimationProps {
@ -58,7 +59,14 @@ export function useExtensionAlertAnimation(): ExtensionAlertAnimationProps & {
* authenticated viewers.
*/
export const UserNavItem: React.FunctionComponent<UserNavItemProps> = props => {
const { location, themePreference, onThemePreferenceChange, isExtensionAlertAnimating, testIsOpen } = props
const {
location,
themePreference,
onThemePreferenceChange,
isExtensionAlertAnimating,
testIsOpen,
codeHostIntegrationMessaging,
} = props
const supportsSystemTheme = useMemo(
() => Boolean(window.matchMedia?.('not all and (prefers-color-scheme), (prefers-color-scheme)').matches),
@ -197,14 +205,16 @@ export const UserNavItem: React.FunctionComponent<UserNavItemProps> = props => {
About Sourcegraph <OpenInNewIcon className="icon-inline" />
</a>
)}
<a
href="https://docs.sourcegraph.com/integration/browser_extension"
target="_blank"
rel="noopener"
className="dropdown-item"
>
Browser extension <OpenInNewIcon className="icon-inline" />
</a>
{codeHostIntegrationMessaging === 'browser-extension' && (
<a
href="https://docs.sourcegraph.com/integration/browser_extension"
target="_blank"
rel="noopener"
className="dropdown-item"
>
Browser extension <OpenInNewIcon className="icon-inline" />
</a>
)}
</DropdownMenu>
</ButtonDropdown>
)

View File

@ -35,6 +35,7 @@ exports[`UserNavItem simple 1`] = `
"username": "alice",
}
}
codeHostIntegrationMessaging="browser-extension"
isExtensionAlertAnimating={false}
isLightTheme={true}
location="[Location path=/]"

View File

@ -59,6 +59,7 @@ import { browserExtensionInstalled } from '../tracking/analyticsUtils'
import { InstallBrowserExtensionAlert } from './actions/InstallBrowserExtensionAlert'
import { IS_CHROME } from '../marketing/util'
import { useLocalStorage } from '../util/useLocalStorage'
import { Settings } from '../schema/settings.schema'
/**
* Props passed to sub-routes of {@link RepoContainer}.
@ -100,7 +101,7 @@ const RepoPageNotFound: React.FunctionComponent = () => (
interface RepoContainerProps
extends RouteComponentProps<{ repoRevAndRest: string }>,
SettingsCascadeProps,
SettingsCascadeProps<Settings>,
PlatformContextProps,
TelemetryProps,
ExtensionsControllerProps,
@ -334,13 +335,20 @@ export const RepoContainer: React.FunctionComponent<RepoContainerProps> = props
])
const isBrowserExtensionInstalled = useObservable(browserExtensionInstalled)
const codeHostIntegrationMessaging =
(!isErrorLike(props.settingsCascade.final) &&
props.settingsCascade.final?.['alerts.codeHostIntegrationMessaging']) ||
'browser-extension'
// Browser extension discoverability features (alert, popover for `GoToCodeHostAction)
const [hasDismissedExtensionAlert, setHasDismissedExtensionAlert] = useLocalStorage(HAS_DISMISSED_ALERT_KEY, false)
const [hasDismissedPopover, setHasDismissedPopover] = useState(false)
const [hoverCount, setHoverCount] = useLocalStorage(HOVER_COUNT_KEY, 0)
const canShowPopover =
!hasDismissedPopover && isBrowserExtensionInstalled === false && hoverCount >= HOVER_THRESHOLD
!hasDismissedPopover &&
isBrowserExtensionInstalled === false &&
codeHostIntegrationMessaging === 'browser-extension' &&
hoverCount >= HOVER_THRESHOLD
const showExtensionAlert = useMemo(
() => isBrowserExtensionInstalled === false && !hasDismissedExtensionAlert && hoverCount >= HOVER_THRESHOLD,
// Intentionally use useMemo() here without a dependency on hoverCount to only show the alert on the next reload,
@ -412,6 +420,7 @@ export const RepoContainer: React.FunctionComponent<RepoContainerProps> = props
isChrome={IS_CHROME}
onAlertDismissed={onAlertDismissed}
externalURLs={repoOrError.externalURLs}
codeHostIntegrationMessaging={codeHostIntegrationMessaging}
/>
)}
<RepoHeader

View File

@ -23,6 +23,7 @@ for (const serviceType of services) {
<InstallBrowserExtensionAlert
isChrome={true}
onAlertDismissed={onAlertDismissed}
codeHostIntegrationMessaging="browser-extension"
externalURLs={[
{
__typename: 'ExternalLink',
@ -49,6 +50,34 @@ for (const serviceType of services) {
<InstallBrowserExtensionAlert
isChrome={false}
onAlertDismissed={onAlertDismissed}
codeHostIntegrationMessaging="browser-extension"
externalURLs={[
{
__typename: 'ExternalLink',
url: '',
serviceType,
},
]}
/>
)}
</WebStory>
),
{
chromatic: {
disable: serviceType !== 'github',
},
}
)
add(
`${serviceType} (native integration installed)`,
() => (
<WebStory>
{() => (
<InstallBrowserExtensionAlert
isChrome={false}
onAlertDismissed={onAlertDismissed}
codeHostIntegrationMessaging="native-integration"
externalURLs={[
{
__typename: 'ExternalLink',

View File

@ -5,15 +5,18 @@ import { noop } from 'lodash'
describe('InstallBrowserExtensionAlert', () => {
const serviceTypes = ['github', 'gitlab', 'phabricator', 'bitbucketServer'] as const
const browsers = ['Chrome', 'non-Chrome'] as const
const integrationTypes = ['Chrome', 'non-Chrome', 'native integration'] as const
for (const serviceType of serviceTypes) {
for (const browser of browsers) {
test(`${serviceType} (${browser})`, () => {
for (const integrationType of integrationTypes) {
test(`${serviceType} (${integrationType})`, () => {
expect(
mount(
<InstallBrowserExtensionAlert
isChrome={browser === 'Chrome'}
isChrome={integrationType === 'Chrome'}
onAlertDismissed={noop}
codeHostIntegrationMessaging={
integrationType === 'native integration' ? 'native-integration' : 'browser-extension'
}
externalURLs={[
{
__typename: 'ExternalLink',

View File

@ -8,6 +8,7 @@ interface Props {
onAlertDismissed: () => void
externalURLs: GQL.IExternalLink[]
isChrome: boolean
codeHostIntegrationMessaging: 'browser-extension' | 'native-integration'
}
// TODO(tj): Add Firefox once the Firefox extension is back
@ -17,6 +18,7 @@ export const InstallBrowserExtensionAlert: React.FunctionComponent<Props> = ({
onAlertDismissed,
externalURLs,
isChrome,
codeHostIntegrationMessaging,
}) => {
const { serviceType } = externalURLs[0]
const { displayName, icon } = serviceTypeDisplayNameAndIcon(serviceType)
@ -38,7 +40,24 @@ export const InstallBrowserExtensionAlert: React.FunctionComponent<Props> = ({
<Icon className="install-browser-extension-alert__icon" />
</div>
<p className="install-browser-extension-alert__text my-0 mr-3">
{isChrome ? (
{codeHostIntegrationMessaging ? (
<>
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up
the Sourcegraph native integration for {displayName}.{' '}
<a
className="alert-link"
href="https://docs.sourcegraph.com/integration/browser_extension"
target="_blank"
rel="noopener"
>
Learn more
</a>{' '}
or{' '}
<a className="alert-link" href={externalURLs[0].url} target="_blank" rel="noopener">
try it out
</a>
</>
) : isChrome ? (
<>
<a
href={CHROME_EXTENSION_STORE_LINK}

View File

@ -2,6 +2,7 @@
exports[`InstallBrowserExtensionAlert bitbucketServer (Chrome) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="browser-extension"
externalURLs={
Array [
Object {
@ -33,20 +34,29 @@ exports[`InstallBrowserExtensionAlert bitbucketServer (Chrome) 1`] = `
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
Bitbucket Server
.
<a
className="alert-link"
href="https://chrome.google.com/webstore/detail/dgjhfomjieaadpoljlnidmbgkdffpack"
rel="noopener noreferrer"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Install the Sourcegraph browser extension
Learn more
</a>
to add code intelligence
to PRs and file views
on
Bitbucket Server
or any other connected code host.
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
<button
@ -63,8 +73,9 @@ exports[`InstallBrowserExtensionAlert bitbucketServer (Chrome) 1`] = `
</InstallBrowserExtensionAlert>
`;
exports[`InstallBrowserExtensionAlert bitbucketServer (non-Chrome) 1`] = `
exports[`InstallBrowserExtensionAlert bitbucketServer (native integration) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="native-integration"
externalURLs={
Array [
Object {
@ -96,19 +107,101 @@ exports[`InstallBrowserExtensionAlert bitbucketServer (non-Chrome) 1`] = `
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Get code intelligence
while browsing files and reading PRs
on
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
Bitbucket Server
or any other connected code host.
.
<a
className="alert-link"
href="/help/integration/browser_extension"
rel="noopener noreferrer"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Learn more about Sourcegraph Chrome and Firefox extensions
Learn more
</a>
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
<button
aria-label="Close alert"
className="btn btn-icon test-close-alert"
onClick={[Function]}
type="button"
>
<Memo(CloseIcon)
className="icon-inline"
/>
</button>
</div>
</InstallBrowserExtensionAlert>
`;
exports[`InstallBrowserExtensionAlert bitbucketServer (non-Chrome) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="browser-extension"
externalURLs={
Array [
Object {
"__typename": "ExternalLink",
"serviceType": "bitbucketServer",
"url": "",
},
]
}
isChrome={false}
onAlertDismissed={[Function]}
>
<div
className="alert alert-info m-2 d-flex justify-content-between install-browser-extension-alert"
>
<div
className="d-flex align-items-center"
>
<div
className="position-relative"
>
<div
className="install-browser-extension-alert__icon-flash"
/>
<Memo(BitbucketIcon)
className="install-browser-extension-alert__icon"
/>
</div>
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
Bitbucket Server
.
<a
className="alert-link"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Learn more
</a>
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
@ -128,6 +221,7 @@ exports[`InstallBrowserExtensionAlert bitbucketServer (non-Chrome) 1`] = `
exports[`InstallBrowserExtensionAlert github (Chrome) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="browser-extension"
externalURLs={
Array [
Object {
@ -159,20 +253,29 @@ exports[`InstallBrowserExtensionAlert github (Chrome) 1`] = `
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
GitHub
.
<a
className="alert-link"
href="https://chrome.google.com/webstore/detail/dgjhfomjieaadpoljlnidmbgkdffpack"
rel="noopener noreferrer"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Install the Sourcegraph browser extension
Learn more
</a>
to add code intelligence
to PRs and file views
on
GitHub
or any other connected code host.
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
<button
@ -189,8 +292,9 @@ exports[`InstallBrowserExtensionAlert github (Chrome) 1`] = `
</InstallBrowserExtensionAlert>
`;
exports[`InstallBrowserExtensionAlert github (non-Chrome) 1`] = `
exports[`InstallBrowserExtensionAlert github (native integration) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="native-integration"
externalURLs={
Array [
Object {
@ -222,19 +326,101 @@ exports[`InstallBrowserExtensionAlert github (non-Chrome) 1`] = `
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Get code intelligence
while browsing files and reading PRs
on
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
GitHub
or any other connected code host.
.
<a
className="alert-link"
href="/help/integration/browser_extension"
rel="noopener noreferrer"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Learn more about Sourcegraph Chrome and Firefox extensions
Learn more
</a>
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
<button
aria-label="Close alert"
className="btn btn-icon test-close-alert"
onClick={[Function]}
type="button"
>
<Memo(CloseIcon)
className="icon-inline"
/>
</button>
</div>
</InstallBrowserExtensionAlert>
`;
exports[`InstallBrowserExtensionAlert github (non-Chrome) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="browser-extension"
externalURLs={
Array [
Object {
"__typename": "ExternalLink",
"serviceType": "github",
"url": "",
},
]
}
isChrome={false}
onAlertDismissed={[Function]}
>
<div
className="alert alert-info m-2 d-flex justify-content-between install-browser-extension-alert"
>
<div
className="d-flex align-items-center"
>
<div
className="position-relative"
>
<div
className="install-browser-extension-alert__icon-flash"
/>
<Memo(GithubIcon)
className="install-browser-extension-alert__icon"
/>
</div>
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
GitHub
.
<a
className="alert-link"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Learn more
</a>
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
@ -254,6 +440,7 @@ exports[`InstallBrowserExtensionAlert github (non-Chrome) 1`] = `
exports[`InstallBrowserExtensionAlert gitlab (Chrome) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="browser-extension"
externalURLs={
Array [
Object {
@ -285,20 +472,29 @@ exports[`InstallBrowserExtensionAlert gitlab (Chrome) 1`] = `
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
GitLab
.
<a
className="alert-link"
href="https://chrome.google.com/webstore/detail/dgjhfomjieaadpoljlnidmbgkdffpack"
rel="noopener noreferrer"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Install the Sourcegraph browser extension
Learn more
</a>
to add code intelligence
to MRs and file views
on
GitLab
or any other connected code host.
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
<button
@ -315,8 +511,9 @@ exports[`InstallBrowserExtensionAlert gitlab (Chrome) 1`] = `
</InstallBrowserExtensionAlert>
`;
exports[`InstallBrowserExtensionAlert gitlab (non-Chrome) 1`] = `
exports[`InstallBrowserExtensionAlert gitlab (native integration) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="native-integration"
externalURLs={
Array [
Object {
@ -348,19 +545,101 @@ exports[`InstallBrowserExtensionAlert gitlab (non-Chrome) 1`] = `
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Get code intelligence
while browsing files and reading MRs
on
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
GitLab
or any other connected code host.
.
<a
className="alert-link"
href="/help/integration/browser_extension"
rel="noopener noreferrer"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Learn more about Sourcegraph Chrome and Firefox extensions
Learn more
</a>
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
<button
aria-label="Close alert"
className="btn btn-icon test-close-alert"
onClick={[Function]}
type="button"
>
<Memo(CloseIcon)
className="icon-inline"
/>
</button>
</div>
</InstallBrowserExtensionAlert>
`;
exports[`InstallBrowserExtensionAlert gitlab (non-Chrome) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="browser-extension"
externalURLs={
Array [
Object {
"__typename": "ExternalLink",
"serviceType": "gitlab",
"url": "",
},
]
}
isChrome={false}
onAlertDismissed={[Function]}
>
<div
className="alert alert-info m-2 d-flex justify-content-between install-browser-extension-alert"
>
<div
className="d-flex align-items-center"
>
<div
className="position-relative"
>
<div
className="install-browser-extension-alert__icon-flash"
/>
<Memo(GitlabIcon)
className="install-browser-extension-alert__icon"
/>
</div>
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
GitLab
.
<a
className="alert-link"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Learn more
</a>
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
@ -380,6 +659,7 @@ exports[`InstallBrowserExtensionAlert gitlab (non-Chrome) 1`] = `
exports[`InstallBrowserExtensionAlert phabricator (Chrome) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="browser-extension"
externalURLs={
Array [
Object {
@ -439,20 +719,29 @@ exports[`InstallBrowserExtensionAlert phabricator (Chrome) 1`] = `
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
Phabricator
.
<a
className="alert-link"
href="https://chrome.google.com/webstore/detail/dgjhfomjieaadpoljlnidmbgkdffpack"
rel="noopener noreferrer"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Install the Sourcegraph browser extension
Learn more
</a>
to add code intelligence
while browsing and reviewing code
on
Phabricator
or any other connected code host.
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
<button
@ -469,8 +758,9 @@ exports[`InstallBrowserExtensionAlert phabricator (Chrome) 1`] = `
</InstallBrowserExtensionAlert>
`;
exports[`InstallBrowserExtensionAlert phabricator (non-Chrome) 1`] = `
exports[`InstallBrowserExtensionAlert phabricator (native integration) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="native-integration"
externalURLs={
Array [
Object {
@ -530,19 +820,129 @@ exports[`InstallBrowserExtensionAlert phabricator (non-Chrome) 1`] = `
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Get code intelligence
while browsing and reviewing code
on
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
Phabricator
or any other connected code host.
.
<a
className="alert-link"
href="/help/integration/browser_extension"
rel="noopener noreferrer"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Learn more about Sourcegraph Chrome and Firefox extensions
Learn more
</a>
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>
<button
aria-label="Close alert"
className="btn btn-icon test-close-alert"
onClick={[Function]}
type="button"
>
<Memo(CloseIcon)
className="icon-inline"
/>
</button>
</div>
</InstallBrowserExtensionAlert>
`;
exports[`InstallBrowserExtensionAlert phabricator (non-Chrome) 1`] = `
<InstallBrowserExtensionAlert
codeHostIntegrationMessaging="browser-extension"
externalURLs={
Array [
Object {
"__typename": "ExternalLink",
"serviceType": "phabricator",
"url": "",
},
]
}
isChrome={false}
onAlertDismissed={[Function]}
>
<div
className="alert alert-info m-2 d-flex justify-content-between install-browser-extension-alert"
>
<div
className="d-flex align-items-center"
>
<div
className="position-relative"
>
<div
className="install-browser-extension-alert__icon-flash"
/>
<PhabricatorIcon
className="install-browser-extension-alert__icon"
>
<svg
className="phabricator-icon mdi-icon install-browser-extension-alert__icon"
height={24}
viewBox="0 0 64 64"
width={24}
>
<g>
<g
id="Oval"
>
<g
transform="translate(-3426.45 1547.34)"
>
<path
d="M32,36.4c2.3,0,4.2-1.9,4.2-4.2S34.3,28,32,28c-2.3,0-4.2,1.9-4.2,4.2S29.7,36.4,32,36.4z"
id="path15_fill"
/>
</g>
</g>
<path
d="M58.8,31.2L57.6,32v0L58.8,31.2C54.8,25,45,14.6,32,14.6C19,14.6,9.2,25,5.2,31.2L6.4,32v0l-1.3-0.8L4.6,32l0.5,0.8 C9.2,39,19,49.4,32,49.4c13,0,22.8-10.4,26.8-16.6l0.5-0.8L58.8,31.2z M32,46.4c-10.9,0-19.6-8.5-23.7-14.4 c4.2-5.9,12.9-14.4,23.7-14.4S51.6,26.1,55.7,32C51.6,37.9,42.9,46.4,32,46.4z"
/>
<path
d="M44.4,33.3v-2.2L42.7,31c-0.1-0.6-0.2-1.2-0.4-1.8l1.5-0.7l-0.8-2l-1.6,0.6c-0.3-0.5-0.6-1-1-1.5l1.2-1.3L40,22.6l-1.3,1.2 c-0.5-0.4-1-0.7-1.5-1l0.6-1.7l-2-0.8L35,21.9c-0.6-0.2-1.2-0.3-1.8-0.3l-0.1-1.8h-2.2l-0.1,1.8c-0.6,0.1-1.2,0.2-1.8,0.3l-0.8-1.6 l-2,0.8l0.6,1.7c-0.5,0.3-1,0.6-1.5,1L24,22.6l-1.6,1.6l1.2,1.3c-0.4,0.5-0.7,1-1,1.5l-1.6-0.6l-0.8,2l1.5,0.7 c-0.2,0.6-0.3,1.2-0.4,1.8l-1.7,0.1v2.2l1.7,0.1c0.1,0.6,0.2,1.2,0.4,1.8l-1.5,0.7l0.8,2l1.6-0.6c0.3,0.5,0.6,1,1,1.5l-1.1,1.3 l1.6,1.6l1.3-1.2c0.5,0.4,1,0.7,1.5,1l-0.6,1.7l2,0.8l0.8-1.6c0.6,0.2,1.2,0.3,1.8,0.3l0.1,1.8h2.2l0.1-1.8 c0.6-0.1,1.2-0.2,1.8-0.3l0.8,1.6l2-0.8l-0.6-1.7c0.5-0.3,1-0.6,1.5-1l1.3,1.2l1.6-1.6l-1.2-1.3c0.4-0.5,0.7-1,1-1.5l1.6,0.6l0.8-2 l-1.5-0.8c0.2-0.6,0.3-1.2,0.4-1.8L44.4,33.3z M38.7,32.2c0,3.7-3,6.6-6.7,6.6s-6.7-3-6.7-6.6c0-3.7,3-6.6,6.7-6.6 S38.7,28.5,38.7,32.2z"
/>
</g>
</svg>
</PhabricatorIcon>
</div>
<p
className="install-browser-extension-alert__text my-0 mr-3"
>
Sourcegraph's code intelligence will follow you to your code host. Your site admin set up the Sourcegraph native integration for
Phabricator
.
<a
className="alert-link"
href="https://docs.sourcegraph.com/integration/browser_extension"
rel="noopener"
target="_blank"
>
Learn more
</a>
or
<a
className="alert-link"
href=""
rel="noopener"
target="_blank"
>
try it out
</a>
</p>
</div>

View File

@ -28,7 +28,7 @@ There are three fields for configuring which projects are mirrored/synchronized:
### Troubleshooting
You can test your access token's permissions by running a cURL command against the GitLab API. This is the same API and the same project list used by Sourcegraph.
You can test your access token's permissions by running a cURL command against the GitLab API. This is the same API and the same project list used by Sourcegraph.
Replace `$ACCESS_TOKEN` with the access token you are providing to Sourcegraph, and `$GITLAB_HOSTNAME` with your GitLab hostname:
@ -49,7 +49,7 @@ To configure GitLab as an authentication provider (which will enable sign-in via
## Internal rate limits
Internal rate limiting can be configured to limit the rate at which requests are made from Sourcegraph to GitLab.
Internal rate limiting can be configured to limit the rate at which requests are made from Sourcegraph to GitLab.
If enabled, the default rate is set at 36,000 per hour (10 per second) which can be configured via the `requestsPerHour` field (see below). If rate limiting is configured more than once for the same code host instance, the most restrictive limit will be used.
@ -74,6 +74,16 @@ The Sourcegraph instance's site admin must [update the `corsOrigin` site config
}
```
The site admin should also set `alerts.codeHostIntegrationMessaging` in [global settings](../config/settings.md#editing-global-settings-for-site-admins) to ensure informational content for users in the Sourcegraph webapp references the native integration and not the browser extension.
```json
{
// ...
"alerts.codeHostIntegrationMessaging": "native-integration"
// ...
}
```
## Access token scopes
Sourcegraph requires an access token with `api` permissions (and `sudo`, if you are using an `external` identity provider type). These permissions are required for the following reasons:

View File

@ -64,6 +64,16 @@ The Sourcegraph instance's site admin must [update the `corsOrigin` site config
}
```
The site admin should also set `alerts.codeHostIntegrationMessaging` in [global settings](../config/settings.md#editing-global-settings-for-site-admins) to ensure informational content for users in the Sourcegraph webapp references the native integration and not the browser extension.
```json
{
// ...
"alerts.codeHostIntegrationMessaging": "native-integration"
// ...
}
```
## Configuration
<div markdown-func=jsonschemadoc jsonschemadoc:path="admin/external_service/phabricator.schema.json">[View page on docs.sourcegraph.com](https://docs.sourcegraph.com/admin/external_service/phabricator) to see rendered content.</div>

View File

@ -42,6 +42,16 @@ For the Bitbucket Server plugin to then communicate with the Sourcegraph instanc
}
```
The site admin should also set `alerts.codeHostIntegrationMessaging` in [global settings](../admin/config/settings.md#editing-global-settings-for-site-admins) to ensure informational content for users in the Sourcegraph webapp references the native integration and not the browser extension.
```json
{
// ...
"alerts.codeHostIntegrationMessaging": "native-integration"
// ...
}
```
### Updating
In order to update the plugin, follow the same steps as for installing it, which are described in the [bitbucket-server-plugin](https://github.com/sourcegraph/bitbucket-server-plugin) repository.

View File

@ -1039,6 +1039,8 @@ type Sentry struct {
// Settings description: Configuration settings for users and organizations on Sourcegraph.
type Settings struct {
// AlertsCodeHostIntegrationMessaging description: What in-app messaging to use around availability of Sourcegraph's code intelligence on code hosts. If the native code host integration is installed, this should be set to "native-integration" and users won't need to install the Sourcegraph browser extension to get code intelligence on code hosts.
AlertsCodeHostIntegrationMessaging string `json:"alerts.codeHostIntegrationMessaging,omitempty"`
// AlertsHideObservabilitySiteAlerts description: Disables observability-related site alert banners.
AlertsHideObservabilitySiteAlerts *bool `json:"alerts.hideObservabilitySiteAlerts,omitempty"`
// AlertsShowPatchUpdates description: Whether to show alerts for patch version updates. Alerts for major and minor version updates will always be shown.

View File

@ -202,6 +202,12 @@
"default": true,
"!go": { "pointer": true }
},
"alerts.codeHostIntegrationMessaging": {
"description": "What in-app messaging to use around availability of Sourcegraph's code intelligence on code hosts. If the native code host integration is installed, this should be set to \"native-integration\" and users won't need to install the Sourcegraph browser extension to get code intelligence on code hosts.",
"type": "string",
"enum": ["browser-extension", "native-integration"],
"default": "browser-extension"
},
"extensions": {
"description": "The Sourcegraph extensions to use. Enable an extension by adding a property `\"my/extension\": true` (where `my/extension` is the extension ID). Override a previously enabled extension and disable it by setting its value to `false`.",
"type": "object",

View File

@ -207,6 +207,12 @@ const SettingsSchemaJSON = `{
"default": true,
"!go": { "pointer": true }
},
"alerts.codeHostIntegrationMessaging": {
"description": "What in-app messaging to use around availability of Sourcegraph's code intelligence on code hosts. If the native code host integration is installed, this should be set to \"native-integration\" and users won't need to install the Sourcegraph browser extension to get code intelligence on code hosts.",
"type": "string",
"enum": ["browser-extension", "native-integration"],
"default": "browser-extension"
},
"extensions": {
"description": "The Sourcegraph extensions to use. Enable an extension by adding a property ` + "`" + `\"my/extension\": true` + "`" + ` (where ` + "`" + `my/extension` + "`" + ` is the extension ID). Override a previously enabled extension and disable it by setting its value to ` + "`" + `false` + "`" + `.",
"type": "object",