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

View File

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