Phuks-co / throat

Open Source link aggregator and discussion platform powering Phuks
https://phuks.co
MIT License
73 stars 32 forks source link

Give moderators control of the types of posts in their subs #217

Closed happy-river closed 3 years ago

happy-river commented 3 years ago

We have some subs that would like to be memes-only and some that would like to be text-only. Add new sub settings to give moderators finer control over what kinds of posts to allow in their subs.

The Submit a Post form was already problematic because if you navigated to it from the home page and then typed in the name of a sub that allowed polls, you wouldn't see the poll option, and if you navigated to it from a sub that allowed polls and typed in the name of a sub that didn't allow polls, it would allow you to create a poll anyway. Adding more options made this worse, so I redid it to have the JS fetch the types of posts possible for each sub when it fetches the sub name suggestions, and to show and hide the radio buttons accordingly. The logic for showing and hiding form components based on the selected radio button was duplicated in the template and in the JS, so I simplified the template by making the JS logic run when the form is loaded.

happy-river commented 3 years ago

This PR also modifies the Submit a Post form so that the poll datepicker is only shown when its checkbox is selected.

happy-river commented 3 years ago

A small issue I found while testing this is that by default all existing subs have all post types disabled, imo we should leave everything enabled by default for existing and new subs

Did you run the migration?

Polsaker commented 3 years ago

D'oh