bump gomuks, fix profile issues caused by this

This commit is contained in:
Henry Hiles 2026-08-05 16:28:47 -04:00
commit ae5b6e2b40
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
8 changed files with 50 additions and 30 deletions

View file

@ -2,7 +2,7 @@ import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:freezed_annotation/freezed_annotation.dart";
import "package:nexus/models/content/content.dart";
import "package:nexus/models/epoch_date_time_converter.dart";
import "package:nexus/models/profile.dart";
import "package:nexus/models/profile_response.dart";
part "event.freezed.dart";
part "event.g.dart";

View file

@ -1,19 +1,37 @@
import "package:fast_immutable_collections/fast_immutable_collections.dart";
import "package:freezed_annotation/freezed_annotation.dart";
import "package:nexus/models/content/membership.dart";
part "profile.freezed.dart";
part "profile.g.dart";
part "profile_response.freezed.dart";
part "profile_response.g.dart";
@freezed
abstract class ProfileResponse with _$ProfileResponse {
const factory ProfileResponse({
@JsonKey(fromJson: Profile.fromJson) required Profile profile,
required Bio? bio,
}) = _ProfileResponse;
factory ProfileResponse.fromJson(Map<String, Object?> json) =>
_$ProfileResponseFromJson(json);
}
@freezed
abstract class Bio with _$Bio {
const factory Bio({required String html, String? editSource}) = _Bio;
factory Bio.fromJson(Map<String, Object?> json) => _$BioFromJson(json);
}
@freezed
abstract class Profile with _$Profile {
static Object? readPronouns(Map<dynamic, dynamic> map, _) =>
map["m.pronouns"] ?? map["io.fsky.nyx.pronouns"];
static Object? readPronouns(Map<dynamic, dynamic> map, String key) =>
map[key] ?? map["io.fsky.nyx.pronouns"];
static Object? readTimezone(Map<dynamic, dynamic> map, _) =>
map["m.tz"] ?? map["us.cloke.msc4175.tz"];
static Object? readTimezone(Map<dynamic, dynamic> map, String key) =>
map[key] ?? map["us.cloke.msc4175.tz"];
const factory Profile({
required String id,
String? id,
String? parseError,
Uri? avatarUrl,
@ -26,7 +44,7 @@ abstract class Profile with _$Profile {
@JsonKey(readValue: Profile.readTimezone, name: "m.tz") String? timezone,
@Default(IList.empty())
@JsonKey(readValue: Profile.readPronouns, name: "io.fsky.nyx.pronouns")
@JsonKey(readValue: Profile.readPronouns, name: "m.pronouns")
IList<Pronoun> pronouns,
}) = _Profile;
@ -37,7 +55,7 @@ abstract class Profile with _$Profile {
try {
return Profile.fromJson(json);
} catch (error) {
return Profile(id: json["id"], parseError: error.toString());
return Profile(parseError: error.toString());
}
}
}