gnunet-svn
[Top][All Lists]
Advanced

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

[reclaim-ui] 142/459: fix forjoin bug


From: gnunet
Subject: [reclaim-ui] 142/459: fix forjoin bug
Date: Fri, 11 Jun 2021 23:23:54 +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 5804d4e7c218da3fcd5da547189f5def7f35f099
Author: Schanzenbach, Martin <mschanzenbach@posteo.de>
AuthorDate: Fri Jul 19 14:19:42 2019 +0200

    fix forjoin bug
---
 src/app/identity-list/identity-list.component.html |  4 +--
 src/app/identity-list/identity-list.component.ts   | 39 +++++++++-------------
 2 files changed, 18 insertions(+), 25 deletions(-)

diff --git a/src/app/identity-list/identity-list.component.html 
b/src/app/identity-list/identity-list.component.html
index 30a5d1f..ee18d3a 100644
--- a/src/app/identity-list/identity-list.component.html
+++ b/src/app/identity-list/identity-list.component.html
@@ -259,8 +259,8 @@
                 <div style="min-width: 15em">{{attribute.name}}</div>
               </td>
               <td>
-                <div *ngIf="attribute.value.length <= 10" style="min-width: 
15em">{{attribute.value}}</div>
-                <div *ngIf="attribute.value.length > 10" style="min-width: 
15em">{{attribute.value.substring(0, 10)}}[...]</div>
+                <div *ngIf="attribute.value.length <= 20" style="min-width: 
15em">{{attribute.value}}</div>
+                <div *ngIf="attribute.value.length > 20" style="min-width: 
15em">{{attribute.value.substring(0, 15)}}<span 
style="color:#eee">[...]</span></div>
               </td>
               <td>
                 <div style="min-width: 8em; text-align: center;">
diff --git a/src/app/identity-list/identity-list.component.ts 
b/src/app/identity-list/identity-list.component.ts
index c4338b1..381dc57 100644
--- a/src/app/identity-list/identity-list.component.ts
+++ b/src/app/identity-list/identity-list.component.ts
@@ -9,8 +9,7 @@ import { NamestoreService } from '../namestore.service';
 import { OpenIdService } from '../open-id.service';
 import { ReclaimService } from '../reclaim.service';
 import { ModalService } from '../modal.service';
-import { finalize } from 'rxjs/operators';
-import { forkJoin, EMPTY } from 'rxjs';
+import { from, forkJoin, EMPTY } from 'rxjs';
 
 @Component({
   selector: 'app-identity-list',
@@ -152,18 +151,20 @@ export class IdentityListComponent implements OnInit {
 
   saveIdentityAttributes(identity) {
     this.storeAttributes(identity)
-      .pipe(
-        finalize(() => this.updateAttributes(identity))
-      )
-      .subscribe(res => console.log(res),
-        () => EMPTY, () => {
-          this.identityInEdit = null;
-          this.updateAttributes(identity);
-        });
+      .subscribe(res => {
+        console.log(res)
+      },
+      err => {
+        EMPTY
+      },
+      () => {
+        this.identityInEdit = null;
+        this.updateAttributes(identity);
+      });
     this.newAttribute.name = '';
     this.newAttribute.value = '';
     this.newAttribute.type = 'STRING';
-    this.identityInEdit = null;
+    //this.identityInEdit = null;
   }
 
   deleteAttribute(attribute) {
@@ -268,11 +269,6 @@ export class IdentityListComponent implements OnInit {
     });
   }
 
-  saveAttribute(identity, attribute) {
-    return this.reclaimService.addAttribute(identity, attribute)
-      .subscribe(() => { this.updateAttributes(identity); });
-  }
-
   private storeAttributes(identity) {
     const promises = [];
     let i;
@@ -280,15 +276,15 @@ export class IdentityListComponent implements OnInit {
       if (this.missingAttributes[identity.pubkey][i].value === '') {
         continue;
       }
-      promises.push(this.saveAttribute(
-        identity, this.missingAttributes[identity.pubkey][i]));
+      promises.push(from(this.reclaimService.addAttribute(
+        identity, this.missingAttributes[identity.pubkey][i])));
     }
     for (i = 0; i < this.attributes[identity.pubkey].length; i++) {
       promises.push(
-        this.saveAttribute(identity, this.attributes[identity.pubkey][i]));
+        from(this.reclaimService.addAttribute(identity, 
this.attributes[identity.pubkey][i])));
     }
     if (this.newAttribute.value !== '') {
-      promises.push(this.saveAttribute(identity, this.newAttribute));
+      promises.push(from(this.reclaimService.addAttribute(identity, 
this.newAttribute)));
     }
 
     return forkJoin(promises);
@@ -296,9 +292,6 @@ export class IdentityListComponent implements OnInit {
 
   addAttribute() {
     this.storeAttributes(this.identityInEdit)
-      .pipe(
-        finalize(() => this.updateAttributes(this.identityInEdit))
-      )
       .subscribe(res => console.log(res),
         () => EMPTY, () => {
           this.newAttribute.name = '';

-- 
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]