fix remote host lookup

This commit is contained in:
zoe 2022-08-22 23:16:36 +02:00
parent 4c963abe2a
commit 6834613e8f
2 changed files with 13 additions and 5 deletions

View File

@ -26,11 +26,14 @@ class PostModel implements Comparable {
late AccountModel account; late AccountModel account;
late AccountModel? rebloggedBy; late AccountModel? rebloggedBy;
late List<MediaAttachmentModel> attachments; late List<MediaAttachmentModel> attachments;
// exists if post is a reblog
late String originalId;
PostModel.fromJson(Map<String, dynamic> json) { PostModel.fromJson(Map<String, dynamic> json) {
id = json["id"] as String; id = json["id"] as String;
reblogId = null; reblogId = null;
createdAt = json["created_at"]; createdAt = json["created_at"];
// in case of reblog
if (json["reblog"] != null) { if (json["reblog"] != null) {
rebloggedBy = AccountModel.fromJson(json["account"]); rebloggedBy = AccountModel.fromJson(json["account"]);
json = json["reblog"]; json = json["reblog"];
@ -38,6 +41,9 @@ class PostModel implements Comparable {
} else { } else {
rebloggedBy = null; rebloggedBy = null;
} }
// regular
originalId = json["id"];
uri = json["uri"] as String; uri = json["uri"] as String;
content = json["content"] as String; content = json["content"] as String;
visibility = Visibility.values.firstWhere( visibility = Visibility.values.firstWhere(

View File

@ -43,14 +43,14 @@ class _InteractionButtonState extends State<InteractionButton> {
int status = fromUrl int status = fromUrl
? await interactions.makeFullInteraction( ? await interactions.makeFullInteraction(
id, id,
widget.model.id, widget.model.originalId,
widget.model.uri, widget.model.uri,
widget.type, widget.type,
revoke: active, revoke: active,
) )
: await interactions.makeInteractionFromId( : await interactions.makeInteractionFromId(
id, id,
widget.model.id, widget.model.originalId,
widget.type, widget.type,
revoke: active, revoke: active,
); );
@ -105,9 +105,11 @@ class _InteractionButtonState extends State<InteractionButton> {
return PopupMenuButton( return PopupMenuButton(
onSelected: ((value) { onSelected: ((value) {
setState(() { if (mounted) {
idkey = value as String; setState(() {
}); idkey = value as String;
});
}
sendRequest( sendRequest(
id: value as String, id: value as String,
fromUrl: true, fromUrl: true,