Skip to content

Commit

Permalink
Fix not found fedilink not showing error message (#1617)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeharding authored Oct 5, 2024
1 parent 88d6a28 commit 8415718
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/features/resolve/resolveSlice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ export const resolveObject =
});
} catch (error) {
if (
isLemmyError(error, "couldnt_find_object" as never) || // TODO lemmy 0.19 and less support
// TODO START lemmy 0.19 and less support
isLemmyError(error, "couldnt_find_object" as never) ||
isLemmyError(error, "couldnt_find_post" as never) ||
isLemmyError(error, "couldnt_find_comment" as never) ||
isLemmyError(error, "couldnt_find_person" as never) ||
isLemmyError(error, "couldnt_find_community" as never) ||
// TODO END
isLemmyError(error, "not_found")
) {
try {
Expand All @@ -85,7 +91,13 @@ export const resolveObject =
});
} catch (error) {
if (
isLemmyError(error, "couldnt_find_object" as never) || // TODO lemmy 0.19 and less support
// TODO START lemmy 0.19 and less support
isLemmyError(error, "couldnt_find_object" as never) ||
isLemmyError(error, "couldnt_find_post" as never) ||
isLemmyError(error, "couldnt_find_comment" as never) ||
isLemmyError(error, "couldnt_find_person" as never) ||
isLemmyError(error, "couldnt_find_community" as never) ||
// TODO END
isLemmyError(error, "not_found")
) {
dispatch(couldNotFindUrl(url));
Expand Down
9 changes: 8 additions & 1 deletion src/features/shared/useLemmyUrlHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,21 @@ export default function useLemmyUrlHandler() {
object = await dispatch(resolveObject(url.toString()));
} catch (error) {
if (
isLemmyError(error, "couldnt_find_object" as never) || // TODO lemmy 0.19 and less support
// TODO START lemmy 0.19 and less support
isLemmyError(error, "couldnt_find_object" as never) ||
isLemmyError(error, "couldnt_find_post" as never) ||
isLemmyError(error, "couldnt_find_comment" as never) ||
isLemmyError(error, "couldnt_find_person" as never) ||
isLemmyError(error, "couldnt_find_community" as never) ||
// TODO END
isLemmyError(error, "not_found")
) {
presentToast({
message: `Could not find ${getObjectName(
url.pathname,
)} on your instance. Try again to open in browser.`,
duration: 3500,
color: "warning",
});
}

Expand Down

0 comments on commit 8415718

Please sign in to comment.