Skip to content

Commit

Permalink
Fix post and comment error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentTreguier committed Jan 13, 2024
1 parent 558545c commit abf120c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Fyreplace/Sources/ViewControllers/CommentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ extension CommentViewController: CommentViewModelDelegate {
case .permissionDenied:
switch message {
case "caller_blocked":
return "Error.Permission"
return "Comment.Error.Blocked"

default:
return "Comment.Error.Blocked"
return "Error.Permission"
}

case .invalidArgument:
Expand Down
11 changes: 10 additions & 1 deletion Fyreplace/Sources/ViewControllers/PostViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,19 @@ extension PostViewController: PostViewModelDelegate {
errored = true

switch GRPCStatus.Code(rawValue: code)! {
case .invalidArgument, .notFound:
case .notFound:
NotificationCenter.default.post(name: FPPost.wasNotFoundNotification, object: self)
return "Post.Error.NotFound"

case .invalidArgument:
switch message {
case "invalid_uuid":
return "Post.Error.NotFound"

default:
return "Error"
}

default:
return "Error"
}
Expand Down

0 comments on commit abf120c

Please sign in to comment.