This commit is contained in:
parent
fa7a04077a
commit
b675188013
|
@ -1 +0,0 @@
|
||||||
|
|
|
@ -3,10 +3,10 @@ from services.redis import redis
|
||||||
|
|
||||||
|
|
||||||
async def notify_reaction(reaction):
|
async def notify_reaction(reaction):
|
||||||
channel_name = "new_reaction"
|
channel_name = "reaction"
|
||||||
data = {
|
data = {
|
||||||
"payload": reaction,
|
"payload": reaction,
|
||||||
"kind": f"new_reaction{reaction.kind}"
|
"action": "create"
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
await redis.publish(channel_name, json.dumps(data))
|
await redis.publish(channel_name, json.dumps(data))
|
||||||
|
@ -15,10 +15,10 @@ async def notify_reaction(reaction):
|
||||||
|
|
||||||
|
|
||||||
async def notify_shout(shout):
|
async def notify_shout(shout):
|
||||||
channel_name = "new_shout"
|
channel_name = "shout"
|
||||||
data = {
|
data = {
|
||||||
"payload": shout,
|
"payload": shout,
|
||||||
"kind": "new_shout"
|
"action": "create"
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
await redis.publish(channel_name, json.dumps(data))
|
await redis.publish(channel_name, json.dumps(data))
|
||||||
|
@ -31,10 +31,10 @@ async def notify_follower(follower: dict, author_id: int):
|
||||||
for k in fields:
|
for k in fields:
|
||||||
if k not in ["id", "name", "slug", "userpic"]:
|
if k not in ["id", "name", "slug", "userpic"]:
|
||||||
del follower[k]
|
del follower[k]
|
||||||
channel_name = f"followers:{author_id}"
|
channel_name = f"follower:{author_id}"
|
||||||
data = {
|
data = {
|
||||||
"payload": follower,
|
"payload": follower,
|
||||||
"kind": "new_follower",
|
"action": "follow",
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
await redis.publish(channel_name, json.dumps(data))
|
await redis.publish(channel_name, json.dumps(data))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user