|
|
@@ -950,10 +950,12 @@ func (r *mutationResolver) CreateMessage(ctx context.Context, input model.NewMes
|
|
|
// Get channel participants for publishing the message event
|
|
|
var channel models.Channel
|
|
|
if err := r.DB.Preload("Participants").First(&channel, conversationID).Error; err == nil {
|
|
|
- // Build list of participant IDs
|
|
|
- participantIDs := make([]uint, len(channel.Participants))
|
|
|
- for i, participant := range channel.Participants {
|
|
|
- participantIDs[i] = participant.ID
|
|
|
+ // Build list of participant IDs (excluding the sender to prevent notification loops)
|
|
|
+ participantIDs := make([]uint, 0, len(channel.Participants))
|
|
|
+ for _, participant := range channel.Participants {
|
|
|
+ if participant.ID != senderID {
|
|
|
+ participantIDs = append(participantIDs, participant.ID)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Publish message event to channel participants
|