Compare commits

...
4 Commits
Author SHA1 Message Date
gisle a606b79736 fix prev logs showing current log.
continuous-integration/drone/push Build is passing
2021-04-11 02:14:01 +02:00
gisle 87559997a9 fix comments create/update not applying character name.
continuous-integration/drone/push Build is passing
2021-04-11 01:49:08 +02:00
gisle b641f7d516 fix ts query getting mad at you for quoting a single word. 2021-04-02 20:25:32 +02:00
gisle b117aea7f0 fix ChannelFilter.Logged being ignored in postgres driver.
continuous-integration/drone/push Build is passing
2021-04-02 17:01:15 +02:00
8 changed files with 38 additions and 9 deletions
+14
View File
@@ -10,6 +10,20 @@ steps:
- go generate ./...
- go test -v ./...
# - name: postgres-migrate
# image: golang:1.15
# depends_on: []
# environment:
# DB_CONNECT:
# from_secret: db_connect
# commands:
# - go get -u github.com/pressly/goose/...
# - cd migrations/postgres
# - goose postgres "$DB_CONNECT" up
# when:
# event:
# - tag
- name: docker-release-tag
image: plugins/docker
settings:
+4
View File
@@ -38,6 +38,10 @@ func (r *channelRepository) List(ctx context.Context, filter models.ChannelFilte
params.FilterEventName = true
params.EventName = *filter.EventName
}
if filter.Logged != nil {
params.FilterLogged = true
params.Logged = *filter.Logged
}
if filter.Limit > 0 {
params.LimitSize = int32(filter.Limit)
}
+3 -2
View File
@@ -53,7 +53,7 @@ func (r *commentRepository) Insert(ctx context.Context, comment models.Comment)
CharacterID: comment.CharacterID,
Subject: comment.Subject,
Author: comment.Author,
CharacterName: comment.CharacterID,
CharacterName: comment.CharacterName,
Source: comment.Source,
CreatedDate: comment.CreatedDate.UTC(),
FictionalDate: comment.FictionalDate.UTC(),
@@ -73,7 +73,8 @@ func (r *commentRepository) Update(ctx context.Context, comment models.Comment,
Subject: comment.Subject,
Source: comment.Source,
FictionalDate: comment.FictionalDate.UTC(),
CharacterName: comment.ChapterID,
EditedDate: comment.EditedDate.UTC(),
CharacterName: comment.CharacterName,
CharacterID: comment.CharacterID,
ID: comment.ID,
})
+1
View File
@@ -14,6 +14,7 @@ UPDATE story_comment
SET subject = @subject,
source = @source,
fictional_date = @fictional_date,
edited_date = @edited_date,
character_name = @character_name,
character_id = @character_id
WHERE id = @id;
+5 -6
View File
@@ -16,18 +16,17 @@ func TSQueryFromSearch(search string) string {
clearQuotes := false
startQuotes := false
if strings.HasPrefix(token, "\"") {
if len(token) > 1 {
token = token[1:]
}
if strings.HasPrefix(token, "\"") && len(token) > 1 {
startQuotes = true
}
if strings.HasSuffix(token, "\"") {
token = token[:len(token)-1]
startQuotes = false
if !startQuotes {
clearQuotes = true
}
startQuotes = false
}
token := strings.Trim(token, ",.;:()\"")
if len(token) > 0 {
if startQuotes {
+1
View File
@@ -13,6 +13,7 @@ func TestTSQueryFromSearch(t *testing.T) {
{`"asari matron" blue`, `(asari<->matron) & blue`},
{`"christmas present" "wrapping paper"`, `(christmas<->present) & (wrapping<->paper)`},
{`stuff`, `stuff`},
{`"stuff"`, `stuff`},
{`"her slowly, rubbing the back of his head awkwardly. "`, `(her<->slowly<->rubbing<->the<->back<->of<->his<->head<->awkwardly)`},
}
+1
View File
@@ -32,6 +32,7 @@ func (comment *Comment) ApplyUpdate(update CommentUpdate) {
if update.FictionalDate != nil {
comment.FictionalDate = *update.FictionalDate
}
comment.EditedDate = time.Now()
}
// IsChangeObject is an interface implementation to identify it as a valid
+8
View File
@@ -857,6 +857,10 @@ func (s *LogService) NextLogs(ctx context.Context, log *models.Log) ([]*models.L
return logs[i].Date.Before(logs[j].Date)
})
if len(logs) >= 1 && logs[0].ID == log.ID {
logs = logs[1:]
}
return s.findSuggestions(ctx, log, logs)
}
@@ -868,6 +872,10 @@ func (s *LogService) PrevLogs(ctx context.Context, log *models.Log) ([]*models.L
return nil, err
}
if len(logs) >= 1 && logs[0].ID == log.ID {
logs = logs[1:]
}
return s.findSuggestions(ctx, log, logs)
}