mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-30 05:46:15 -06:00
slight formatting tweak
This commit is contained in:
parent
534792467d
commit
148bc121cc
2 changed files with 10 additions and 24 deletions
|
|
@ -1211,11 +1211,18 @@ func (d *Dereferencer) handleStatusEdit(
|
|||
edit.Text = existing.Text
|
||||
edit.Language = existing.Language
|
||||
edit.Sensitive = existing.Sensitive
|
||||
edit.AttachmentIDs = existing.AttachmentIDs
|
||||
edit.AttachmentDescriptions = getAttachmentDescriptions(existing.Attachments)
|
||||
edit.Attachments = existing.Attachments
|
||||
edit.StatusID = status.ID
|
||||
|
||||
// Copy existing attachments and descriptions.
|
||||
edit.AttachmentIDs = existing.AttachmentIDs
|
||||
edit.Attachments = existing.Attachments
|
||||
if l := len(existing.Attachments); l > 0 {
|
||||
edit.AttachmentDescriptions = make([]string, l)
|
||||
for i, attach := range existing.Attachments {
|
||||
edit.AttachmentDescriptions[i] = attach.Description
|
||||
}
|
||||
}
|
||||
|
||||
// Edit creation is last update time.
|
||||
edit.CreatedAt = existing.UpdatedAt
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import (
|
|||
"slices"
|
||||
|
||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/util/xslices"
|
||||
)
|
||||
|
||||
// getEmojiByShortcodeDomain searches input slice
|
||||
|
|
@ -71,23 +70,3 @@ func pollStateUpdated(existing, latest *gtsmodel.Poll) bool {
|
|||
func pollJustClosed(existing, latest *gtsmodel.Poll) bool {
|
||||
return existing.ClosedAt.IsZero() && latest.Closed()
|
||||
}
|
||||
|
||||
// statusChanged returns whether a status has changed in a way that
|
||||
// indicates that existing should be snapshotted for version history.
|
||||
func statusChanged(existing, latest *gtsmodel.Status) bool {
|
||||
return existing.Content != latest.Content ||
|
||||
existing.ContentWarning != latest.ContentWarning ||
|
||||
!slices.Equal(existing.AttachmentIDs, latest.AttachmentIDs)
|
||||
}
|
||||
|
||||
// getAttachmentDescriptions returns a slice of the media attachment descriptions of input slice.
|
||||
func getAttachmentDescriptions(attachments []*gtsmodel.MediaAttachment) []string {
|
||||
if len(attachments) == 0 {
|
||||
return nil
|
||||
}
|
||||
return xslices.Gather(
|
||||
nil,
|
||||
attachments,
|
||||
func(a *gtsmodel.MediaAttachment) string { return a.Description },
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue