-
-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(posts): return error on invalid community name #3418
fix(posts): return error on invalid community name #3418
Conversation
Makes sense. You should also make the same change in |
a81598a
to
76a69b9
Compare
Yep, http://localhost:8536/api/v3/search?q=test&community_name=InvalidCommunity Running these calls with a valid community returns the expected results. |
76a69b9
to
1f5d336
Compare
Ups I just merged another PR which causes a conflict with this one, can you fix the conflicts? |
Head branch was pushed to by a user without write access
1f5d336
to
f85f9e2
Compare
Head branch was pushed to by a user without write access
cdd25b8
to
6eac707
Compare
I've rebased as you asked, I also add to update the branch a few times to keep up with main but unless another commit is merged, it should be ready for merging. |
6eac707
to
f31e52e
Compare
Federation tests are failing in CI but passing locally, so Im merging this manually. |
This should fix #3383
Before when we get an error while listing posts on a community, because the community does not exists, we transform the Result we get into an Option, after that there is no way to recognize whether a community name was given and not found, or if no name was given at all.
To fix this, I'm simply returning the error if there is one, if not I simply wrap the value we get in an Option.
This gives a 404 error when requesting
http://localhost:8536/api/v3/post/list?community_name=InvalidCommunityName
with the Record not found message which from my testing is the same behavior we get if we try to follow a community that does not exists.I'm just starting out Rust so please don't hesitate to let me know if that's not a good way to implement it.