diff options
Diffstat (limited to 'users/models')
-rw-r--r-- | users/models/identity.py | 2 | ||||
-rw-r--r-- | users/models/inbox_message.py | 7 | ||||
-rw-r--r-- | users/models/system_actor.py | 2 | ||||
-rw-r--r-- | users/models/user.py | 5 |
4 files changed, 14 insertions, 2 deletions
diff --git a/users/models/identity.py b/users/models/identity.py index 2e13de1..574e54e 100644 --- a/users/models/identity.py +++ b/users/models/identity.py @@ -438,7 +438,7 @@ class Identity(StatorModel): self.username = self.username["@value"] if self.username: self.username = self.username.lower() - self.manually_approves_followers = document.get("as:manuallyApprovesFollowers") + self.manually_approves_followers = document.get("manuallyApprovesFollowers") self.public_key = document.get("publicKey", {}).get("publicKeyPem") self.public_key_id = document.get("publicKey", {}).get("id") self.icon_uri = document.get("icon", {}).get("url") diff --git a/users/models/inbox_message.py b/users/models/inbox_message.py index 0bf6851..526311d 100644 --- a/users/models/inbox_message.py +++ b/users/models/inbox_message.py @@ -116,5 +116,12 @@ class InboxMessage(StatorModel): return self.message["object"]["type"].lower() @property + def message_type_full(self): + if isinstance(self.message.get("object"), dict): + return f"{self.message_type}.{self.message_object_type}" + else: + return f"{self.message_type}" + + @property def message_actor(self): return self.message.get("actor") diff --git a/users/models/system_actor.py b/users/models/system_actor.py index fb5a9e1..46a0007 100644 --- a/users/models/system_actor.py +++ b/users/models/system_actor.py @@ -48,7 +48,7 @@ class SystemActor: }, "preferredUsername": self.username, "url": self.profile_uri, - "as:manuallyApprovesFollowers": True, + "manuallyApprovesFollowers": True, "publicKey": { "id": self.public_key_id, "owner": self.actor_uri, diff --git a/users/models/user.py b/users/models/user.py index e0cac9d..8e3dc59 100644 --- a/users/models/user.py +++ b/users/models/user.py @@ -1,3 +1,4 @@ +import urlman from django.contrib.auth.models import AbstractBaseUser, BaseUserManager from django.db import models @@ -44,6 +45,10 @@ class User(AbstractBaseUser): objects = UserManager() + class urls(urlman.Urls): + admin = "/admin/users/" + admin_edit = "{admin}{self.pk}/" + @property def is_active(self): return not (self.deleted or self.banned) |