             [oc.storage.config :as config]
             [oc.lib.db.common :as db-common]))
 
-(defn read-paginated-entries
+(defn read-paginated-entries-old
  ([conn table-name index-name index-value order start direction limit sort-type relation-table-name allowed-boards
    relation-fields {:keys [count unseen] :or {count false unseen false}}]
- (read-paginated-entries conn table-name index-name index-value order start direction limit sort-type relation-table-name allowed-boards
+ (read-paginated-entries-old conn table-name index-name index-value order start direction limit sort-type relation-table-name allowed-boards
   nil nil relation-fields nil {:count count :unseen false :container-id nil}))
 
  ([conn table-name index-name index-value order start direction limit sort-type relation-table-name allowed-boards
    relation-fields user-id {:keys [count unseen] :or {count false unseen false}}]
-  (read-paginated-entries conn table-name index-name index-value order start direction limit sort-type relation-table-name allowed-boards
+  (read-paginated-entries-old conn table-name index-name index-value order start direction limit sort-type relation-table-name allowed-boards
   nil nil relation-fields user-id {:count count :unseen false :container-id nil}))
 
  ([conn table-name index-name index-value order start direction limit sort-type relation-table-name allowed-boards

         (boolean? unseen)]}
  (let [order-fn (if (= order :desc) r/desc r/asc)
        unseen-cap-ms (- (lib-time/now-ts) (* 1000 60 60 24 config/unseen-cap-days))
        board-uuid-org-uuid-vals (mapv #(vec [true (:uuid %) org-uuid]) allowed-boards)
        has-seen-at? (seq container-last-seen-at)
        container-seen-ms (when has-seen-at?
                            (lib-time/millis container-last-seen-at))]
    (db-common/with-timeout db-common/default-timeout
      (as-> (r/table "interactions") query
        (r/get-all query board-uuid-org-uuid-vals {:index :comment-board-uuid-org-uuid})
        (r/group query :resource-uuid) ;;(r/group query {:index :resource-uuid})
        (r/max query :created-at)
        (r/ungroup query)

        (string? user-id)
        (sequential? relation-fields)
        (every? db-common/s-or-k? relation-fields)]}
  (let [order-fn (if (= order :desc) r/desc r/asc)
        minimum-date-timestamp (f/unparse lib-time/timestamp-format (t/minus (t/now) (t/days config/unread-days-limit)))
        allowed-board-uuids (map :uuid allowed-boards)]
    (db-common/with-timeout db-common/default-timeout
      (as-> (r/table table-name) query
            (r/get-all query index-value {:index index-name})
            ;; Filter out:
            (r/filter query (r/fn [post-row]
              (r/and ;; All records in boards the user has no access
