mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 19:36:56 -08:00
Also use search.retrieve_remote_post() for requests from community side bar
This commit is contained in:
parent
2baf2b3a89
commit
e45c8d9db3
2 changed files with 2 additions and 21 deletions
|
@ -21,8 +21,7 @@ from app.chat.util import send_message
|
||||||
from app.community.forms import SearchRemoteCommunity, CreateDiscussionForm, CreateImageForm, CreateLinkForm, \
|
from app.community.forms import SearchRemoteCommunity, CreateDiscussionForm, CreateImageForm, CreateLinkForm, \
|
||||||
ReportCommunityForm, \
|
ReportCommunityForm, \
|
||||||
DeleteCommunityForm, AddCommunityForm, EditCommunityForm, AddModeratorForm, BanUserCommunityForm, \
|
DeleteCommunityForm, AddCommunityForm, EditCommunityForm, AddModeratorForm, BanUserCommunityForm, \
|
||||||
EscalateReportForm, ResolveReportForm, CreateVideoForm, CreatePollForm, RetrieveRemotePost, \
|
EscalateReportForm, ResolveReportForm, CreateVideoForm, CreatePollForm, EditCommunityWikiPageForm
|
||||||
EditCommunityWikiPageForm
|
|
||||||
from app.community.util import search_for_community, actor_to_community, \
|
from app.community.util import search_for_community, actor_to_community, \
|
||||||
save_icon_file, save_banner_file, send_to_remote_instance, \
|
save_icon_file, save_banner_file, send_to_remote_instance, \
|
||||||
delete_post_from_community, delete_post_reply_from_community, community_in_list, find_local_users, tags_from_string, \
|
delete_post_from_community, delete_post_reply_from_community, community_in_list, find_local_users, tags_from_string, \
|
||||||
|
@ -152,24 +151,6 @@ def add_remote():
|
||||||
site=g.site)
|
site=g.site)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/retrieve_remote_post/<int:community_id>', methods=['GET', 'POST'])
|
|
||||||
@login_required
|
|
||||||
def retrieve_remote_post(community_id: int):
|
|
||||||
if current_user.banned:
|
|
||||||
return show_ban_message()
|
|
||||||
form = RetrieveRemotePost()
|
|
||||||
new_post = None
|
|
||||||
community = Community.query.get_or_404(community_id)
|
|
||||||
if form.validate_on_submit():
|
|
||||||
address = form.address.data.strip()
|
|
||||||
new_post = resolve_remote_post(address, community_id)
|
|
||||||
if new_post is None:
|
|
||||||
flash(_('Post not found.'), 'warning')
|
|
||||||
|
|
||||||
return render_template('community/retrieve_remote_post.html',
|
|
||||||
title=_('Retrieve Remote Post'), form=form, new_post=new_post, community=community)
|
|
||||||
|
|
||||||
|
|
||||||
# @bp.route('/c/<actor>', methods=['GET']) - defined in activitypub/routes.py, which calls this function for user requests. A bit weird.
|
# @bp.route('/c/<actor>', methods=['GET']) - defined in activitypub/routes.py, which calls this function for user requests. A bit weird.
|
||||||
def show_community(community: Community):
|
def show_community(community: Community):
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
{% if rss_feed and not community.is_local() -%}
|
{% if rss_feed and not community.is_local() -%}
|
||||||
<ul>
|
<ul>
|
||||||
<li><p><a href="{{ community.public_url() }}">{{ _('View community on original server') }}</a></p></li>
|
<li><p><a href="{{ community.public_url() }}">{{ _('View community on original server') }}</a></p></li>
|
||||||
<li><p><a href="{{ url_for('community.retrieve_remote_post', community_id=community.id) }}">{{ _('Retrieve a post from the original server') }}</a></p></li>
|
<li><p><a href="{{ url_for('search.retrieve_remote_post') }}">{{ _('Retrieve a post from the original server') }}</a></p></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if community.local_only -%}
|
{% if community.local_only -%}
|
||||||
|
|
Loading…
Reference in a new issue