Revert "Removed the opengraph type dependency for plugins by stripping post Metadata (#20612)" (#20684)
This reverts commit da7a8a4552.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6376f7ff55
Коммит
32dee6d449
@@ -736,10 +736,18 @@ func (o *Post) ToNilIfInvalid() *Post {
|
||||
return o
|
||||
}
|
||||
|
||||
func (o *Post) ForPlugin() *Post {
|
||||
p := o.Clone()
|
||||
p.Metadata = nil
|
||||
return p
|
||||
func (o *Post) RemovePreviewPost() {
|
||||
if o.Metadata == nil || o.Metadata.Embeds == nil {
|
||||
return
|
||||
}
|
||||
n := 0
|
||||
for _, embed := range o.Metadata.Embeds {
|
||||
if embed.Type != PostEmbedPermalink {
|
||||
o.Metadata.Embeds[n] = embed
|
||||
n++
|
||||
}
|
||||
}
|
||||
o.Metadata.Embeds = o.Metadata.Embeds[:n]
|
||||
}
|
||||
|
||||
func (o *Post) GetPreviewPost() *PreviewPost {
|
||||
|
||||
Ссылка в новой задаче
Block a user