implement archived
This commit is contained in:
parent
ca2acfd850
commit
90da195a2e
@ -54,15 +54,15 @@ type LetterOutgoingService interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type LetterOutgoingServiceImpl struct {
|
type LetterOutgoingServiceImpl struct {
|
||||||
processor processor.LetterOutgoingProcessor
|
processor processor.LetterOutgoingProcessor
|
||||||
txManager *repository.TxManager
|
txManager *repository.TxManager
|
||||||
validationProcessor processor.LetterValidationProcessor
|
validationProcessor processor.LetterValidationProcessor
|
||||||
creationProcessor processor.LetterCreationProcessor
|
creationProcessor processor.LetterCreationProcessor
|
||||||
approvalProcessor processor.LetterApprovalProcessor
|
approvalProcessor processor.LetterApprovalProcessor
|
||||||
attachmentProcessor processor.LetterAttachmentProcessor
|
attachmentProcessor processor.LetterAttachmentProcessor
|
||||||
recipientProcessor processor.LetterOutgoingRecipientProcessor
|
recipientProcessor processor.LetterOutgoingRecipientProcessor
|
||||||
notificationProcessor processor.NotificationProcessor
|
notificationProcessor processor.NotificationProcessor
|
||||||
activityProcessor processor.LetterActivityProcessor
|
activityProcessor processor.LetterActivityProcessor
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewLetterOutgoingService(
|
func NewLetterOutgoingService(
|
||||||
@ -77,15 +77,15 @@ func NewLetterOutgoingService(
|
|||||||
activityProcessor processor.LetterActivityProcessor,
|
activityProcessor processor.LetterActivityProcessor,
|
||||||
) *LetterOutgoingServiceImpl {
|
) *LetterOutgoingServiceImpl {
|
||||||
return &LetterOutgoingServiceImpl{
|
return &LetterOutgoingServiceImpl{
|
||||||
processor: processor,
|
processor: processor,
|
||||||
txManager: txManager,
|
txManager: txManager,
|
||||||
validationProcessor: validationProcessor,
|
validationProcessor: validationProcessor,
|
||||||
creationProcessor: creationProcessor,
|
creationProcessor: creationProcessor,
|
||||||
approvalProcessor: approvalProcessor,
|
approvalProcessor: approvalProcessor,
|
||||||
attachmentProcessor: attachmentProcessor,
|
attachmentProcessor: attachmentProcessor,
|
||||||
recipientProcessor: recipientProcessor,
|
recipientProcessor: recipientProcessor,
|
||||||
notificationProcessor: notificationProcessor,
|
notificationProcessor: notificationProcessor,
|
||||||
activityProcessor: activityProcessor,
|
activityProcessor: activityProcessor,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ func (s *LetterOutgoingServiceImpl) CreateOutgoingLetter(ctx context.Context, re
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send notifications if letter needs approval
|
// Send notifications if letter needs approval
|
||||||
log.Printf("[DEBUG] createOutgoingLetter Finsig")
|
log.Printf("[DEBUG] createOutgoingLetter Finsig")
|
||||||
log.Printf("[DEBUG] NotificationProcessor is nil: %v", s.notificationProcessor == nil)
|
log.Printf("[DEBUG] NotificationProcessor is nil: %v", s.notificationProcessor == nil)
|
||||||
if s.notificationProcessor != nil && len(result.Approvals) > 0 {
|
if s.notificationProcessor != nil && len(result.Approvals) > 0 {
|
||||||
@ -180,7 +180,6 @@ func (s *LetterOutgoingServiceImpl) CreateOutgoingLetter(ctx context.Context, re
|
|||||||
go s.sendStepApprovalNotifications(context.Background(), result.ID, result.Subject, 1)
|
go s.sendStepApprovalNotifications(context.Background(), result.ID, result.Subject, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return transformLetterToResponse(result), nil
|
return transformLetterToResponse(result), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +241,11 @@ func (s *LetterOutgoingServiceImpl) ListOutgoingLetters(ctx context.Context, req
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
filter.IsArchived = req.IsArchived
|
archived := true
|
||||||
|
filter.IsArchived = &archived
|
||||||
|
if filter.IsArchived != nil {
|
||||||
|
filter.IsArchived = req.IsArchived
|
||||||
|
}
|
||||||
|
|
||||||
// Get raw letters data
|
// Get raw letters data
|
||||||
letters, total, err := s.processor.ListOutgoingLetters(ctx, filter, req.Limit, offset)
|
letters, total, err := s.processor.ListOutgoingLetters(ctx, filter, req.Limit, offset)
|
||||||
@ -254,7 +257,7 @@ func (s *LetterOutgoingServiceImpl) ListOutgoingLetters(ctx context.Context, req
|
|||||||
letterIDs := make([]uuid.UUID, len(letters))
|
letterIDs := make([]uuid.UUID, len(letters))
|
||||||
priorityIDs := make(map[uuid.UUID]bool)
|
priorityIDs := make(map[uuid.UUID]bool)
|
||||||
institutionIDs := make(map[uuid.UUID]bool)
|
institutionIDs := make(map[uuid.UUID]bool)
|
||||||
|
|
||||||
for i, letter := range letters {
|
for i, letter := range letters {
|
||||||
letterIDs[i] = letter.ID
|
letterIDs[i] = letter.ID
|
||||||
if letter.PriorityID != nil {
|
if letter.PriorityID != nil {
|
||||||
@ -270,7 +273,7 @@ func (s *LetterOutgoingServiceImpl) ListOutgoingLetters(ctx context.Context, req
|
|||||||
for id := range priorityIDs {
|
for id := range priorityIDs {
|
||||||
priorityIDSlice = append(priorityIDSlice, id)
|
priorityIDSlice = append(priorityIDSlice, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
institutionIDSlice := make([]uuid.UUID, 0, len(institutionIDs))
|
institutionIDSlice := make([]uuid.UUID, 0, len(institutionIDs))
|
||||||
for id := range institutionIDs {
|
for id := range institutionIDs {
|
||||||
institutionIDSlice = append(institutionIDSlice, id)
|
institutionIDSlice = append(institutionIDSlice, id)
|
||||||
@ -287,31 +290,31 @@ func (s *LetterOutgoingServiceImpl) ListOutgoingLetters(ctx context.Context, req
|
|||||||
|
|
||||||
result := batchResult{}
|
result := batchResult{}
|
||||||
errChan := make(chan error, 4)
|
errChan := make(chan error, 4)
|
||||||
|
|
||||||
// Load attachments
|
// Load attachments
|
||||||
go func() {
|
go func() {
|
||||||
result.attachments, err = s.processor.GetBatchAttachments(ctx, letterIDs)
|
result.attachments, err = s.processor.GetBatchAttachments(ctx, letterIDs)
|
||||||
errChan <- err
|
errChan <- err
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Load recipients
|
// Load recipients
|
||||||
go func() {
|
go func() {
|
||||||
result.recipients, err = s.processor.GetBatchRecipients(ctx, letterIDs)
|
result.recipients, err = s.processor.GetBatchRecipients(ctx, letterIDs)
|
||||||
errChan <- err
|
errChan <- err
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Load priorities
|
// Load priorities
|
||||||
go func() {
|
go func() {
|
||||||
result.priorities, err = s.processor.GetBatchPriorities(ctx, priorityIDSlice)
|
result.priorities, err = s.processor.GetBatchPriorities(ctx, priorityIDSlice)
|
||||||
errChan <- err
|
errChan <- err
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Load institutions
|
// Load institutions
|
||||||
go func() {
|
go func() {
|
||||||
result.institutions, err = s.processor.GetBatchInstitutions(ctx, institutionIDSlice)
|
result.institutions, err = s.processor.GetBatchInstitutions(ctx, institutionIDSlice)
|
||||||
errChan <- err
|
errChan <- err
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Wait for all goroutines and check for errors
|
// Wait for all goroutines and check for errors
|
||||||
for i := 0; i < 4; i++ {
|
for i := 0; i < 4; i++ {
|
||||||
if err := <-errChan; err != nil {
|
if err := <-errChan; err != nil {
|
||||||
@ -339,7 +342,7 @@ func (s *LetterOutgoingServiceImpl) ListOutgoingLetters(ctx context.Context, req
|
|||||||
letter.ReceiverInstitution = institution
|
letter.ReceiverInstitution = institution
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
items[i] = transformLetterToResponse(&letter)
|
items[i] = transformLetterToResponse(&letter)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,12 +482,12 @@ func (s *LetterOutgoingServiceImpl) ApproveOutgoingLetter(ctx context.Context, l
|
|||||||
if s.notificationProcessor != nil {
|
if s.notificationProcessor != nil {
|
||||||
// Step approved but not final - notify creator about step completion AND next approvers
|
// Step approved but not final - notify creator about step completion AND next approvers
|
||||||
creatorMessage := fmt.Sprintf("Surat keluar '%s' telah disetujui pada tahap %d, menunggu persetujuan tahap berikutnya", letter.Subject, currentApproval.StepOrder)
|
creatorMessage := fmt.Sprintf("Surat keluar '%s' telah disetujui pada tahap %d, menunggu persetujuan tahap berikutnya", letter.Subject, currentApproval.StepOrder)
|
||||||
go s.sendApprovalNotificationToCreator(context.Background(), letterID, letter.CreatedBy, "Surat Keluar Disetujui Tahap " + fmt.Sprintf("%d", currentApproval.StepOrder), creatorMessage)
|
go s.sendApprovalNotificationToCreator(context.Background(), letterID, letter.CreatedBy, "Surat Keluar Disetujui Tahap "+fmt.Sprintf("%d", currentApproval.StepOrder), creatorMessage)
|
||||||
|
|
||||||
// Notify next step approvers
|
// Notify next step approvers
|
||||||
nextStepOrder := currentApproval.StepOrder + 1
|
nextStepOrder := currentApproval.StepOrder + 1
|
||||||
go s.sendStepApprovalNotifications(context.Background(), letterID, letter.Subject, nextStepOrder)
|
go s.sendStepApprovalNotifications(context.Background(), letterID, letter.Subject, nextStepOrder)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -734,7 +737,6 @@ func (s *LetterOutgoingServiceImpl) CreateDiscussion(ctx context.Context, letter
|
|||||||
go s.sendOutgoingDiscussionMentionNotifications(context.Background(), letterID, userID, req.Mentions, req.Message)
|
go s.sendOutgoingDiscussionMentionNotifications(context.Background(), letterID, userID, req.Mentions, req.Message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return transformDiscussionToResponse(result), nil
|
return transformDiscussionToResponse(result), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1390,7 +1392,7 @@ func (s *LetterOutgoingServiceImpl) GetApprovalTimeline(ctx context.Context, let
|
|||||||
eventType := "approval"
|
eventType := "approval"
|
||||||
action := "approved"
|
action := "approved"
|
||||||
status := "approved"
|
status := "approved"
|
||||||
|
|
||||||
if approval.Status == "rejected" {
|
if approval.Status == "rejected" {
|
||||||
eventType = "rejection"
|
eventType = "rejection"
|
||||||
action = "rejected"
|
action = "rejected"
|
||||||
@ -1399,7 +1401,7 @@ func (s *LetterOutgoingServiceImpl) GetApprovalTimeline(ctx context.Context, let
|
|||||||
continue // Skip pending approvals as they haven't happened yet
|
continue // Skip pending approvals as they haven't happened yet
|
||||||
}
|
}
|
||||||
|
|
||||||
description := fmt.Sprintf("Step %d: %s by %s",
|
description := fmt.Sprintf("Step %d: %s by %s",
|
||||||
approval.StepOrder,
|
approval.StepOrder,
|
||||||
action,
|
action,
|
||||||
getApproverName(approval.Approver))
|
getApproverName(approval.Approver))
|
||||||
@ -1461,7 +1463,7 @@ func (s *LetterOutgoingServiceImpl) calculateTimelineSummary(
|
|||||||
completedSteps := 0
|
completedSteps := 0
|
||||||
pendingSteps := 0
|
pendingSteps := 0
|
||||||
currentStep := 0
|
currentStep := 0
|
||||||
|
|
||||||
// Count unique step orders
|
// Count unique step orders
|
||||||
stepMap := make(map[int]string)
|
stepMap := make(map[int]string)
|
||||||
for _, approval := range approvals {
|
for _, approval := range approvals {
|
||||||
@ -1469,7 +1471,7 @@ func (s *LetterOutgoingServiceImpl) calculateTimelineSummary(
|
|||||||
stepMap[approval.StepOrder] = approval.Status
|
stepMap[approval.StepOrder] = approval.Status
|
||||||
totalSteps++
|
totalSteps++
|
||||||
}
|
}
|
||||||
|
|
||||||
switch approval.Status {
|
switch approval.Status {
|
||||||
case "approved":
|
case "approved":
|
||||||
if stepMap[approval.StepOrder] == "approved" {
|
if stepMap[approval.StepOrder] == "approved" {
|
||||||
@ -1487,12 +1489,12 @@ func (s *LetterOutgoingServiceImpl) calculateTimelineSummary(
|
|||||||
// Calculate duration
|
// Calculate duration
|
||||||
totalDuration := ""
|
totalDuration := ""
|
||||||
averageStepTime := ""
|
averageStepTime := ""
|
||||||
|
|
||||||
if len(timeline) > 0 {
|
if len(timeline) > 0 {
|
||||||
lastEvent := timeline[len(timeline)-1]
|
lastEvent := timeline[len(timeline)-1]
|
||||||
duration := lastEvent.Timestamp.Sub(letter.CreatedAt)
|
duration := lastEvent.Timestamp.Sub(letter.CreatedAt)
|
||||||
totalDuration = formatDuration(duration)
|
totalDuration = formatDuration(duration)
|
||||||
|
|
||||||
if completedSteps > 0 {
|
if completedSteps > 0 {
|
||||||
avgDuration := duration / time.Duration(completedSteps)
|
avgDuration := duration / time.Duration(completedSteps)
|
||||||
averageStepTime = formatDuration(avgDuration)
|
averageStepTime = formatDuration(avgDuration)
|
||||||
@ -1548,7 +1550,7 @@ func formatDuration(d time.Duration) string {
|
|||||||
days := int(d.Hours() / 24)
|
days := int(d.Hours() / 24)
|
||||||
hours := int(d.Hours()) % 24
|
hours := int(d.Hours()) % 24
|
||||||
minutes := int(d.Minutes()) % 60
|
minutes := int(d.Minutes()) % 60
|
||||||
|
|
||||||
if days > 0 {
|
if days > 0 {
|
||||||
return fmt.Sprintf("%dd %dh %dm", days, hours, minutes)
|
return fmt.Sprintf("%dd %dh %dm", days, hours, minutes)
|
||||||
} else if hours > 0 {
|
} else if hours > 0 {
|
||||||
@ -1578,7 +1580,7 @@ func (s *LetterOutgoingServiceImpl) BulkArchiveOutgoingLetters(ctx context.Conte
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &contract.BulkArchiveLettersResponse{
|
return &contract.BulkArchiveLettersResponse{
|
||||||
Success: true,
|
Success: true,
|
||||||
Message: "Letters archived successfully",
|
Message: "Letters archived successfully",
|
||||||
@ -1588,7 +1590,7 @@ func (s *LetterOutgoingServiceImpl) BulkArchiveOutgoingLetters(ctx context.Conte
|
|||||||
|
|
||||||
func (s *LetterOutgoingServiceImpl) sendStepApprovalNotifications(ctx context.Context, letterID uuid.UUID, subject string, stepOrder int) {
|
func (s *LetterOutgoingServiceImpl) sendStepApprovalNotifications(ctx context.Context, letterID uuid.UUID, subject string, stepOrder int) {
|
||||||
log.Printf("[DEBUG] sendStepApprovalNotifications START - LetterID: %s, StepOrder: %d", letterID.String(), stepOrder)
|
log.Printf("[DEBUG] sendStepApprovalNotifications START - LetterID: %s, StepOrder: %d", letterID.String(), stepOrder)
|
||||||
|
|
||||||
approvals, err := s.processor.GetApprovalsByLetter(ctx, letterID)
|
approvals, err := s.processor.GetApprovalsByLetter(ctx, letterID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed to get approvals: %v", err)
|
log.Printf("[ERROR] Failed to get approvals: %v", err)
|
||||||
@ -1596,15 +1598,15 @@ func (s *LetterOutgoingServiceImpl) sendStepApprovalNotifications(ctx context.Co
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("[DEBUG] Found %d approvals", len(approvals))
|
log.Printf("[DEBUG] Found %d approvals", len(approvals))
|
||||||
|
|
||||||
// Find approvers for the specified step
|
// Find approvers for the specified step
|
||||||
for _, approval := range approvals {
|
for _, approval := range approvals {
|
||||||
log.Printf("[DEBUG] Checking approval: Step=%d, Status=%s, ApproverID=%v",
|
log.Printf("[DEBUG] Checking approval: Step=%d, Status=%s, ApproverID=%v",
|
||||||
approval.StepOrder, approval.Status, approval.ApproverID)
|
approval.StepOrder, approval.Status, approval.ApproverID)
|
||||||
|
|
||||||
if approval.StepOrder == stepOrder {
|
if approval.StepOrder == stepOrder {
|
||||||
log.Printf("[DEBUG] Sending notification to approver %s for step %d", approval.ApproverID.String(), stepOrder)
|
log.Printf("[DEBUG] Sending notification to approver %s for step %d", approval.ApproverID.String(), stepOrder)
|
||||||
|
|
||||||
err := s.notificationProcessor.SendOutgoingLetterNotification(
|
err := s.notificationProcessor.SendOutgoingLetterNotification(
|
||||||
ctx,
|
ctx,
|
||||||
letterID,
|
letterID,
|
||||||
@ -1624,7 +1626,7 @@ func (s *LetterOutgoingServiceImpl) sendStepApprovalNotifications(ctx context.Co
|
|||||||
// Kirim notifikasi ke creator
|
// Kirim notifikasi ke creator
|
||||||
func (s *LetterOutgoingServiceImpl) sendApprovalNotificationToCreator(ctx context.Context, letterID uuid.UUID, creatorID uuid.UUID, title string, message string) {
|
func (s *LetterOutgoingServiceImpl) sendApprovalNotificationToCreator(ctx context.Context, letterID uuid.UUID, creatorID uuid.UUID, title string, message string) {
|
||||||
log.Printf("[DEBUG] sendApprovalNotificationToCreator START - LetterID: %s, CreatorID: %s", letterID.String(), creatorID.String())
|
log.Printf("[DEBUG] sendApprovalNotificationToCreator START - LetterID: %s, CreatorID: %s", letterID.String(), creatorID.String())
|
||||||
|
|
||||||
err := s.notificationProcessor.SendOutgoingLetterNotification(
|
err := s.notificationProcessor.SendOutgoingLetterNotification(
|
||||||
ctx,
|
ctx,
|
||||||
letterID,
|
letterID,
|
||||||
@ -1641,47 +1643,47 @@ func (s *LetterOutgoingServiceImpl) sendApprovalNotificationToCreator(ctx contex
|
|||||||
|
|
||||||
func (s *LetterOutgoingServiceImpl) sendOutgoingDiscussionMentionNotifications(ctx context.Context, letterID uuid.UUID, senderUserID uuid.UUID, mentions map[string]interface{}, message string) {
|
func (s *LetterOutgoingServiceImpl) sendOutgoingDiscussionMentionNotifications(ctx context.Context, letterID uuid.UUID, senderUserID uuid.UUID, mentions map[string]interface{}, message string) {
|
||||||
log.Printf("[DEBUG] sendOutgoingDiscussionMentionNotifications START - LetterID: %s", letterID.String())
|
log.Printf("[DEBUG] sendOutgoingDiscussionMentionNotifications START - LetterID: %s", letterID.String())
|
||||||
|
|
||||||
// Extract user_ids dari mentions
|
// Extract user_ids dari mentions
|
||||||
userIDs := s.extractUserIDsFromMentions(mentions)
|
userIDs := s.extractUserIDsFromMentions(mentions)
|
||||||
if len(userIDs) == 0 {
|
if len(userIDs) == 0 {
|
||||||
log.Printf("[DEBUG] No user IDs found in mentions")
|
log.Printf("[DEBUG] No user IDs found in mentions")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("[DEBUG] Found %d mentioned users", len(userIDs))
|
log.Printf("[DEBUG] Found %d mentioned users", len(userIDs))
|
||||||
|
|
||||||
// Get letter details untuk notification
|
// Get letter details untuk notification
|
||||||
letter, err := s.processor.GetOutgoingLetterByID(ctx, letterID)
|
letter, err := s.processor.GetOutgoingLetterByID(ctx, letterID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed to get letter details: %v", err)
|
log.Printf("[ERROR] Failed to get letter details: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get sender user name dari context (bisa juga dari user service)
|
// Get sender user name dari context (bisa juga dari user service)
|
||||||
appContext := appcontext.FromGinContext(ctx)
|
appContext := appcontext.FromGinContext(ctx)
|
||||||
senderName := appContext.UserName
|
senderName := appContext.UserName
|
||||||
if senderName == "" {
|
if senderName == "" {
|
||||||
senderName = "Seseorang" // fallback jika nama tidak tersedia
|
senderName = "Seseorang" // fallback jika nama tidak tersedia
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kirim notification ke setiap mentioned user
|
// Kirim notification ke setiap mentioned user
|
||||||
for _, mentionedUserID := range userIDs {
|
for _, mentionedUserID := range userIDs {
|
||||||
// Jangan kirim notification ke sender sendiri
|
// Jangan kirim notification ke sender sendiri
|
||||||
if mentionedUserID == senderUserID {
|
if mentionedUserID == senderUserID {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
subject := "Anda Disebutkan dalam Diskusi Surat Keluar"
|
subject := "Anda Disebutkan dalam Diskusi Surat Keluar"
|
||||||
notificationMessage := fmt.Sprintf("%s menyebutkan Anda dalam diskusi surat keluar: %s", senderName, letter.Subject)
|
notificationMessage := fmt.Sprintf("%s menyebutkan Anda dalam diskusi surat keluar: %s", senderName, letter.Subject)
|
||||||
|
|
||||||
err := s.notificationProcessor.SendOutgoingLetterNotification(
|
err := s.notificationProcessor.SendOutgoingLetterNotification(
|
||||||
ctx,
|
ctx,
|
||||||
letterID,
|
letterID,
|
||||||
mentionedUserID,
|
mentionedUserID,
|
||||||
subject,
|
subject,
|
||||||
notificationMessage)
|
notificationMessage)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed to send mention notification to user %s: %v", mentionedUserID.String(), err)
|
log.Printf("[ERROR] Failed to send mention notification to user %s: %v", mentionedUserID.String(), err)
|
||||||
} else {
|
} else {
|
||||||
@ -1693,11 +1695,11 @@ func (s *LetterOutgoingServiceImpl) sendOutgoingDiscussionMentionNotifications(c
|
|||||||
// Helper function untuk extract user IDs dari mentions map
|
// Helper function untuk extract user IDs dari mentions map
|
||||||
func (s *LetterOutgoingServiceImpl) extractUserIDsFromMentions(mentions map[string]interface{}) []uuid.UUID {
|
func (s *LetterOutgoingServiceImpl) extractUserIDsFromMentions(mentions map[string]interface{}) []uuid.UUID {
|
||||||
userIDs := make([]uuid.UUID, 0)
|
userIDs := make([]uuid.UUID, 0)
|
||||||
|
|
||||||
if mentions == nil {
|
if mentions == nil {
|
||||||
return userIDs
|
return userIDs
|
||||||
}
|
}
|
||||||
|
|
||||||
if userIDsInterface, exists := mentions["user_ids"]; exists {
|
if userIDsInterface, exists := mentions["user_ids"]; exists {
|
||||||
switch userIDsValue := userIDsInterface.(type) {
|
switch userIDsValue := userIDsInterface.(type) {
|
||||||
case []interface{}:
|
case []interface{}:
|
||||||
@ -1718,6 +1720,6 @@ func (s *LetterOutgoingServiceImpl) extractUserIDsFromMentions(mentions map[stri
|
|||||||
userIDs = userIDsValue
|
userIDs = userIDsValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return userIDs
|
return userIDs
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user