Skip to content

Commit

Permalink
Merge branch 'main' into feat-add-field-control-notification
Browse files Browse the repository at this point in the history
  • Loading branch information
mo3et authored Feb 28, 2025
2 parents 3c06eee + b7f8813 commit 7ba7250
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 38 deletions.
26 changes: 13 additions & 13 deletions config/notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ joinGroupApplication:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
enable: true
title: joinGroupApplication title
desc: joinGroupApplication desc
ext: joinGroupApplication ext
Expand All @@ -51,7 +51,7 @@ groupApplicationAccepted:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
enable: true
title: groupApplicationAccepted title
desc: groupApplicationAccepted desc
ext: groupApplicationAccepted ext
Expand All @@ -61,7 +61,7 @@ groupApplicationRejected:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
enable: true
title: groupApplicationRejected title
desc: groupApplicationRejected desc
ext: groupApplicationRejected ext
Expand Down Expand Up @@ -198,7 +198,7 @@ friendApplicationAdded:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: false
enable: true
title: Somebody applies to add you as a friend
desc: Somebody applies to add you as a friend
ext: Somebody applies to add you as a friend
Expand Down Expand Up @@ -228,7 +228,7 @@ friendAdded:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
enable: false
title: We have become friends
desc: We have become friends
ext: We have become friends
Expand All @@ -238,7 +238,7 @@ friendDeleted:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
enable: false
title: deleted a friend
desc: deleted a friend
ext: deleted a friend
Expand All @@ -248,7 +248,7 @@ friendRemarkSet:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
enable: false
title: Your friend's profile has been changed
desc: Your friend's profile has been changed
ext: Your friend's profile has been changed
Expand All @@ -258,7 +258,7 @@ blackAdded:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
enable: false
title: blocked a user
desc: blocked a user
ext: blocked a user
Expand All @@ -268,7 +268,7 @@ blackDeleted:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
enable: false
title: Remove a blocked user
desc: Remove a blocked user
ext: Remove a blocked user
Expand All @@ -278,7 +278,7 @@ friendInfoUpdated:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
enable: false
title: friend info updated
desc: friend info updated
ext: friend info updated
Expand All @@ -289,7 +289,7 @@ userInfoUpdated:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
enable: false
title: userInfo updated
desc: userInfo updated
ext: userInfo updated
Expand All @@ -310,7 +310,7 @@ conversationChanged:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
enable: false
title: conversation changed
desc: conversation changed
ext: conversation changed
Expand All @@ -320,7 +320,7 @@ conversationSetPrivate:
reliabilityLevel: 1
unreadCount: false
offlinePush:
enable: true
enable: false
title: burn after reading
desc: burn after reading
ext: burn after reading
3 changes: 3 additions & 0 deletions internal/api/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/mitchellh/mapstructure"

"github.com/openimsdk/open-im-server/v3/pkg/apistruct"
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
Expand Down Expand Up @@ -175,6 +176,8 @@ func (m *MessageApi) getSendMsgReq(c *gin.Context, req apistruct.SendMsg) (sendM
data = apistruct.AtElem{}
case constant.Custom:
data = apistruct.CustomElem{}
case constant.MarkdownText:
data = apistruct.MarkdownTextElem{}
case constant.OANotification:
data = apistruct.OANotificationElem{}
req.SessionType = constant.NotificationChatType
Expand Down
5 changes: 4 additions & 1 deletion internal/push/push_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ func (c *ConsumerHandler) shouldPushOffline(_ context.Context, msg *sdkws.MsgDat
if !isOfflinePush {
return false
}
if msg.ContentType == constant.SignalingNotification {
switch msg.ContentType {
case constant.RoomParticipantsConnectedNotification:
return false
case constant.RoomParticipantsDisconnectedNotification:
return false
}
return true
Expand Down
31 changes: 7 additions & 24 deletions internal/rpc/msg/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ package msg

import (
"context"
"math/rand"
"strconv"
"time"

"github.com/openimsdk/open-im-server/v3/pkg/common/servererrs"
"github.com/openimsdk/tools/utils/datautil"
"github.com/openimsdk/tools/utils/encrypt"
"github.com/openimsdk/tools/utils/timeutil"
"math/rand"
"strconv"
"time"

"github.com/openimsdk/protocol/constant"
"github.com/openimsdk/protocol/msg"
Expand Down Expand Up @@ -137,27 +138,9 @@ func (m *msgServer) encapsulateMsgData(msg *sdkws.MsgData) {
msg.SendTime = timeutil.GetCurrentTimestampByMill()
}
switch msg.ContentType {
case constant.Text:
fallthrough
case constant.Picture:
fallthrough
case constant.Voice:
fallthrough
case constant.Video:
fallthrough
case constant.File:
fallthrough
case constant.AtText:
fallthrough
case constant.Merger:
fallthrough
case constant.Card:
fallthrough
case constant.Location:
fallthrough
case constant.Custom:
fallthrough
case constant.Quote:
case constant.Text, constant.Picture, constant.Voice, constant.Video,
constant.File, constant.AtText, constant.Merger, constant.Card,
constant.Location, constant.Custom, constant.Quote, constant.AdvancedText, constant.MarkdownText:
case constant.Revoke:
datautil.SetSwitchFromOptions(msg.Options, constant.IsUnreadCount, false)
datautil.SetSwitchFromOptions(msg.Options, constant.IsOfflinePush, false)
Expand Down
4 changes: 4 additions & 0 deletions pkg/apistruct/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ type TextElem struct {
Content string `json:"content" validate:"required"`
}

type MarkdownTextElem struct {
Content string `mapstructure:"content" validate:"required"`
}

type StreamMsgElem struct {
Type string `mapstructure:"type" validate:"required"`
Content string `mapstructure:"content" validate:"required"`
Expand Down

0 comments on commit 7ba7250

Please sign in to comment.