Also use search.retrieve_remote_post() for requests from community side bar

This commit is contained in:
freamon 2025-01-19 15:04:32 +00:00
parent 2baf2b3a89
commit e45c8d9db3
2 changed files with 2 additions and 21 deletions

View file

@ -21,8 +21,7 @@ from app.chat.util import send_message
from app.community.forms import SearchRemoteCommunity, CreateDiscussionForm, CreateImageForm, CreateLinkForm, \
ReportCommunityForm, \
DeleteCommunityForm, AddCommunityForm, EditCommunityForm, AddModeratorForm, BanUserCommunityForm, \
EscalateReportForm, ResolveReportForm, CreateVideoForm, CreatePollForm, RetrieveRemotePost, \
EditCommunityWikiPageForm
EscalateReportForm, ResolveReportForm, CreateVideoForm, CreatePollForm, EditCommunityWikiPageForm
from app.community.util import search_for_community, actor_to_community, \
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, \
@ -152,24 +151,6 @@ def add_remote():
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.
def show_community(community: Community):

View file

@ -52,7 +52,7 @@
{% if rss_feed and not community.is_local() -%}
<ul>
<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>
{% endif -%}
{% if community.local_only -%}