hide block link + show 'me' for own content by matching identity hash
This commit is contained in:
parent
ec9e1754e4
commit
824d933aee
1 changed files with 9 additions and 2 deletions
|
|
@ -50,13 +50,20 @@ class ForumHandlers:
|
||||||
return False
|
return False
|
||||||
return secrets.compare_digest(token, expected)
|
return secrets.compare_digest(token, expected)
|
||||||
|
|
||||||
def _author_str(self, name, instance):
|
def _is_local(self, instance):
|
||||||
if instance == "local":
|
if instance == "local":
|
||||||
|
return True
|
||||||
|
if self.identity and instance == self.identity.hash.hex():
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def _author_str(self, name, instance):
|
||||||
|
if self._is_local(instance):
|
||||||
return "me"
|
return "me"
|
||||||
return instance[:6]
|
return instance[:6]
|
||||||
|
|
||||||
def _block_link(self, instance):
|
def _block_link(self, instance):
|
||||||
if instance == "local":
|
if self._is_local(instance):
|
||||||
return ""
|
return ""
|
||||||
return f' <a class="forum-action-inline" href="/forum/blockhash/{instance}">[block]</a>'
|
return f' <a class="forum-action-inline" href="/forum/blockhash/{instance}">[block]</a>'
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue