Merge pull request #50 from pushbits/#49-empty-notification

#49 Fix empty notifications
This commit is contained in:
Raphael Eikenberg 2022-04-09 16:15:10 +02:00 committed by GitHub
commit 6d6c19de30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -37,7 +37,7 @@ setup:
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
go install github.com/securego/gosec/v2/cmd/gosec@latest
go install github.com/swaggo/swag/cmd/swag@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install honnef.co/go/tools/cmd/staticcheck@v0.2.2
poetry install
.PHONY: swag

View file

@ -31,9 +31,9 @@ type MessageEvent struct {
Body string `json:"body"`
FormattedBody string `json:"formatted_body"`
MsgType MsgType `json:"msgtype"`
RelatesTo RelatesTo `json:"m.relates_to,omitempty"`
RelatesTo *RelatesTo `json:"m.relates_to,omitempty"`
Format MessageFormat `json:"format"`
NewContent NewContent `json:"m.new_content,omitempty"`
NewContent *NewContent `json:"m.new_content,omitempty"`
}
// RelatesTo holds information about relations to other message events
@ -212,8 +212,8 @@ func (d *Dispatcher) replaceMessage(a *model.Application, newBody, newFormattedB
Body: oldBody,
FormattedBody: oldFormattedBody,
MsgType: MsgTypeText,
NewContent: newMessage,
RelatesTo: replaceRelation,
NewContent: &newMessage,
RelatesTo: &replaceRelation,
Format: MessageFormatHTML,
}
@ -252,7 +252,7 @@ func (d *Dispatcher) respondToMessage(a *model.Application, body, formattedBody
notificationRelation := RelatesTo{
InReplyTo: notificationReply,
}
notificationEvent.RelatesTo = notificationRelation
notificationEvent.RelatesTo = &notificationRelation
return d.mautrixClient.SendMessageEvent(mId.RoomID(a.MatrixID), event.EventMessage, &notificationEvent)
}