Skip to content

Commit

Permalink
fixed bug in send method
Browse files Browse the repository at this point in the history
* with signal-cli 0.13.0 the default behavior changed
  and message to oneself did not trigger a notification anymore.

  As this is a behavioral change and we try to avoid any behavioral
  changes in the REST API, the previous behavior was reinstated again
  by explicitly adding "--notify-self".

see #511
  • Loading branch information
Bernhard B committed Apr 4, 2024
1 parent 8c9b797 commit dfdcfa3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ func (s *SignalClient) send(number string, message string,
QuoteMentions []string `json:"quote-mentions,omitempty"`
TextStyles []string `json:"text-style,omitempty"`
EditTimestamp *int64 `json:"edit-timestamp,omitempty"`
NotifySelf bool `json:"notify-self,omitempty"`
}

request := Request{Message: message}
Expand All @@ -422,6 +423,8 @@ func (s *SignalClient) send(number string, message string,
request.Attachments = append(request.Attachments, attachmentEntry.toDataForSignal())
}

request.NotifySelf = true

request.Sticker = sticker
if mentions != nil {
request.Mentions = make([]string, len(mentions))
Expand Down Expand Up @@ -518,6 +521,8 @@ func (s *SignalClient) send(number string, message string,
cmd = append(cmd, strconv.FormatInt(*editTimestamp, 10))
}

cmd = append(cmd, "--notify-self")

rawData, err := s.cliClient.Execute(true, cmd, message)
if err != nil {
cleanupAttachmentEntries(attachmentEntries)
Expand Down

0 comments on commit dfdcfa3

Please sign in to comment.