mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
lower case all the things
This commit is contained in:
parent
889120287d
commit
2ee8b4e1b3
1 changed files with 6 additions and 4 deletions
|
@ -338,7 +338,7 @@ class Community(db.Model):
|
||||||
if self.ap_id is None:
|
if self.ap_id is None:
|
||||||
return self.name
|
return self.name
|
||||||
else:
|
else:
|
||||||
return self.ap_id
|
return self.ap_id.lower()
|
||||||
|
|
||||||
@cache.memoize(timeout=30)
|
@cache.memoize(timeout=30)
|
||||||
def moderators(self):
|
def moderators(self):
|
||||||
|
@ -376,7 +376,8 @@ class Community(db.Model):
|
||||||
|
|
||||||
|
|
||||||
def profile_id(self):
|
def profile_id(self):
|
||||||
return self.ap_profile_id if self.ap_profile_id else f"https://{current_app.config['SERVER_NAME']}/c/{self.name}"
|
retval = self.ap_profile_id if self.ap_profile_id else f"https://{current_app.config['SERVER_NAME']}/c/{self.name}"
|
||||||
|
return retval.lower()
|
||||||
|
|
||||||
def is_local(self):
|
def is_local(self):
|
||||||
return self.ap_id is None or self.profile_id().startswith('https://' + current_app.config['SERVER_NAME'])
|
return self.ap_id is None or self.profile_id().startswith('https://' + current_app.config['SERVER_NAME'])
|
||||||
|
@ -592,7 +593,7 @@ class User(UserMixin, db.Model):
|
||||||
if self.is_local():
|
if self.is_local():
|
||||||
return self.user_name
|
return self.user_name
|
||||||
else:
|
else:
|
||||||
return self.ap_id
|
return self.ap_id.lower()
|
||||||
|
|
||||||
def followers_url(self):
|
def followers_url(self):
|
||||||
if self.ap_followers_url:
|
if self.ap_followers_url:
|
||||||
|
@ -678,7 +679,8 @@ class User(UserMixin, db.Model):
|
||||||
join(CommunityMember).filter(CommunityMember.is_banned == False, CommunityMember.user_id == self.id).all()
|
join(CommunityMember).filter(CommunityMember.is_banned == False, CommunityMember.user_id == self.id).all()
|
||||||
|
|
||||||
def profile_id(self):
|
def profile_id(self):
|
||||||
return self.ap_profile_id if self.ap_profile_id else f"https://{current_app.config['SERVER_NAME']}/u/{self.user_name}"
|
result = self.ap_profile_id if self.ap_profile_id else f"https://{current_app.config['SERVER_NAME']}/u/{self.user_name}"
|
||||||
|
return result.lower()
|
||||||
|
|
||||||
def created_recently(self):
|
def created_recently(self):
|
||||||
return self.created and self.created > utcnow() - timedelta(days=7)
|
return self.created and self.created > utcnow() - timedelta(days=7)
|
||||||
|
|
Loading…
Reference in a new issue