fix for retention logic
This commit is contained in:
parent
70c0ba44f0
commit
e6bfe2d444
35 changed files with 2108 additions and 132 deletions
|
|
@ -159,6 +159,26 @@ func classifyDocumentCategory(doc *Document) (MediaCategory, bool) {
|
|||
}
|
||||
}
|
||||
|
||||
// DocumentMediaCategory returns the single document-attribute category
|
||||
// (Video/Gif/Music/Voice/RoundVideo/File) for a document media payload, used
|
||||
// to populate the documents.category column alongside the shared media
|
||||
// index. Unlike ClassifyMediaCategories (which can also add unrelated
|
||||
// categories such as URL from message entities), this only ever answers "what
|
||||
// kind of document is this", returning MediaCategoryNone for a non-document
|
||||
// payload or for sticker/custom-emoji documents (they classify to nothing --
|
||||
// see classifyDocumentCategory). Zero new classification logic: reuses
|
||||
// classifyDocumentCategory exactly.
|
||||
func DocumentMediaCategory(media *MessageMedia) MediaCategory {
|
||||
if media == nil || media.Kind != MessageMediaKindDocument {
|
||||
return MediaCategoryNone
|
||||
}
|
||||
c, ok := classifyDocumentCategory(media.Document)
|
||||
if !ok {
|
||||
return MediaCategoryNone
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
func hasURLEntity(entities []MessageEntity) bool {
|
||||
for _, e := range entities {
|
||||
if e.Type == MessageEntityURL || e.Type == MessageEntityTextURL || e.Type == MessageEntityEmail {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue