Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Prefill version info in package initialization error issues
Browse files Browse the repository at this point in the history
Co-authored-by: Antonio Scandurra <[email protected]>
  • Loading branch information
jasonrudolph and Antonio Scandurra committed Feb 5, 2018
1 parent 349526a commit 15d6381
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ module.exports = new TeletypePackage({
cluster: atom.config.get('teletype.pusherCluster'),
disableStats: true
},
baseURL: atom.config.get('teletype.baseURL')
baseURL: atom.config.get('teletype.baseURL'),
getAtomVersion: atom.getVersion.bind(atom)
})
12 changes: 10 additions & 2 deletions lib/package-initialization-error-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ class PackageInitializationErrorComponent {
url.searchParams.append('body',
'### Diagnostics\n\n' +
'```\n' +
initializationError.diagnosticMessage + '\n' +
'```\n'
initializationError.diagnosticMessage + '\n\n' +
'```\n' +
'### Versions\n\n' +
`**Teletype version**: v${getTeletypeVersion()}\n` +
`**Atom version**: ${this.props.getAtomVersion()}\n` +
`**Platform**: ${process.platform}\n`
)

return url.href
Expand All @@ -58,3 +62,7 @@ class PackageInitializationErrorComponent {
await packageManager.activatePackage('teletype')
}
}

function getTeletypeVersion () {
return require('../package.json').version
}
3 changes: 2 additions & 1 deletion lib/popover-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PopoverComponent {
const {
isClientOutdated, initializationError,
authenticationProvider, portalBindingManager,
commandRegistry, clipboard, workspace, notificationManager, packageManager
commandRegistry, clipboard, workspace, notificationManager, packageManager, getAtomVersion
} = this.props

let activeComponent
Expand All @@ -36,6 +36,7 @@ class PopoverComponent {
activeComponent = $(PackageInitializationErrorComponent, {
ref: 'packageInitializationErrorComponent',
packageManager,
getAtomVersion,
initializationError
})
} else if (this.props.authenticationProvider.isSignedIn()) {
Expand Down
10 changes: 6 additions & 4 deletions lib/teletype-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ module.exports =
class TeletypePackage {
constructor (options) {
const {
baseURL, clipboard, commandRegistry, credentialCache, notificationManager,
packageManager, pubSubGateway, pusherKey, pusherOptions,
tetherDisconnectWindow, tooltipManager, workspace
baseURL, clipboard, commandRegistry, credentialCache, getAtomVersion,
notificationManager, packageManager, pubSubGateway, pusherKey,
pusherOptions, tetherDisconnectWindow, tooltipManager, workspace
} = options

this.workspace = workspace
Expand All @@ -24,6 +24,7 @@ class TeletypePackage {
this.pusherKey = pusherKey
this.pusherOptions = pusherOptions
this.baseURL = baseURL
this.getAtomVersion = getAtomVersion
this.tetherDisconnectWindow = tetherDisconnectWindow
this.credentialCache = credentialCache || new CredentialCache()
this.client = new TeletypeClient({
Expand Down Expand Up @@ -132,7 +133,8 @@ class TeletypePackage {
clipboard: this.clipboard,
workspace: this.workspace,
notificationManager: this.notificationManager,
packageManager: this.packageManager
packageManager: this.packageManager,
getAtomVersion: this.getAtomVersion
})

this.portalStatusBarIndicator.attach()
Expand Down
1 change: 1 addition & 0 deletions test/teletype-package.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,7 @@ suite('TeletypePackage', function () {
commandRegistry: env.commands,
tooltipManager: env.tooltips,
clipboard: new FakeClipboard(),
getAtomVersion: function () { return 'x.y.z' },
tetherDisconnectWindow: 300,
credentialCache
})
Expand Down

0 comments on commit 15d6381

Please sign in to comment.