cleanup code

This commit is contained in:
tzw
2024-01-23 16:28:08 +06:30
parent a1e87cdbf6
commit f3f75a80c6
96 changed files with 232 additions and 439 deletions

View File

@@ -41,16 +41,10 @@ class User {
}
}
String get getUserUnseenCount => userUnseenCount != null
? userUnseenCount > 100
? "99+"
: userUnseenCount.toString()
: "0";
String get getFcsUnseenCount => fcsUnseenCount != null
? fcsUnseenCount > 100
? "99+"
: fcsUnseenCount.toString()
: "0";
String get getUserUnseenCount =>
userUnseenCount > 100 ? "99+" : userUnseenCount.toString();
String get getFcsUnseenCount =>
fcsUnseenCount > 100 ? "99+" : fcsUnseenCount.toString();
List<String> privileges = [];
@@ -101,7 +95,8 @@ class User {
}
factory User.fromMap(Map<String, dynamic> map, String docID) {
var _date = (map['message_time'] as Timestamp);
var _date =
map['message_time'] == null ? null : (map['message_time'] as Timestamp);
List<String> _privileges =
map['privileges'] == null ? [] : map['privileges'].cast<String>();
@@ -127,7 +122,7 @@ class User {
}
bool isCustomer() {
return privileges == null || privileges.length == 0;
return privileges.length == 0;
}
bool hasSysAdmin() {
@@ -183,7 +178,7 @@ class User {
}
bool _has(String privilege) {
return (privileges != null ? privileges.contains(privilege) : false);
return (privileges.contains(privilege));
}
@override