Skip to content
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

Replaced is_ok method for community ban checks with match method #680

Closed
wants to merge 2 commits into from

Conversation

niniack
Copy link
Contributor

@niniack niniack commented Apr 29, 2020

Work done for issue #639

}
let _ban_check = match CommunityUserBanView::get(&conn, user_id, post.community_id) {
Ok(_) => { return Err(APIError::err("community_ban").into()) },
Err(_e) => {},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are unnecessary. In general, don't use match or if let, unless you're going to use the value that it unwraps.

let site_creator_id = site_view_owned.creator_id;
let creator_index = admins.iter().position(|r| r.id == site_creator_id).unwrap();
let creator_user = admins.remove(creator_index);
admins.insert(0, creator_user);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one does make sense here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that makes sense, thanks for the pointers!

@niniack niniack closed this Apr 30, 2020
@niniack niniack deleted the backend_cleanup branch May 7, 2020 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants