mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
Merge pull request #1095 from PR0M3TH3AN/fix/watch-history-reliability-8303262170109715615
Migrate Watch History to Kind 30003
This commit is contained in:
4 files changed
+17
-4
No files matched your search
@@ -301,7 +301,8 @@ export const THEME_ACCENT_OVERRIDES = Object.freeze({
|
||||
* example, a NIP-51 collection) can flip this number so long as their relays
|
||||
* accept the chosen kind.
|
||||
*/
|
||||
export const WATCH_HISTORY_KIND = 30078;
|
||||
export const WATCH_HISTORY_KIND = 30003;
|
||||
export const WATCH_HISTORY_LEGACY_KIND = 30078;
|
||||
|
||||
/**
|
||||
* Identifier applied to the watch-history list when storing it on relays.
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
DEFAULT_TRUSTED_MUTE_HIDE_THRESHOLD,
|
||||
DEFAULT_TRUSTED_SPAM_HIDE_THRESHOLD,
|
||||
WATCH_HISTORY_KIND,
|
||||
WATCH_HISTORY_LEGACY_KIND,
|
||||
WATCH_HISTORY_LIST_IDENTIFIER,
|
||||
WATCH_HISTORY_LEGACY_LIST_IDENTIFIERS,
|
||||
WATCH_HISTORY_MAX_ITEMS,
|
||||
@@ -118,6 +119,7 @@ export { ADMIN_WHITELIST_MODE_STORAGE_KEY };
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
export { WATCH_HISTORY_KIND };
|
||||
export { WATCH_HISTORY_LEGACY_KIND };
|
||||
export { WATCH_HISTORY_LIST_IDENTIFIER };
|
||||
export { WATCH_HISTORY_LEGACY_LIST_IDENTIFIERS };
|
||||
export { WATCH_HISTORY_MAX_ITEMS };
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
WATCH_HISTORY_KIND,
|
||||
WATCH_HISTORY_LEGACY_KIND,
|
||||
WATCH_HISTORY_LIST_IDENTIFIER,
|
||||
WATCH_HISTORY_LEGACY_LIST_IDENTIFIERS,
|
||||
WATCH_HISTORY_MAX_ITEMS,
|
||||
@@ -1883,9 +1884,17 @@ class WatchHistoryManager {
|
||||
}
|
||||
let pointerEvents = [];
|
||||
try {
|
||||
const kinds = [WATCH_HISTORY_KIND];
|
||||
if (
|
||||
Number.isFinite(WATCH_HISTORY_LEGACY_KIND) &&
|
||||
WATCH_HISTORY_LEGACY_KIND > 0 &&
|
||||
WATCH_HISTORY_LEGACY_KIND !== WATCH_HISTORY_KIND
|
||||
) {
|
||||
kinds.push(WATCH_HISTORY_LEGACY_KIND);
|
||||
}
|
||||
const filters = [
|
||||
{
|
||||
kinds: [WATCH_HISTORY_KIND],
|
||||
kinds,
|
||||
authors: [actorKey],
|
||||
// Fetch all parameterized replaceables of this kind to get history across all months
|
||||
limit,
|
||||
|
||||
@@ -11,6 +11,7 @@ const {
|
||||
WATCH_HISTORY_BATCH_PAGE_SIZE,
|
||||
WATCH_HISTORY_LIST_IDENTIFIER,
|
||||
WATCH_HISTORY_KIND,
|
||||
WATCH_HISTORY_LEGACY_KIND,
|
||||
} =
|
||||
await import("../js/config.js");
|
||||
const {
|
||||
@@ -2524,7 +2525,7 @@ async function testWatchHistoryFeedHydration() {
|
||||
poolHarness.reset();
|
||||
watchHistoryService.resetProgress();
|
||||
|
||||
const actor = "feed-hydration-actor";
|
||||
const actor = "f".repeat(64);
|
||||
const videoId = "hydration-video-id";
|
||||
const videoTitle = "Hydrated Video Title";
|
||||
const videoEvent = {
|
||||
@@ -2563,7 +2564,7 @@ async function testWatchHistoryFeedHydration() {
|
||||
results.push(videoEvent);
|
||||
}
|
||||
|
||||
if (filter.kinds && filter.kinds.includes(WATCH_HISTORY_KIND)) {
|
||||
if (filter.kinds && (filter.kinds.includes(WATCH_HISTORY_KIND) || filter.kinds.includes(WATCH_HISTORY_LEGACY_KIND))) {
|
||||
results.push({
|
||||
id: "history-event-id",
|
||||
kind: WATCH_HISTORY_KIND,
|
||||
|
||||
Reference in new issue
Block a user