mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Make 'rational discourse toolkit' optional fixes #202
This commit is contained in:
parent
5575a660ca
commit
63049942ee
9 changed files with 61 additions and 16 deletions
|
@ -39,6 +39,7 @@ class SiteMiscForm(FlaskForm):
|
||||||
default_theme = SelectField(_l('Default theme'), coerce=str, render_kw={'class': 'form-select'})
|
default_theme = SelectField(_l('Default theme'), coerce=str, render_kw={'class': 'form-select'})
|
||||||
log_activitypub_json = BooleanField(_l('Log ActivityPub JSON for debugging'))
|
log_activitypub_json = BooleanField(_l('Log ActivityPub JSON for debugging'))
|
||||||
public_modlog = BooleanField(_l('Show moderation actions publicly'))
|
public_modlog = BooleanField(_l('Show moderation actions publicly'))
|
||||||
|
show_inoculation_block = BooleanField(_l('Show Rational Discourse Toolkit in sidebar'))
|
||||||
submit = SubmitField(_l('Save'))
|
submit = SubmitField(_l('Save'))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,7 @@ def admin_misc():
|
||||||
site.application_question = form.application_question.data
|
site.application_question = form.application_question.data
|
||||||
site.auto_decline_referrers = form.auto_decline_referrers.data
|
site.auto_decline_referrers = form.auto_decline_referrers.data
|
||||||
site.log_activitypub_json = form.log_activitypub_json.data
|
site.log_activitypub_json = form.log_activitypub_json.data
|
||||||
|
site.show_inoculation_block = form.show_inoculation_block.data
|
||||||
site.updated = utcnow()
|
site.updated = utcnow()
|
||||||
site.default_theme = form.default_theme.data
|
site.default_theme = form.default_theme.data
|
||||||
if site.id is None:
|
if site.id is None:
|
||||||
|
@ -169,6 +170,7 @@ def admin_misc():
|
||||||
form.application_question.data = site.application_question
|
form.application_question.data = site.application_question
|
||||||
form.auto_decline_referrers.data = site.auto_decline_referrers
|
form.auto_decline_referrers.data = site.auto_decline_referrers
|
||||||
form.log_activitypub_json.data = site.log_activitypub_json
|
form.log_activitypub_json.data = site.log_activitypub_json
|
||||||
|
form.show_inoculation_block.data = site.show_inoculation_block
|
||||||
form.default_theme.data = site.default_theme if site.default_theme is not None else ''
|
form.default_theme.data = site.default_theme if site.default_theme is not None else ''
|
||||||
form.public_modlog.data = get_setting('public_modlog', False)
|
form.public_modlog.data = get_setting('public_modlog', False)
|
||||||
return render_template('admin/misc.html', title=_('Misc settings'), form=form,
|
return render_template('admin/misc.html', title=_('Misc settings'), form=form,
|
||||||
|
|
|
@ -303,7 +303,8 @@ def show_community(community: Community):
|
||||||
content_filters=content_filters, moderating_communities=moderating_communities(current_user.get_id()),
|
content_filters=content_filters, moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site, sort=sort,
|
menu_topics=menu_topics(), site=g.site, sort=sort,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)], post_layout=post_layout, current_app=current_app)
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None,
|
||||||
|
post_layout=post_layout, current_app=current_app)
|
||||||
|
|
||||||
|
|
||||||
# RSS feed of the community
|
# RSS feed of the community
|
||||||
|
@ -602,7 +603,7 @@ def add_post(actor, type):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.id),
|
joined_communities=joined_communities(current_user.id),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1159,7 +1160,7 @@ def community_ban_user(community_id: int, user_id: int):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1266,7 +1267,7 @@ def community_moderate(actor):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
abort(401)
|
abort(401)
|
||||||
|
@ -1301,7 +1302,7 @@ def community_moderate_subscribers(actor):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
abort(401)
|
abort(401)
|
||||||
|
@ -1336,7 +1337,7 @@ def community_modlog(actor):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -50,7 +50,7 @@ def show_domain(domain_id):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
|
@ -182,7 +182,8 @@ def home_page(type, sort):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)])
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/topics', methods=['GET'])
|
@bp.route('/topics', methods=['GET'])
|
||||||
|
@ -378,7 +379,7 @@ def modlog():
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,7 @@ def show_post(post_id: int):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
response.headers.set('Vary', 'Accept, Cookie, Accept-Language')
|
response.headers.set('Vary', 'Accept, Cookie, Accept-Language')
|
||||||
return response
|
return response
|
||||||
|
@ -643,7 +643,7 @@ def continue_discussion(post_id, comment_id):
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
community=post.community,
|
community=post.community,
|
||||||
SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)])
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None)
|
||||||
response.headers.set('Vary', 'Accept, Cookie, Accept-Language')
|
response.headers.set('Vary', 'Accept, Cookie, Accept-Language')
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@ -850,7 +850,7 @@ def add_reply(post_id: int, comment_id: int):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()), mods=mod_list,
|
moderating_communities=moderating_communities(current_user.get_id()), mods=mod_list,
|
||||||
joined_communities = joined_communities(current_user.id), community=post.community,
|
joined_communities = joined_communities(current_user.id), community=post.community,
|
||||||
SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)])
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/post/<int:post_id>/options', methods=['GET'])
|
@bp.route('/post/<int:post_id>/options', methods=['GET'])
|
||||||
|
@ -1001,7 +1001,7 @@ def post_edit(post_id: int):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(), site=g.site,
|
menu_topics=menu_topics(), site=g.site,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
abort(401)
|
abort(401)
|
||||||
|
@ -1750,7 +1750,7 @@ def post_reply_edit(post_id: int, comment_id: int):
|
||||||
joined_communities=joined_communities(current_user.get_id()), menu_topics=menu_topics(),
|
joined_communities=joined_communities(current_user.get_id()), menu_topics=menu_topics(),
|
||||||
community=post.community, site=g.site,
|
community=post.community, site=g.site,
|
||||||
SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)])
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None)
|
||||||
else:
|
else:
|
||||||
abort(401)
|
abort(401)
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ def show_tag(tag):
|
||||||
moderating_communities=moderating_communities(current_user.get_id()),
|
moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(),
|
menu_topics=menu_topics(),
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)]
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
|
@ -120,7 +120,7 @@ def show_topic(topic_path):
|
||||||
show_post_community=True, moderating_communities=moderating_communities(current_user.get_id()),
|
show_post_community=True, moderating_communities=moderating_communities(current_user.get_id()),
|
||||||
joined_communities=joined_communities(current_user.get_id()),
|
joined_communities=joined_communities(current_user.get_id()),
|
||||||
menu_topics=menu_topics(),
|
menu_topics=menu_topics(),
|
||||||
inoculation=inoculation[randint(0, len(inoculation) - 1)],
|
inoculation=inoculation[randint(0, len(inoculation) - 1)] if g.site.show_inoculation_block else None,
|
||||||
POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_IMAGE=POST_TYPE_IMAGE,
|
POST_TYPE_LINK=POST_TYPE_LINK, POST_TYPE_IMAGE=POST_TYPE_IMAGE,
|
||||||
POST_TYPE_VIDEO=POST_TYPE_VIDEO,
|
POST_TYPE_VIDEO=POST_TYPE_VIDEO,
|
||||||
SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
SUBSCRIPTION_OWNER=SUBSCRIPTION_OWNER, SUBSCRIPTION_MODERATOR=SUBSCRIPTION_MODERATOR,
|
||||||
|
|
40
docs/ARCHITECTURE.md
Normal file
40
docs/ARCHITECTURE.md
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
# PieFed software architecture
|
||||||
|
|
||||||
|
This document is a work in progress.
|
||||||
|
|
||||||
|
## Stakeholders
|
||||||
|
|
||||||
|
Instance admins
|
||||||
|
|
||||||
|
Moderators of communities
|
||||||
|
|
||||||
|
Posters of content
|
||||||
|
|
||||||
|
Lurkers
|
||||||
|
|
||||||
|
Software developers
|
||||||
|
|
||||||
|
## Desired quality attributes
|
||||||
|
|
||||||
|
These attributes have been given a score out of 5 to indicate their importance.
|
||||||
|
|
||||||
|
- Performance 4/5
|
||||||
|
- Scalability 2/5
|
||||||
|
- Agility 5/5
|
||||||
|
- Reliability 1/5
|
||||||
|
- Security 2/5
|
||||||
|
- Testability 0/5
|
||||||
|
- Modifiability 5/5
|
||||||
|
- Affordability 5/5
|
||||||
|
- Manageability 5/5
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
FOSS, browser-based, run on a Linux server.
|
||||||
|
|
||||||
|
## Architecturally significant requirements
|
||||||
|
|
||||||
|
## Patterns used, diagrams
|
||||||
|
|
||||||
|
## Risks, open questions, future work
|
||||||
|
|
Loading…
Reference in a new issue