From b90884fd6957d105c773a1cd0dad1bdc08ac1337 Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sat, 29 Apr 2017 18:34:00 -0400 Subject: [PATCH] fix: Updated setup wizard to use new git author options --- client/js/configure.js | 10 ++++------ server/configure.js | 10 ++++------ server/views/configure/index.pug | 14 +++++++------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/client/js/configure.js b/client/js/configure.js index 62701254..3c8f0fb2 100644 --- a/client/js/configure.js +++ b/client/js/configure.js @@ -61,8 +61,8 @@ jQuery(document).ready(function ($) { gitAuthUser: '', gitAuthPass: '', gitAuthSSL: true, - gitSignatureName: '', - gitSignatureEmail: '', + gitShowUserEmail: true, + gitServerEmail: '', adminEmail: '', adminPassword: '', adminPasswordConfirm: '' @@ -119,6 +119,8 @@ jQuery(document).ready(function ($) { if (appconfig.git !== false && _.isPlainObject(appconfig.git)) { this.conf.gitUrl = appconfig.git.url || '' this.conf.gitBranch = appconfig.git.branch || 'master' + this.conf.gitShowUserEmail = (appconfig.git.showUserEmail !== false) + this.conf.gitServerEmail = appconfig.git.serverEmail || '' if (_.isPlainObject(appconfig.git.auth)) { this.conf.gitAuthType = appconfig.git.auth.type || 'ssh' this.conf.gitAuthSSHKey = appconfig.git.auth.privateKey || '' @@ -126,10 +128,6 @@ jQuery(document).ready(function ($) { this.conf.gitAuthPass = appconfig.git.auth.password || '' this.conf.gitAuthSSL = (appconfig.git.auth.sslVerify !== false) } - if (_.isPlainObject(appconfig.git.signature)) { - this.conf.gitSignatureName = appconfig.git.signature.name || '' - this.conf.gitSignatureEmail = appconfig.git.signature.email || '' - } } }, methods: { diff --git a/server/configure.js b/server/configure.js index b151e6fe..d1b1c1ea 100644 --- a/server/configure.js +++ b/server/configure.js @@ -193,13 +193,13 @@ module.exports = (port, spinner) => { }, () => { if (req.body.gitUseRemote === false) { return false } - return exec.stdout('git', ['config', '--local', 'user.name', req.body.gitSignatureName], { cwd: gitDir }).then(result => { + return exec.stdout('git', ['config', '--local', 'user.name', 'Wiki'], { cwd: gitDir }).then(result => { return 'Git Signature Name has been set successfully.' }) }, () => { if (req.body.gitUseRemote === false) { return false } - return exec.stdout('git', ['config', '--local', 'user.email', req.body.gitSignatureEmail], { cwd: gitDir }).then(result => { + return exec.stdout('git', ['config', '--local', 'user.email', req.body.gitServerEmail], { cwd: gitDir }).then(result => { return 'Git Signature Name has been set successfully.' }) }, @@ -340,10 +340,8 @@ module.exports = (port, spinner) => { privateKey: req.body.gitAuthSSHKey, sslVerify: (req.body.gitAuthSSL === true) }, - signature: { - name: req.body.gitSignatureName, - email: req.body.gitSignatureEmail - } + showUserEmail: (req.body.gitShowUserEmail === true), + serverEmail: req.body.gitServerEmail } } return crypto.randomBytesAsync(32).then(buf => { diff --git a/server/views/configure/index.pug b/server/views/configure/index.pug index 44540b50..49d6304d 100644 --- a/server/views/configure/index.pug +++ b/server/views/configure/index.pug @@ -264,16 +264,16 @@ html(data-logic='configure') input(type='text', placeholder='e.g. /etc/wiki/keys/git.pem', v-model='conf.gitAuthSSHKey') span.desc The full path to the private key on disk. section.columns - .column + .column.is-one-third p.control.is-fullwidth - label.label Sync User Name - input(type='text', placeholder='e.g. John Smith', v-model.number='conf.gitSignatureName', data-vv-scope='git', name='ipt-gitsigname', v-validate='{ required: true }') - span.desc The name to use when pushing commits to the git repository. + input#ipt-git-show-user-email(type='checkbox', v-model='conf.gitShowUserEmail') + label.label(for='ipt-git-show-user-email') Commit using User Email + span.desc When enabled, commits are made as the current user name and email. If unchecked, the current user name will still be used but the default commit author email will be used instead. .column p.control.is-fullwidth - label.label Sync User Email - input(type='text', placeholder='e.g. user@example.com', v-model.number='conf.gitSignatureEmail', data-vv-scope='git', name='ipt-gitsigemail', v-validate='{ required: true, email: true }') - span.desc The email to use when pushing commits to the git repository. + label.label Default Commit Author Email + input(type='text', placeholder='e.g. user@example.com', v-model.number='conf.gitServerEmail', data-vv-scope='git', name='ipt-gitsrvemail', v-validate='{ required: true, email: true }') + span.desc The default/fallback email to use when creating commits to the git repository. .panel-footer .progress-bar: div(v-bind:style='{width: currentProgress}') button.button.is-light-blue.is-outlined(v-on:click='proceedToPaths', v-bind:disabled='loading') Back