From 9c35282f89b18536a851292e26909244cbf6c465 Mon Sep 17 00:00:00 2001 From: brantje Date: Mon, 6 Feb 2017 11:59:03 +0100 Subject: [PATCH] Small fixes for 2.0.1 Fix for going back from deleted credentials Use method --- controller/credentialcontroller.php | 5 ++++- js/app/controllers/credential.js | 4 ++++ js/app/controllers/revision.js | 2 +- js/templates.js | 6 +++--- templates/views/credential_revisions.html | 11 +++++------ templates/views/partials/forms/settings/tool.html | 2 +- templates/views/show_vault.html | 2 +- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/controller/credentialcontroller.php b/controller/credentialcontroller.php index 7d47ecd4..1b116b64 100644 --- a/controller/credentialcontroller.php +++ b/controller/credentialcontroller.php @@ -292,7 +292,10 @@ class CredentialController extends ApiController { '', $this->userId, Activity::TYPE_ITEM_ACTION); $this->sharingService->unshareCredential($credential->getGuid()); foreach ($this->credentialRevisionService->getRevisions($credential->getId()) as $revision) { - $this->credentialRevisionService->deleteRevision($revision['id'], $this->userId); + $id = $revision->getId(); + if(isset($id)){ + $this->credentialRevisionService->deleteRevision($id, $this->userId); + } } } diff --git a/js/app/controllers/credential.js b/js/app/controllers/credential.js index d70ceaa4..d7c46885 100644 --- a/js/app/controllers/credential.js +++ b/js/app/controllers/credential.js @@ -195,6 +195,7 @@ }; + var settingsLoaded = function () { $scope.settings = SettingsService.getSettings(); }; @@ -399,6 +400,9 @@ }); + $scope.clearState = function () { + $scope.delete_time = 0; + }; $scope.downloadFile = function (credential, file) { var callback = function (result) { diff --git a/js/app/controllers/revision.js b/js/app/controllers/revision.js index efe688e6..4a52d916 100644 --- a/js/app/controllers/revision.js +++ b/js/app/controllers/revision.js @@ -141,7 +141,7 @@ }); }; - $scope.cancel = function () { + $scope.cancelRevision = function () { $location.path('/vault/' + $routeParams.vault_id); $scope.storedCredential = null; SettingsService.setSetting('revision_credential', null); diff --git a/js/templates.js b/js/templates.js index efc11594..c9393de9 100644 --- a/js/templates.js +++ b/js/templates.js @@ -3,7 +3,7 @@ angular.module('templates-main', ['views/credential_revisions.html', 'views/edit angular.module('views/credential_revisions.html', []).run(['$templateCache', function($templateCache) { 'use strict'; $templateCache.put('views/credential_revisions.html', - '
{{ \'revision.of\' | translate}} {{revision.created * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}} ({{revision.credential_data.label}}) {{ \'revision.edited.by\' | translate}} {{revision.edited_by}}
{{ \'no.revisions\' | translate}}
{{ \'revision.of\' | translate}} {{selectedRevision.created * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{ \'label\' | translate }}
{{ \'account\' | translate }}
{{ \'password\' | translate }}
{{\'otp\' | translate}}
{{\'email\' | translate}}
{{ \'url\' | translate}}
{{\'notes\' | translate}}
{{ \'files\' | translate}}
{{field.label}}
{{field.value.filename}} ({{field.value.size | bytes}})
{{ \'expire.time\' | translate }}
{{selectedRevision.credential_data.expire_time * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{ \'changed\' | translate}}
{{selectedRevision.credential_data.changed * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{ \'created\' | translate}}
{{selectedRevision.credential_data.created * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{tag.text}}
'); + '
{{ \'revision.of\' | translate}} {{revision.created * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}} ({{revision.credential_data.label}}) {{ \'revision.edited.by\' | translate}} {{revision.edited_by}}
{{ \'no.revisions\' | translate}}
{{ \'revision.of\' | translate}} {{selectedRevision.created * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{ \'label\' | translate }}
{{ \'account\' | translate }}
{{ \'password\' | translate }}
{{\'otp\' | translate}}
{{\'email\' | translate}}
{{ \'url\' | translate}}
{{\'notes\' | translate}}
{{ \'files\' | translate}}
{{field.label}}
{{field.value.filename}} ({{field.value.size | bytes}})
{{ \'expire.time\' | translate }}
{{selectedRevision.credential_data.expire_time * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{ \'changed\' | translate}}
{{selectedRevision.credential_data.changed * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{ \'created\' | translate}}
{{selectedRevision.credential_data.created * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{tag.text}}
'); }]); angular.module('views/edit_credential.html', []).run(['$templateCache', function($templateCache) { @@ -75,7 +75,7 @@ angular.module('views/partials/forms/settings/sharing.html', []).run(['$template angular.module('views/partials/forms/settings/tool.html', []).run(['$templateCache', function($templateCache) { 'use strict'; $templateCache.put('views/partials/forms/settings/tool.html', - '

{{ \'tool.intro\' | translate}}

{{ \'min.strength\' | translate}}

{{ \'scan.result.msg\' | translate}}

{{ \'label\' | translate}}{{ \'score\' | translate}}{{ \'password\' | translate}}{{ \'action\' | translate}}
{{result.label}}
'); + '

{{ \'tool.intro\' | translate}}

{{ \'min.strength\' | translate}}

{{ \'scan.result.msg\' | translate}}

{{ \'label\' | translate}}{{ \'score\' | translate}}{{ \'password\' | translate}}{{ \'action\' | translate}}
{{result.label}}
'); }]); angular.module('views/partials/forms/share_credential/basics.html', []).run(['$templateCache', function($templateCache) { @@ -113,7 +113,7 @@ angular.module('views/share_credential.html', []).run(['$templateCache', functio angular.module('views/show_vault.html', []).run(['$templateCache', function($templateCache) { 'use strict'; $templateCache.put('views/show_vault.html', - '
{{ \'deleted.since\' | translate }}: All time {{delete_time | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
+
{{ \'use.regex\' | translate }}
{{ ::tag.text}} {{ ::credential.label}}
  • {{ ::credential.label}}
    {{ ::tag.text}}

{{selectedCredential.label}}

{{ \'account\' | translate }}
{{ \'password\' | translate }}
{{\'otp\' | translate}}
{{\'email\' | translate}}
{{ \'url\' | translate}}
{{\'notes\' | translate}}
{{ \'files\' | translate}}
{{field.label}}
{{field.value.filename}} ({{field.value.size | bytes}})
{{ \'expire.time\' | translate }}
{{selectedCredential.expire_time * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{ \'changed\' | translate}}
{{selectedCredential.changed * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{ \'created\' | translate}}
{{selectedCredential.created * 1000 | date:\'dd-MM-yyyy @ HH:mm:ss\'}}
{{tag.text}}
'); }]); diff --git a/templates/views/credential_revisions.html b/templates/views/credential_revisions.html index cc5291e2..6cea920f 100644 --- a/templates/views/credential_revisions.html +++ b/templates/views/credential_revisions.html @@ -1,15 +1,14 @@