mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 02:03:40 -05:00
hicli/sync: ignore failing to recalculate preview
This commit is contained in:
parent
4262b5abfa
commit
696687f60c
2 changed files with 8 additions and 4 deletions
|
@ -132,6 +132,9 @@ func (rq *RoomQuery) UpdatePreviewIfLaterOnTimeline(ctx context.Context, roomID
|
|||
|
||||
func (rq *RoomQuery) RecalculatePreview(ctx context.Context, roomID id.RoomID) (rowID EventRowID, err error) {
|
||||
err = rq.GetDB().QueryRow(ctx, recalculateRoomPreviewEventQuery, roomID).Scan(&rowID)
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
err = nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -969,12 +969,13 @@ func (h *HiClient) processStateAndTimeline(
|
|||
updatedRoom.PreviewEventRowID, err = h.DB.Room.RecalculatePreview(ctx, room.ID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to recalculate preview event: %w", err)
|
||||
}
|
||||
} else if updatedRoom.PreviewEventRowID != 0 {
|
||||
_, err = addOldEvent(updatedRoom.PreviewEventRowID, "")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get preview event: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
// Calculate name from participants if participants changed and current name was generated from participants, or if the room name was unset
|
||||
if (heroesChanged && updatedRoom.NameQuality <= database.NameQualityParticipants) || updatedRoom.NameQuality == database.NameQualityNil {
|
||||
name, dmAvatarURL, dmUserID, err := h.calculateRoomParticipantName(ctx, room.ID, summary)
|
||||
|
|
Loading…
Add table
Reference in a new issue