mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
local only communities
This commit is contained in:
parent
2f947e6d0d
commit
5b66fea4fe
4 changed files with 9 additions and 3 deletions
|
@ -20,6 +20,7 @@ class AddLocalCommunity(FlaskForm):
|
|||
banner_file = FileField(_('Banner image'))
|
||||
rules = TextAreaField(_l('Rules'))
|
||||
nsfw = BooleanField('NSFW')
|
||||
local_only = BooleanField('Local only')
|
||||
submit = SubmitField(_l('Create'))
|
||||
|
||||
def validate(self, extra_validators=None):
|
||||
|
|
|
@ -43,7 +43,7 @@ def add_local():
|
|||
community = Community(title=form.community_name.data, name=form.url.data, description=form.description.data,
|
||||
rules=form.rules.data, nsfw=form.nsfw.data, private_key=private_key,
|
||||
public_key=public_key, description_html=markdown_to_html(form.description.data),
|
||||
rules_html=markdown_to_html(form.rules.data),
|
||||
rules_html=markdown_to_html(form.rules.data), local_only=form.local_only.data,
|
||||
ap_profile_id='https://' + current_app.config['SERVER_NAME'] + '/c/' + form.url.data,
|
||||
ap_followers_url='https://' + current_app.config['SERVER_NAME'] + '/c/' + form.url.data + '/followers',
|
||||
subscriptions_count=1, instance_id=1, low_quality='memes' in form.url.data)
|
||||
|
@ -70,7 +70,7 @@ def add_local():
|
|||
return redirect('/c/' + community.name)
|
||||
|
||||
return render_template('community/add_local.html', title=_('Create community'), form=form, moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id()))
|
||||
joined_communities=joined_communities(current_user.get_id()), current_app=current_app)
|
||||
|
||||
|
||||
@bp.route('/add_remote', methods=['GET', 'POST'])
|
||||
|
@ -176,7 +176,7 @@ def show_community(community: Community):
|
|||
rss_feed=f"https://{current_app.config['SERVER_NAME']}/community/{community.link()}/feed", rss_feed_name=f"{community.title} posts on PieFed",
|
||||
content_filters=content_filters, moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.get_id()), sort=sort,
|
||||
inoculation=inoculation[randint(0, len(inoculation) - 1)], post_layout=post_layout)
|
||||
inoculation=inoculation[randint(0, len(inoculation) - 1)], post_layout=post_layout, current_app=current_app)
|
||||
|
||||
|
||||
# RSS feed of the community
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
<small class="field_hint">Provide a wide image - letterbox orientation.</small>
|
||||
{{ render_field(form.rules) }}
|
||||
{{ render_field(form.nsfw) }}
|
||||
{{ render_field(form.local_only) }}
|
||||
<small class="field_hint">{{ _('Only people using %(name)s can post or reply', name=current_app.config['SERVER_NAME']) }}.</small>
|
||||
{{ render_field(form.submit) }}
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -138,6 +138,9 @@
|
|||
<a href="{{ community.profile_id() }}">View community on original server</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if community.local_only %}
|
||||
<p>{{ _('Only people on %(instance_name)s can post or reply in this community.', instance_name=current_app.config['SERVER_NAME']) }}</p>
|
||||
{% endif %}
|
||||
<p>
|
||||
<a class="no-underline" href="{{ rss_feed }}" rel="nofollow"><span class="fe fe-rss"></span> </a><a href="{{ rss_feed }}" rel="nofollow">RSS feed</a>
|
||||
</p>
|
||||
|
|
Loading…
Add table
Reference in a new issue