gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[reclaim-ui] 401/459: improve import logic and UI


From: gnunet
Subject: [reclaim-ui] 401/459: improve import logic and UI
Date: Fri, 11 Jun 2021 23:28:13 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository reclaim-ui.

commit b5a46724074109b87c449fc2f3e7d751cc39bf86
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Sun Jan 3 20:54:25 2021 +0900

    improve import logic and UI
---
 src/app/edit-identity/edit-identity.component.html |  6 +++---
 src/app/edit-identity/edit-identity.component.ts   | 14 ++++++++++++--
 src/locales/de/messages.json                       |  1 +
 src/locales/en/messages.json                       |  1 +
 4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/app/edit-identity/edit-identity.component.html 
b/src/app/edit-identity/edit-identity.component.html
index 652cb2c..a912457 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -50,12 +50,12 @@
         </button>
       </div>
     </div>
+    <button class="ml-1 btn btn-primary" (click)="abortAttributeImport()">
+      <span class="fa fa-times"></span> {{getMessage("Abort") }}
+    </button>
     <button class="ml-1 btn btn-primary" (click)="proceedAttributeImport()">
       <span class="fa fa-download"></span> {{getMessage("import") }}
     </button>
-    <button class="ml-1 btn btn-primary" (click)="abortAttributeImport()">
-      <span class="fa fa-download"></span> {{getMessage("Back") }}
-    </button>
   </div>
   <div class="text-center card-body" *ngIf="importInProgress && 
attributesToOverwriteOnImport.length == 0">
     <div class="text-center fa fa-4x">
diff --git a/src/app/edit-identity/edit-identity.component.ts 
b/src/app/edit-identity/edit-identity.component.ts
index f221e19..9e128bd 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -671,6 +671,7 @@ export class EditIdentityComponent implements OnInit {
     for (let overwriteInfo of this.attributesToOverwriteOnImport) {
       overwriteInfo[1] = target;
     }
+    this.proceedAttributeImport();
   }
 
   getAttrValue(attr: Attribute) {
@@ -710,6 +711,7 @@ export class EditIdentityComponent implements OnInit {
           }
           console.log("Trying to import " + cred.attributes.length + " 
attributes");
 
+          var needsUserInteraction = false;
           for (let attr of cred.attributes) {
             if ((attr.name == "sub") ||
                 (attr.name == "nonce") ||
@@ -725,13 +727,21 @@ export class EditIdentityComponent implements OnInit {
                 continue;
               }
               console.log("Found conflicting attribute " + attr.name);
-              this.attributesToOverwriteOnImport.push([attestation, false]);
+              this.attributesToOverwriteOnImport.push([attestation, 
!this.isClaimCred(existAttr)]);
               attestation.id = existAttr.id;
+              /* If the new attribute is attested, and the old wasn't, we
+               * override by default. Otherwise, we need to have the user
+               * make a decision
+               */
+              if (this.isClaimCred(existAttr)) {
+                needsUserInteraction = true;
+              }
               break;
             }
             this.attributesToImport.push(attestation);
           }
-          if (this.attributesToOverwriteOnImport.length > 0) {
+          if ((this.attributesToOverwriteOnImport.length > 0) &&
+              needsUserInteraction) {
             console.log("Wait for user input");
             return;
           }
diff --git a/src/locales/de/messages.json b/src/locales/de/messages.json
index 71d089e..663b4ea 100644
--- a/src/locales/de/messages.json
+++ b/src/locales/de/messages.json
@@ -10,6 +10,7 @@
     "Save": "Speichern",
     "Note": "Hinweis: ",
     "Value": "Wert",
+    "Abort": "Abbrechen",
     "keepAll": "Alle behalten",
     "overwriteAll": "Alle ├╝berschreiben",
     "import": "Importieren",
diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json
index 21ca678..0ea8be8 100644
--- a/src/locales/en/messages.json
+++ b/src/locales/en/messages.json
@@ -10,6 +10,7 @@
     "Save": "Save",
     "Note": "Note: ",
     "Value": "Value",
+    "Abort": "Abort",
     "keepAll": "Keep all",
     "overwriteAll": "Overwrite all",
     "import": "Import",

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]