minor bugfixes

This commit is contained in:
rimu 2024-03-08 21:40:47 +13:00
parent b7f187e706
commit 6c4d0d217f
4 changed files with 13 additions and 5 deletions

View file

@ -722,10 +722,12 @@ def process_inbox_request(request_json, activitypublog_id, ip_address):
if user and community:
join_request = CommunityJoinRequest.query.filter_by(user_id=user.id, community_id=community.id).first()
if join_request:
member = CommunityMember(user_id=user.id, community_id=community.id)
db.session.add(member)
community.subscriptions_count += 1
db.session.commit()
existing_membership = CommunityMember.query.filter_by(user_id=user.id, community_id=community.id).first()
if not existing_membership:
member = CommunityMember(user_id=user.id, community_id=community.id)
db.session.add(member)
community.subscriptions_count += 1
db.session.commit()
activity_log.result = 'success'
cache.delete_memoized(community_membership, user, community)

View file

@ -120,6 +120,7 @@ def register(app):
if block_list:
for domain in block_list.split('\n'):
db.session.add(Domain(name=domain.strip(), banned=True))
db.session.add(Domain(name='anonib.al', banned=True))
# Initial roles
anon_role = Role(name='Anonymous user', weight=0)

View file

@ -207,6 +207,8 @@ class File(db.Model):
os.unlink(self.file_path)
if self.thumbnail_path and os.path.isfile(self.thumbnail_path):
os.unlink(self.thumbnail_path)
if self.source_url and not self.source_url.startswith('http') and os.path.isfile(self.source_url):
os.unlink(self.source_url)
def filesize(self):
size = 0

View file

@ -25,7 +25,10 @@ import os
@bp.route('/people', methods=['GET', 'POST'])
@login_required
def show_people():
people = User.query.filter_by(ap_id=None, deleted=False, banned=False).all()
if current_user.is_admin():
people = User.query.filter_by(ap_id=None, deleted=False, banned=False).all()
else:
people = User.query.filter_by(ap_id=None, deleted=False, banned=False, searchable=True).all()
return render_template('user/people.html', people=people, moderating_communities=moderating_communities(current_user.get_id()),
joined_communities=joined_communities(current_user.get_id()), title=_('People'))