mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-02-02 16:21:32 -08:00
Add public_url() function for User and Community classes
This commit is contained in:
parent
4dbe485608
commit
e3b9e5f0f7
1 changed files with 8 additions and 0 deletions
|
@ -440,6 +440,10 @@ class Community(db.Model):
|
|||
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 public_url(self):
|
||||
result = self.ap_public_url if self.ap_public_url else f"https://{current_app.config['SERVER_NAME']}/c/{self.name}"
|
||||
return result
|
||||
|
||||
def is_local(self):
|
||||
return self.ap_id is None or self.profile_id().startswith('https://' + current_app.config['SERVER_NAME'])
|
||||
|
||||
|
@ -750,6 +754,10 @@ class User(UserMixin, db.Model):
|
|||
result = self.ap_profile_id if self.ap_profile_id else f"https://{current_app.config['SERVER_NAME']}/u/{self.user_name}"
|
||||
return result
|
||||
|
||||
def public_url(self):
|
||||
result = self.ap_public_url if self.ap_public_url else f"https://{current_app.config['SERVER_NAME']}/u/{self.user_name}"
|
||||
return result
|
||||
|
||||
def created_recently(self):
|
||||
return self.created and self.created > utcnow() - timedelta(days=7)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue