Use user avatar hash instead of calculating it from the email
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
31361ae1f4
commit
4d61a6e918
|
@ -120,9 +120,9 @@ class VikunjaGlobalState extends State<VikunjaGlobal> {
|
|||
});
|
||||
return;
|
||||
}
|
||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "");
|
||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "", "");
|
||||
} catch (otherExceptions) {
|
||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "");
|
||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "", "");
|
||||
}
|
||||
setState(() {
|
||||
_client = client;
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
import 'package:crypto/crypto.dart';
|
||||
|
||||
class User {
|
||||
final int id;
|
||||
final String email, username;
|
||||
final String email, username, avatarHash;
|
||||
|
||||
User(this.id, this.email, this.username);
|
||||
User(this.id, this.email, this.username, this.avatarHash);
|
||||
User.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
email = json['email'],
|
||||
username = json['username'];
|
||||
username = json['username'],
|
||||
avatarHash = json['avatarUrl'];
|
||||
|
||||
toJSON() => {"id": this.id, "email": this.email, "username": this.username};
|
||||
|
||||
String avatarUrl() {
|
||||
return "https://secure.gravatar.com/avatar/" +
|
||||
md5
|
||||
.convert((this.email ?? "").trim().toLowerCase().codeUnits)
|
||||
.toString();
|
||||
return "https://secure.gravatar.com/avatar/" + this.avatarHash;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'package:vikunja_app/models/user.dart';
|
|||
import 'package:vikunja_app/service/services.dart';
|
||||
|
||||
// Data for mocked services
|
||||
var _users = {1: User(1, 'test@testuser.org', 'test1')};
|
||||
var _users = {1: User(1, 'test@testuser.org', 'test1', '')};
|
||||
|
||||
var _namespaces = {
|
||||
1: Namespace(
|
||||
|
|
Reference in New Issue