gnunet-svn
[Top][All Lists]
Advanced

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

[reclaim-ui] 413/459: show profile picture in edit


From: gnunet
Subject: [reclaim-ui] 413/459: show profile picture in edit
Date: Fri, 11 Jun 2021 23:28:25 +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 a9fd491b79db0061af26dc776455f46f2fd410d0
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Tue Jan 5 23:13:11 2021 +0900

    show profile picture in edit
---
 src/app/edit-identity/edit-identity.component.html | 10 ++++++-
 src/app/edit-identity/edit-identity.component.ts   | 32 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/src/app/edit-identity/edit-identity.component.html 
b/src/app/edit-identity/edit-identity.component.html
index 6a767d8..a001e3c 100644
--- a/src/app/edit-identity/edit-identity.component.html
+++ b/src/app/edit-identity/edit-identity.component.html
@@ -2,7 +2,15 @@
 <div class="m-2 card">
   <div class="card-avatar card-img-top">
     <div class="card-avatar-character text-dark">
-      <h2 class="fa-2x"><i class="fa fa-user-circle pr-2"></i> {{ 
identity.name }}</h2>
+      <h2 class="fa-2x">
+        <img style="border-radius: 50%; width: 1em"
+             [src]="getIdentityProfilePicture(identity)"
+             *ngIf="identityHasProfilePicture()"
+             class="pr-2">
+        <i class="fa fa-user-circle"
+           *ngIf="!identityHasProfilePicture(identity)"></i>
+        {{ identity.name }}
+      </h2>
     </div>
   </div>
 
diff --git a/src/app/edit-identity/edit-identity.component.ts 
b/src/app/edit-identity/edit-identity.component.ts
index 1869503..9bd44e4 100644
--- a/src/app/edit-identity/edit-identity.component.ts
+++ b/src/app/edit-identity/edit-identity.component.ts
@@ -910,4 +910,36 @@ export class EditIdentityComponent implements OnInit {
   }
 
   isClientVerified() { return this.oidcService.isClientVerified(); }
+
+  identityHasProfilePicture(): boolean {
+    if (undefined === this.attributes) { return false };
+    for (let attr of this.attributes) {
+      if (attr.name === 'picture') {
+        return true;
+      }
+    }
+    return false;
+  }
+
+  getIdentityProfilePicture() {
+    if (undefined === this.attributes) { return '' };
+    for (let attr of this.attributes) {
+      if (attr.name === 'picture') {
+        for (let cred of this.credentials) {
+          if (cred.id == attr.credential) {
+            for (let cattr of cred.attributes) {
+              if (cattr.name != attr.value) {
+                continue;
+              }
+              return cattr.value.replace(/"/g, '');
+            }
+          }
+        }
+        return attr.value;
+      }
+    }
+    return '';
+  }
+
+
 }

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