🐛 Remove related event foreign key to prevent issue when linking to a deleted event
This commit is contained in:
parent
7a33018e44
commit
a78fff8897
@ -21,9 +21,7 @@ type Event struct {
|
||||
Channel Channel `json:"channel"`
|
||||
Sender ChannelMember `json:"sender"`
|
||||
QuoteEventID *uint `json:"quote_event_id,omitempty"`
|
||||
QuoteEvent *Event `json:"quote_event,omitempty" gorm:"foreignKey:QuoteEventID"`
|
||||
RelatedEventID *uint `json:"related_event_id,omitempty"`
|
||||
RelatedEvent *Event `json:"related_event,omitempty" gorm:"foreignKey:RelatedEventID"`
|
||||
ChannelID uint `json:"channel_id"`
|
||||
SenderID uint `json:"sender_id"`
|
||||
}
|
||||
|
@ -38,7 +38,8 @@ func EditMessage(event models.Event, body models.EventMessageBody) (models.Event
|
||||
}
|
||||
|
||||
func DeleteMessage(event models.Event) (models.Event, error) {
|
||||
_, err := DeleteEvent(event)
|
||||
clonedEvent := event
|
||||
_, err := DeleteEvent(clonedEvent)
|
||||
if err != nil {
|
||||
return event, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user