[Sprint/QuietQuail](fix): Avatar changing forms now change avatar without refresh of components
Closes #2197 #2087 #1835 and half of #2082
Testing
I think it'd be best to spin this up on a subdomain connected to live data, like revolver; so that it can be tested on the live site.
This makes changes to avatars site-wide, user avatars, and group avatars.
To test:
- Create a new account.
- Upload an avatar - check it updates everywhere.
0/1
thread resolved
added scoped labels
changed the description
added 1 commit
- 908ebf3f - Changed service encapsulation for use in template
1 /** 2 * @author Ben Hayward 3 * @desc Singleton service used to store the current user avatar as a BehaviorSubject. 4 */ 5 import { Injectable } from '@angular/core'; 6 import { BehaviorSubject } from 'rxjs'; 7 8 @Injectable({ 9 providedIn: 'root', 10 }) 11 export class UserAvatarService { 12 private minds = window.Minds; 13 public src$: BehaviorSubject<string> = new BehaviorSubject(null); 14 15 constructor() { 16 this.src$.next( - Owner
With
BehaviorSubject
this will now fire 2 events (areBehaviorSubject
triggers initial by default.You could refactor to
public src$: BehaviorSubject<string>; constructor() { this.src$ = new BehaviorSubject(`${this.minds.cdn_url}icon/${this.minds.user.guid}/large/${this.minds.user.icontime}`); }
Also, should we not use session class vs window object?
Edited by Mark Harding
added scoped label and automatically removed label