Skip to content

Hide community v2 #2055

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

Merged
merged 12 commits into from
Feb 18, 2022
Merged

Hide community v2 #2055

merged 12 commits into from
Feb 18, 2022

Conversation

dayinjing
Copy link
Contributor

@dayinjing dayinjing commented Jan 22, 2022

Wanted a cleaner PR because I messed up prev branch with a rebase.

Fixing problems found with,

#2017

And then #2032

For issue #1980

This PR does the following,

  1. Adds the ability to hide or unhide a community with a new put endpoint example curl usage,
curl -X PUT http://localhost:1236/api/v3/community/hide \   
-H "Content-Type: application/json" \
-d \
'{"community_id":3,"hidden":true,"reason":"controversal","auth":"Foo"}'
  1. Hidden communities do not show up in all, local, or trending unless subscribed
  2. updates mod log to represent that.

Still reviewing it so I will ask for a code Review in the chat. Might make some cleanups but ran it through a few simple test cases

Ran it over test cases looked over the code, asked some questions below but I think this is mostly ready for review.

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

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

Sry I'm slow on this, been busy with a few other things.

Just a few changes then I'll do testing.

…ommunity_view. Dont force non null for reason
@dayinjing
Copy link
Contributor Author

dayinjing commented Jan 29, 2022

Think I got all these requested changes in the latest commit. I'll look over it later a bit more before I request another review.

@dayinjing dayinjing requested a review from dessalines January 31, 2022 14:40
@dessalines
Copy link
Member

Also lint is failing, run cargo +nightly fmt

@dayinjing dayinjing requested a review from dessalines January 31, 2022 23:13
@dayinjing
Copy link
Contributor Author

Think I straightened out all those things. Unless something minor was left in a match statement. Went ahead and requested re review. I'll look over it a bit later if no one reviews it tomorrow.

@dayinjing dayinjing requested a review from Nutomic as a code owner February 2, 2022 16:13
@dayinjing dayinjing requested a review from dessalines February 2, 2022 16:14
@dayinjing
Copy link
Contributor Author

changed column and tested still working.

@dayinjing
Copy link
Contributor Author

@dessalines Bump

@dayinjing dayinjing requested a review from dessalines February 14, 2022 20:34
@dayinjing
Copy link
Contributor Author

Thanks @dessalines Those are fixed. New checks running

Copy link
Member

@dessalines dessalines left a comment

Choose a reason for hiding this comment

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

Looks good, but I'd like nutomic to do a pass over it as well.

@dessalines
Copy link
Member

@Nutomic

@dessalines
Copy link
Member

@Nutomic

updated: Some(naive_now()),
hidden: Some(data.hidden),
..CommunityForm::default()
};
Copy link
Member

Choose a reason for hiding this comment

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

I dont think there is any reason to update icon/banner/nsfw here.

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 mainly my fault, we need to make sure all the nullable fields in every form are Option<Option<..., but that can be a separate PR.

let op = UserOperationCrud::EditCommunity;
send_community_ws_message(data.community_id, op, websocket_id, None, context).await
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated to this PR, but later we really need to find a diffent (shorter) way to handle all this. If changing a single field needs so much code, it creates way too much bloat.

Copy link
Member

Choose a reason for hiding this comment

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

We can always create specific helper functions rather than use the full update version, but I'd rather just do defaults correctly and do the thing above.

Copy link
Member

@Nutomic Nutomic left a comment

Choose a reason for hiding this comment

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

Sorry i missed the notification somehow, just got a minor note. Thanks for the contribution!

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.

3 participants