fix repository bugs and make text searching work more like it did in the past.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
+16
-2
@@ -74,9 +74,23 @@ func (s *CharacterService) List(ctx context.Context, filter models.CharacterFilt
|
||||
return characters, nil
|
||||
}
|
||||
|
||||
go s.refreshLogs()
|
||||
characters, err := s.characters.List(ctx, filter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return s.characters.List(ctx, filter)
|
||||
sort.Slice(characters, func(i, j int) bool {
|
||||
if len(characters[i].ID) > len(characters[j].ID) {
|
||||
return false
|
||||
}
|
||||
if len(characters[i].ID) < len(characters[j].ID) {
|
||||
return true
|
||||
}
|
||||
|
||||
return strings.Compare(characters[i].ID, characters[j].ID) < 0
|
||||
})
|
||||
|
||||
return characters, nil
|
||||
}
|
||||
|
||||
func (s *CharacterService) Create(ctx context.Context, nick, name, shortName, author, description string) (*models.Character, error) {
|
||||
|
||||
+9
-1
@@ -718,11 +718,19 @@ func (s *LogService) RefreshAllLogCharacters(ctx context.Context) error {
|
||||
}
|
||||
s.unknownNicksMutex.Unlock()
|
||||
|
||||
tokens := make(chan struct{}, 33)
|
||||
for i := 0; i < 32; i++ {
|
||||
tokens <- struct{}{}
|
||||
}
|
||||
|
||||
eg := errgroup.Group{}
|
||||
for i := range logs {
|
||||
l := logs[i]
|
||||
|
||||
eg.Go(func() error {
|
||||
<-tokens
|
||||
defer func() { tokens <- struct{}{} }()
|
||||
|
||||
_, err := s.refreshLogCharacters(ctx, *l, characterMap, true)
|
||||
return err
|
||||
})
|
||||
@@ -748,7 +756,7 @@ func (s *LogService) RefreshLogCharacters(ctx context.Context, log models.Log) (
|
||||
func (s *LogService) refreshLogCharacters(ctx context.Context, log models.Log, characterMap map[string]*models.Character, useUnknownNicks bool) (*models.Log, error) {
|
||||
posts, err := s.ListPosts(ctx, &models.PostFilter{LogID: &log.ShortID})
|
||||
if err != nil {
|
||||
return &log, nil
|
||||
return nil, err
|
||||
}
|
||||
|
||||
counts := make(map[string]int)
|
||||
|
||||
@@ -29,11 +29,13 @@ func NewBundle(db database.Database, spaceClient *space.Client) *Bundle {
|
||||
changes: db.Changes(),
|
||||
authService: bundle.Auth,
|
||||
}
|
||||
bundle.Files = &FileService{
|
||||
files: db.Files(),
|
||||
authService: bundle.Auth,
|
||||
changeService: bundle.Changes,
|
||||
space: spaceClient,
|
||||
if spaceClient != nil {
|
||||
bundle.Files = &FileService{
|
||||
files: db.Files(),
|
||||
authService: bundle.Auth,
|
||||
changeService: bundle.Changes,
|
||||
space: spaceClient,
|
||||
}
|
||||
}
|
||||
bundle.Tags = &TagService{tags: db.Tags()}
|
||||
bundle.Characters = &CharacterService{
|
||||
|
||||
@@ -46,6 +46,9 @@ func (s *StoryService) ListStories(ctx context.Context, filter models.StoryFilte
|
||||
return nil, errors.New("you cannot view your own unlisted stories")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unlistedValue := false
|
||||
filter.Unlisted = &unlistedValue
|
||||
}
|
||||
|
||||
return s.stories.List(ctx, filter)
|
||||
|
||||
Reference in New Issue
Block a user