diff --git a/packages/insomnia-app/app/sync/vcs/index.js b/packages/insomnia-app/app/sync/vcs/index.js index 4329d0b8c..0050d68e0 100644 --- a/packages/insomnia-app/app/sync/vcs/index.js +++ b/packages/insomnia-app/app/sync/vcs/index.js @@ -782,6 +782,11 @@ export default class VCS { parent created author + authorAccount { + firstName + lastName + email + } name description state { @@ -821,6 +826,21 @@ export default class VCS { mutation ($projectId: ID!, $snapshots: [SnapshotInput!]!, $branchName: String!) { snapshotsCreate(project: $projectId, snapshots: $snapshots, branch: $branchName) { id + parent + created + author + authorAccount { + firstName + lastName + email + } + name + description + state { + blob + key + name + } } } `, @@ -832,6 +852,9 @@ export default class VCS { 'snapshotsPush', ); + // Store them in case something has changed + await this._storeSnapshots(snapshotsCreate); + console.log('[sync] Pushed snapshots', snapshotsCreate.map(s => s.id).join(', ')); } } diff --git a/packages/insomnia-app/app/ui/components/modals/sync-history-modal.js b/packages/insomnia-app/app/ui/components/modals/sync-history-modal.js index 91a8a0e62..327090277 100644 --- a/packages/insomnia-app/app/ui/components/modals/sync-history-modal.js +++ b/packages/insomnia-app/app/ui/components/modals/sync-history-modal.js @@ -11,6 +11,7 @@ import PromptButton from '../base/prompt-button'; import HelpTooltip from '../help-tooltip'; import type { Snapshot } from '../../../sync/types'; import VCS from '../../../sync/vcs'; +import * as session from '../../../account/session'; type Props = { workspace: Workspace, @@ -66,6 +67,34 @@ class SyncHistoryModal extends React.PureComponent { await this.refreshState(); } + static renderAuthorName(snapshot: Snapshot) { + let name = ''; + let email = ''; + + if (snapshot.authorAccount) { + const { firstName, lastName } = snapshot.authorAccount; + name += `${firstName} ${lastName}`; + email = snapshot.authorAccount.email; + } + + if (snapshot.author === session.getAccountId()) { + name += ' (you)'; + } + + if (name) { + return ( + + {name}{' '} + + {email} + + + ); + } else { + return '--'; + } + } + render() { const { branch, history } = this.state; @@ -79,7 +108,8 @@ class SyncHistoryModal extends React.PureComponent { Message - Time + When + Author Objects Restore @@ -104,6 +134,7 @@ class SyncHistoryModal extends React.PureComponent { intervalSeconds={30} /> + {SyncHistoryModal.renderAuthorName(snapshot)} {snapshot.state.length} { const { status } = this.state; const id = e.currentTarget.name; - const newStage = status.stage[id] + const isStaged = !!status.stage[id]; + + const newStage = isStaged ? await vcs.unstage(status.stage, [status.stage[id]]) : await vcs.stage(status.stage, [status.unstaged[id]]); @@ -281,7 +283,7 @@ class SyncStagingModal extends React.PureComponent { return ( -