do not send notification for self boost

This commit is contained in:
Your Name 2024-02-25 10:45:07 -05:00 committed by Henri Dickson
parent f605d464d1
commit d45d1b3946
6 changed files with 21 additions and 7 deletions

View file

@ -47,7 +47,7 @@
<hgroup>
<h6 class="nickname">{{ identity.display_name }}</h6>
<div>
<span class="handler">{{ identity.full_handle }}</span>
<span class="handler">@{{ identity.full_handle }}</span>
</div>
</hgroup>
</div>

View file

@ -62,7 +62,7 @@
var cats = JSON.parse(document.getElementById('cat-data').textContent);
var data = JSON.parse(document.getElementById('data').textContent);
var opts = {
title: "{{ identity.user.mastodon_acct | default:identity.full_handle }} - {{ year }}",
title: "@{{ identity.user.mastodon_acct | default:identity.full_handle }} - {{ year }}",
element: '#viz0',
font: 1,
data: data,

@ -1 +1 @@
Subproject commit f0b9db2d033d6315792a7d75caa5b8eaceec0eae
Subproject commit 28ea59618ceb1132e86a9f7e070c15ebf3425c81

View file

@ -24,7 +24,7 @@
<a href="{{ activity.owner.url }}" class="nickname">{{ activity.owner.display_name }}</a>
</span>
<span>
<a href="{{ activity.owner.url }}" class="handler">{{ activity.owner.full_handle }}</a>
<a href="{{ activity.owner.url }}" class="handler">@{{ activity.owner.full_handle }}</a>
</span>
</div>
{% with "activity/"|add:activity.template|add:".html" as template %}

View file

@ -6,7 +6,7 @@ from catalog.common import *
from journal.models import Comment, Piece, PieceInteraction, Rating, Review, ShelfMember
from users.models.apidentity import APIdentity
from .models import Follow, Identity, Post
from .models import Follow, Identity, Post, TimelineEvent
from .utils import Takahe
_supported_ap_catalog_item_types = [
@ -128,9 +128,23 @@ def post_interacted(interaction_pk, interaction, post_pk, identity_pk):
p = Piece.objects.filter(posts__id=post_pk).first()
if not p:
return
if not APIdentity.objects.filter(pk=identity_pk).exists():
apid = APIdentity.objects.filter(pk=identity_pk).first()
if not apid:
logger.warning(f"Identity {identity_pk} not found for interaction")
return
if (
interaction == "boost"
and p.local
and p.owner.user.mastodon_acct == apid.full_handle
):
# ignore boost by oneself
TimelineEvent.objects.filter(
identity_id=p.owner_id,
type="boosted",
subject_post_id=post_pk,
subject_identity_id=identity_pk,
).delete()
return
PieceInteraction.objects.get_or_create(
target=p,
identity_id=identity_pk,

View file

@ -98,7 +98,7 @@ class APIdentity(models.Model):
@property
def full_handle(self):
return f"@{self.username}@{self.domain_name}"
return f"{self.username}@{self.domain_name}"
@property
def handler(self):