chore: fix lint formatting after conflict resolution
This commit is contained in:
parent
9c96618798
commit
efb68501b9
6 changed files with 16 additions and 20 deletions
|
|
@ -307,13 +307,6 @@ func (c *SlackChannel) handleAppMention(ev *slackevents.AppMentionEvent) {
|
||||||
if ev.User == c.botUserID {
|
if ev.User == c.botUserID {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !c.IsAllowed(ev.User) {
|
|
||||||
logger.DebugCF("slack", "App mention rejected by allowlist", map[string]interface{}{
|
|
||||||
"user_id": ev.User,
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if !c.IsAllowed(ev.User) {
|
if !c.IsAllowed(ev.User) {
|
||||||
logger.DebugCF("slack", "Mention rejected by allowlist", map[string]any{
|
logger.DebugCF("slack", "Mention rejected by allowlist", map[string]any{
|
||||||
"user_id": ev.User,
|
"user_id": ev.User,
|
||||||
|
|
@ -380,16 +373,9 @@ func (c *SlackChannel) handleSlashCommand(event socketmode.Event) {
|
||||||
c.socketClient.Ack(*event.Request)
|
c.socketClient.Ack(*event.Request)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !c.IsAllowed(cmd.UserID) {
|
|
||||||
logger.DebugCF("slack", "Slash command rejected by allowlist", map[string]any{
|
|
||||||
"user_id": cmd.UserID,
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
senderID := cmd.UserID
|
senderID := cmd.UserID
|
||||||
if !c.IsAllowed(senderID) {
|
if !c.IsAllowed(senderID) {
|
||||||
logger.DebugCF("slack", "Slash command rejected by allowlist", map[string]interface{}{
|
logger.DebugCF("slack", "Slash command rejected by allowlist", map[string]any{
|
||||||
"user_id": senderID,
|
"user_id": senderID,
|
||||||
"command": cmd.Command,
|
"command": cmd.Command,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,12 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/sipeed/picoclaw/pkg/bus"
|
|
||||||
"github.com/sipeed/picoclaw/pkg/config"
|
|
||||||
"github.com/slack-go/slack"
|
"github.com/slack-go/slack"
|
||||||
"github.com/slack-go/slack/slackevents"
|
"github.com/slack-go/slack/slackevents"
|
||||||
"github.com/slack-go/slack/socketmode"
|
"github.com/slack-go/slack/socketmode"
|
||||||
|
|
||||||
|
"github.com/sipeed/picoclaw/pkg/bus"
|
||||||
|
"github.com/sipeed/picoclaw/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestParseSlackChatID(t *testing.T) {
|
func TestParseSlackChatID(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/caarlos0/env/v11"
|
"github.com/caarlos0/env/v11"
|
||||||
|
|
||||||
"github.com/sipeed/picoclaw/pkg/utils"
|
"github.com/sipeed/picoclaw/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/adhocore/gronx"
|
"github.com/adhocore/gronx"
|
||||||
|
|
||||||
"github.com/sipeed/picoclaw/pkg/utils"
|
"github.com/sipeed/picoclaw/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,14 @@ func TestSaveStoreFixesExistingFilePermissions(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
cs := NewCronService(storePath, nil)
|
cs := NewCronService(storePath, nil)
|
||||||
if _, err := cs.AddJob("perm-test", CronSchedule{Kind: "every", EveryMS: int64Ptr(60000)}, "hello", true, "cli", "direct"); err != nil {
|
if _, err := cs.AddJob(
|
||||||
|
"perm-test",
|
||||||
|
CronSchedule{Kind: "every", EveryMS: int64Ptr(60000)},
|
||||||
|
"hello",
|
||||||
|
true,
|
||||||
|
"cli",
|
||||||
|
"direct",
|
||||||
|
); err != nil {
|
||||||
t.Fatalf("AddJob failed: %v", err)
|
t.Fatalf("AddJob failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ import "os"
|
||||||
|
|
||||||
// WritePrivateFile writes data and enforces 0600 permissions for both new and existing files.
|
// WritePrivateFile writes data and enforces 0600 permissions for both new and existing files.
|
||||||
func WritePrivateFile(path string, data []byte) error {
|
func WritePrivateFile(path string, data []byte) error {
|
||||||
if err := os.WriteFile(path, data, 0600); err != nil {
|
if err := os.WriteFile(path, data, 0o600); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return os.Chmod(path, 0600)
|
return os.Chmod(path, 0o600)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue