do not send notification for self boost
This commit is contained in:
parent
f605d464d1
commit
d45d1b3946
6 changed files with 21 additions and 7 deletions
|
@ -47,7 +47,7 @@
|
||||||
<hgroup>
|
<hgroup>
|
||||||
<h6 class="nickname">{{ identity.display_name }}</h6>
|
<h6 class="nickname">{{ identity.display_name }}</h6>
|
||||||
<div>
|
<div>
|
||||||
<span class="handler">{{ identity.full_handle }}</span>
|
<span class="handler">@{{ identity.full_handle }}</span>
|
||||||
</div>
|
</div>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
var cats = JSON.parse(document.getElementById('cat-data').textContent);
|
var cats = JSON.parse(document.getElementById('cat-data').textContent);
|
||||||
var data = JSON.parse(document.getElementById('data').textContent);
|
var data = JSON.parse(document.getElementById('data').textContent);
|
||||||
var opts = {
|
var opts = {
|
||||||
title: "{{ identity.user.mastodon_acct | default:identity.full_handle }} - {{ year }}",
|
title: "@{{ identity.user.mastodon_acct | default:identity.full_handle }} - {{ year }}",
|
||||||
element: '#viz0',
|
element: '#viz0',
|
||||||
font: 1,
|
font: 1,
|
||||||
data: data,
|
data: data,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f0b9db2d033d6315792a7d75caa5b8eaceec0eae
|
Subproject commit 28ea59618ceb1132e86a9f7e070c15ebf3425c81
|
|
@ -24,7 +24,7 @@
|
||||||
<a href="{{ activity.owner.url }}" class="nickname">{{ activity.owner.display_name }}</a>
|
<a href="{{ activity.owner.url }}" class="nickname">{{ activity.owner.display_name }}</a>
|
||||||
</span>
|
</span>
|
||||||
<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>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{% with "activity/"|add:activity.template|add:".html" as template %}
|
{% with "activity/"|add:activity.template|add:".html" as template %}
|
||||||
|
|
|
@ -6,7 +6,7 @@ from catalog.common import *
|
||||||
from journal.models import Comment, Piece, PieceInteraction, Rating, Review, ShelfMember
|
from journal.models import Comment, Piece, PieceInteraction, Rating, Review, ShelfMember
|
||||||
from users.models.apidentity import APIdentity
|
from users.models.apidentity import APIdentity
|
||||||
|
|
||||||
from .models import Follow, Identity, Post
|
from .models import Follow, Identity, Post, TimelineEvent
|
||||||
from .utils import Takahe
|
from .utils import Takahe
|
||||||
|
|
||||||
_supported_ap_catalog_item_types = [
|
_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()
|
p = Piece.objects.filter(posts__id=post_pk).first()
|
||||||
if not p:
|
if not p:
|
||||||
return
|
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")
|
logger.warning(f"Identity {identity_pk} not found for interaction")
|
||||||
return
|
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(
|
PieceInteraction.objects.get_or_create(
|
||||||
target=p,
|
target=p,
|
||||||
identity_id=identity_pk,
|
identity_id=identity_pk,
|
||||||
|
|
|
@ -98,7 +98,7 @@ class APIdentity(models.Model):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def full_handle(self):
|
def full_handle(self):
|
||||||
return f"@{self.username}@{self.domain_name}"
|
return f"{self.username}@{self.domain_name}"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def handler(self):
|
def handler(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue