🐛 Fix the notify type
This commit is contained in:
parent
e129575eff
commit
9b76311462
@ -2,6 +2,7 @@ package services
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"git.solsynth.dev/hydrogen/messaging/pkg/database"
|
"git.solsynth.dev/hydrogen/messaging/pkg/database"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -31,16 +32,16 @@ func GetAccountFriend(userId, relatedId uint, status int) (*proto.FriendshipResp
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func NotifyAccountMessager(user models.Account, subject, content string, realtime bool, forcePush bool, links ...*proto.NotifyLink) error {
|
func NotifyAccountMessager(user models.Account, t, s, c string, realtime bool, forcePush bool, links ...*proto.NotifyLink) error {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
_, err := grpc.Notify.NotifyUser(ctx, &proto.NotifyRequest{
|
_, err := grpc.Notify.NotifyUser(ctx, &proto.NotifyRequest{
|
||||||
ClientId: viper.GetString("passport.client_id"),
|
ClientId: viper.GetString("passport.client_id"),
|
||||||
ClientSecret: viper.GetString("passport.client_secret"),
|
ClientSecret: viper.GetString("passport.client_secret"),
|
||||||
Type: "notifications.messaging",
|
Type: fmt.Sprintf("messaging.%s", t),
|
||||||
Subject: subject,
|
Subject: s,
|
||||||
Content: content,
|
Content: c,
|
||||||
Links: links,
|
Links: links,
|
||||||
RecipientId: uint64(user.ExternalID),
|
RecipientId: uint64(user.ExternalID),
|
||||||
IsRealtime: realtime,
|
IsRealtime: realtime,
|
||||||
|
@ -100,6 +100,7 @@ func NewCall(channel models.Channel, founder models.ChannelMember) (models.Call,
|
|||||||
for _, member := range members {
|
for _, member := range members {
|
||||||
if member.ID != call.Founder.ID {
|
if member.ID != call.Founder.ID {
|
||||||
err = NotifyAccountMessager(member.Account,
|
err = NotifyAccountMessager(member.Account,
|
||||||
|
"incomingCall",
|
||||||
fmt.Sprintf("Call in #%s", channel.Alias),
|
fmt.Sprintf("Call in #%s", channel.Alias),
|
||||||
fmt.Sprintf("%s started a new call", call.Founder.Account.Name),
|
fmt.Sprintf("%s started a new call", call.Founder.Account.Name),
|
||||||
false,
|
false,
|
||||||
|
@ -117,6 +117,7 @@ func NewMessage(message models.Message) (models.Message, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = NotifyAccountMessager(member.Account,
|
err = NotifyAccountMessager(member.Account,
|
||||||
|
"incomingMessage",
|
||||||
fmt.Sprintf("%s in #%s", message.Sender.Account.Nick, channel.Alias),
|
fmt.Sprintf("%s in #%s", message.Sender.Account.Nick, channel.Alias),
|
||||||
fmt.Sprintf("%s", displayText),
|
fmt.Sprintf("%s", displayText),
|
||||||
true,
|
true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user