This commit is contained in:
parent
7dd02c0056
commit
fae6f35774
9 changed files with 19 additions and 19 deletions
|
@ -45,4 +45,4 @@ func main() {
|
|||
logger.Error("Application error", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -673,7 +673,7 @@ func (a *Admin) handleChannelPluginConfig(w http.ResponseWriter, r *http.Request
|
|||
|
||||
// Create config map from form values
|
||||
config := make(map[string]interface{})
|
||||
|
||||
|
||||
// Process form values based on plugin type
|
||||
if channelPlugin.PluginID == "security.domainblock" {
|
||||
// Get blocked domains from form
|
||||
|
|
|
@ -325,7 +325,7 @@ func (a *App) handleMessage(item queue.Item) {
|
|||
} else {
|
||||
a.logger.Error("Send message action with nil message")
|
||||
}
|
||||
|
||||
|
||||
case model.ActionDeleteMessage:
|
||||
// Delete a message using direct DeleteMessage call
|
||||
if err := platform.DeleteMessage(action.Chat, action.MessageID); err != nil {
|
||||
|
@ -333,7 +333,7 @@ func (a *App) handleMessage(item queue.Item) {
|
|||
} else {
|
||||
a.logger.Info("Message deleted", "message_id", action.MessageID)
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
a.logger.Error("Unknown action type", "type", action.Type)
|
||||
}
|
||||
|
@ -409,4 +409,4 @@ func (a *App) processReminder(reminder *model.Reminder) {
|
|||
if err := a.db.MarkReminderAsProcessed(reminder.ID); err != nil {
|
||||
a.logger.Error("Error marking reminder as processed", "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@ const (
|
|||
// MessageAction represents an action to be performed on the platform
|
||||
type MessageAction struct {
|
||||
Type ActionType
|
||||
Message *Message // For send_message
|
||||
MessageID string // For delete_message
|
||||
Chat string // Chat where the action happens
|
||||
Channel *Channel // Channel reference
|
||||
Message *Message // For send_message
|
||||
MessageID string // For delete_message
|
||||
Chat string // Chat where the action happens
|
||||
Channel *Channel // Channel reference
|
||||
Raw map[string]interface{} // Additional data for the action
|
||||
}
|
||||
|
||||
|
|
|
@ -268,10 +268,10 @@ func (s *SlackPlatform) deleteMessage(msg *model.Message) error {
|
|||
if !ok {
|
||||
return fmt.Errorf("no message ID provided for deletion")
|
||||
}
|
||||
|
||||
|
||||
// Convert to string if needed
|
||||
messageIDStr := fmt.Sprintf("%v", messageID)
|
||||
|
||||
|
||||
return s.DeleteMessage(msg.Chat, messageIDStr)
|
||||
}
|
||||
|
||||
|
|
|
@ -137,4 +137,4 @@ func TestOnMessage(t *testing.T) {
|
|||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ func (p *PingPlugin) OnMessage(msg *model.Message, config map[string]interface{}
|
|||
ReplyTo: msg.ID,
|
||||
Channel: msg.Channel,
|
||||
}
|
||||
|
||||
|
||||
// Create an action to send the message
|
||||
action := &model.MessageAction{
|
||||
Type: model.ActionSendMessage,
|
||||
|
|
|
@ -65,7 +65,7 @@ func (r *Reminder) OnMessage(msg *model.Message, config map[string]interface{})
|
|||
Date: time.Now(),
|
||||
ReplyTo: msg.ID,
|
||||
}
|
||||
|
||||
|
||||
return []*model.MessageAction{
|
||||
{
|
||||
Type: model.ActionSendMessage,
|
||||
|
@ -102,7 +102,7 @@ func (r *Reminder) OnMessage(msg *model.Message, config map[string]interface{})
|
|||
Date: time.Now(),
|
||||
ReplyTo: msg.ID,
|
||||
}
|
||||
|
||||
|
||||
return []*model.MessageAction{
|
||||
{
|
||||
Type: model.ActionSendMessage,
|
||||
|
@ -150,7 +150,7 @@ func (r *Reminder) OnMessage(msg *model.Message, config map[string]interface{})
|
|||
Date: time.Now(),
|
||||
ReplyTo: msg.ID,
|
||||
}
|
||||
|
||||
|
||||
return []*model.MessageAction{
|
||||
{
|
||||
Type: model.ActionSendMessage,
|
||||
|
@ -188,7 +188,7 @@ func (r *Reminder) OnMessage(msg *model.Message, config map[string]interface{})
|
|||
Date: time.Now(),
|
||||
ReplyTo: msg.ID,
|
||||
}
|
||||
|
||||
|
||||
return []*model.MessageAction{
|
||||
{
|
||||
Type: model.ActionSendMessage,
|
||||
|
@ -197,4 +197,4 @@ func (r *Reminder) OnMessage(msg *model.Message, config map[string]interface{})
|
|||
Channel: msg.Channel,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ func TestReminderOnMessage(t *testing.T) {
|
|||
if actions[0].Type != model.ActionSendMessage {
|
||||
t.Errorf("Expected action type to be %s, but got %s", model.ActionSendMessage, actions[0].Type)
|
||||
}
|
||||
|
||||
|
||||
if actions[0].Message == nil {
|
||||
t.Errorf("Expected message in action to not be nil")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue