mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-03-10 15:48:52 +01:00
[bugfix] fix refreshed additional media info being ignored (#3867)
* fix refreshed additional media info being ignored when force flag already set * also update to always iterate through all additional info fields * make similar changes for emoji, even if not necessary, just to keep in-sync
This commit is contained in:
parent
1b37944f8b
commit
24da574684
2 changed files with 29 additions and 22 deletions
|
@ -134,19 +134,23 @@ func (d *Dereferencer) RefreshEmoji(
|
||||||
*gtsmodel.Emoji,
|
*gtsmodel.Emoji,
|
||||||
error,
|
error,
|
||||||
) {
|
) {
|
||||||
// Check emoji is up-to-date
|
// Check uri up-to-date.
|
||||||
// with provided extra info.
|
if info.URI != nil &&
|
||||||
switch {
|
*info.URI != emoji.URI {
|
||||||
case info.URI != nil &&
|
|
||||||
*info.URI != emoji.URI:
|
|
||||||
emoji.URI = *info.URI
|
emoji.URI = *info.URI
|
||||||
force = true
|
force = true
|
||||||
case info.ImageRemoteURL != nil &&
|
}
|
||||||
*info.ImageRemoteURL != emoji.ImageRemoteURL:
|
|
||||||
|
// Check image remote URL up-to-date.
|
||||||
|
if info.ImageRemoteURL != nil &&
|
||||||
|
*info.ImageRemoteURL != emoji.ImageRemoteURL {
|
||||||
emoji.ImageRemoteURL = *info.ImageRemoteURL
|
emoji.ImageRemoteURL = *info.ImageRemoteURL
|
||||||
force = true
|
force = true
|
||||||
case info.ImageStaticRemoteURL != nil &&
|
}
|
||||||
*info.ImageStaticRemoteURL != emoji.ImageStaticRemoteURL:
|
|
||||||
|
// Check image static remote URL up-to-date.
|
||||||
|
if info.ImageStaticRemoteURL != nil &&
|
||||||
|
*info.ImageStaticRemoteURL != emoji.ImageStaticRemoteURL {
|
||||||
emoji.ImageStaticRemoteURL = *info.ImageStaticRemoteURL
|
emoji.ImageStaticRemoteURL = *info.ImageStaticRemoteURL
|
||||||
force = true
|
force = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,20 +125,23 @@ func (d *Dereferencer) RefreshMedia(
|
||||||
return attach, nil
|
return attach, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check emoji is up-to-date
|
// Check blurhash up-to-date.
|
||||||
// with provided extra info.
|
if info.Blurhash != nil &&
|
||||||
switch {
|
*info.Blurhash != attach.Blurhash {
|
||||||
case force:
|
|
||||||
case info.Blurhash != nil &&
|
|
||||||
*info.Blurhash != attach.Blurhash:
|
|
||||||
attach.Blurhash = *info.Blurhash
|
attach.Blurhash = *info.Blurhash
|
||||||
force = true
|
force = true
|
||||||
case info.Description != nil &&
|
}
|
||||||
*info.Description != attach.Description:
|
|
||||||
|
// Check description up-to-date.
|
||||||
|
if info.Description != nil &&
|
||||||
|
*info.Description != attach.Description {
|
||||||
attach.Description = *info.Description
|
attach.Description = *info.Description
|
||||||
force = true
|
force = true
|
||||||
case info.RemoteURL != nil &&
|
}
|
||||||
*info.RemoteURL != attach.RemoteURL:
|
|
||||||
|
// Check remote URL up-to-date.
|
||||||
|
if info.RemoteURL != nil &&
|
||||||
|
*info.RemoteURL != attach.RemoteURL {
|
||||||
attach.RemoteURL = *info.RemoteURL
|
attach.RemoteURL = *info.RemoteURL
|
||||||
force = true
|
force = true
|
||||||
}
|
}
|
||||||
|
@ -214,10 +217,10 @@ func (d *Dereferencer) updateAttachment(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// processingEmojiSafely provides concurrency-safe processing of
|
// processingMediaSafely provides concurrency-safe processing of
|
||||||
// an emoji with given shortcode+domain. if a copy of the emoji is
|
// a media with given remote URL string. if a copy of the media is
|
||||||
// not already being processed, the given 'process' callback will
|
// not already being processed, the given 'process' callback will
|
||||||
// be used to generate new *media.ProcessingEmoji{} instance.
|
// be used to generate new *media.ProcessingMedia{} instance.
|
||||||
func (d *Dereferencer) processMediaSafeley(
|
func (d *Dereferencer) processMediaSafeley(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
remoteURL string,
|
remoteURL string,
|
||||||
|
|
Loading…
Reference in a new issue