mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Migration: drop to long repo topics (#14152)
This commit is contained in:
		@@ -154,6 +154,15 @@ func (g *GiteaLocalUploader) Close() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// CreateTopics creates topics
 | 
					// CreateTopics creates topics
 | 
				
			||||||
func (g *GiteaLocalUploader) CreateTopics(topics ...string) error {
 | 
					func (g *GiteaLocalUploader) CreateTopics(topics ...string) error {
 | 
				
			||||||
 | 
						// ignore topics to long for the db
 | 
				
			||||||
 | 
						c := 0
 | 
				
			||||||
 | 
						for i := range topics {
 | 
				
			||||||
 | 
							if len(topics[i]) <= 50 {
 | 
				
			||||||
 | 
								topics[c] = topics[i]
 | 
				
			||||||
 | 
								c++
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						topics = topics[:c]
 | 
				
			||||||
	return models.SaveTopics(g.repo.ID, topics...)
 | 
						return models.SaveTopics(g.repo.ID, topics...)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user