From 1c6a2bcff46f3982c2ac853ce0326645ca07f16f Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Mon, 14 Sep 2020 23:40:02 -0700 Subject: [PATCH] Fix tag id issues --- DB/Sources/DB/Content/ContentDatabase.swift | 3 ++- DB/Sources/DB/Extensions/Timeline+Extensions.swift | 5 ++++- Mastodon/Sources/Mastodon/Entities/Timeline.swift | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/DB/Sources/DB/Content/ContentDatabase.swift b/DB/Sources/DB/Content/ContentDatabase.swift index f8667de..e794976 100644 --- a/DB/Sources/DB/Content/ContentDatabase.swift +++ b/DB/Sources/DB/Content/ContentDatabase.swift @@ -88,7 +88,8 @@ public extension ContentDatabase { } try Timeline - .filter(!(Timeline.authenticatedDefaults.map(\.id) + lists.map(\.id)).contains(Column("id"))) + .filter(!(Timeline.authenticatedDefaults.map(\.id) + lists.map(\.id)).contains(Column("id")) + && Column("listTitle") != nil) .deleteAll($0) } .ignoreOutput() diff --git a/DB/Sources/DB/Extensions/Timeline+Extensions.swift b/DB/Sources/DB/Extensions/Timeline+Extensions.swift index dab38ca..9d380ed 100644 --- a/DB/Sources/DB/Extensions/Timeline+Extensions.swift +++ b/DB/Sources/DB/Extensions/Timeline+Extensions.swift @@ -20,7 +20,10 @@ extension Timeline: FetchableRecord, PersistableRecord { case (let id, .some(let title)): self = .list(MastodonList(id: id, title: title)) default: - self = .tag(row[Columns.id]) + var tag: String = row[Columns.id] + + tag.removeFirst() + self = .tag(tag) } } diff --git a/Mastodon/Sources/Mastodon/Entities/Timeline.swift b/Mastodon/Sources/Mastodon/Entities/Timeline.swift index f045f90..bcbadbc 100644 --- a/Mastodon/Sources/Mastodon/Entities/Timeline.swift +++ b/Mastodon/Sources/Mastodon/Entities/Timeline.swift @@ -27,7 +27,7 @@ extension Timeline: Identifiable { case let .list(list): return list.id case let .tag(tag): - return "#" + tag + return "#".appending(tag).lowercased() } } }