feeds-fun 1.23.1 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -41,6 +41,11 @@
|
|
|
41
41
|
|
|
42
42
|
return properties.entries.every((entryId) => {
|
|
43
43
|
const entry = entriesStore.entries[entryId];
|
|
44
|
+
if (entry.publishedAt === null) {
|
|
45
|
+
// we do not expect publishedAt to be null here
|
|
46
|
+
// but just in case we treat such entries as old ones
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
44
49
|
return entry.publishedAt.getTime() < Date.now() - properties.period.seconds * 1000;
|
|
45
50
|
});
|
|
46
51
|
});
|
package/src/logic/enums.ts
CHANGED
|
@@ -99,8 +99,7 @@ export enum EntriesOrder {
|
|
|
99
99
|
Score = "score",
|
|
100
100
|
ScoreToZero = "score-to-zero",
|
|
101
101
|
ScoreBackward = "score-backward",
|
|
102
|
-
Published = "published"
|
|
103
|
-
Cataloged = "cataloged"
|
|
102
|
+
Published = "published"
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
export type EntriesOrderProperty = {
|
|
@@ -112,11 +111,10 @@ export type EntriesOrderProperty = {
|
|
|
112
111
|
};
|
|
113
112
|
|
|
114
113
|
export const EntriesOrderProperties = new Map<EntriesOrder, EntriesOrderProperty>([
|
|
115
|
-
[EntriesOrder.Score, {text: "score", orderField: "score", timeField: "
|
|
116
|
-
[EntriesOrder.ScoreToZero, {text: "score ~ 0", orderField: "scoreToZero", timeField: "
|
|
117
|
-
[EntriesOrder.ScoreBackward, {text: "score backward", orderField: "score", timeField: "
|
|
118
|
-
[EntriesOrder.Published, {text: "published", orderField: "publishedAt", timeField: "publishedAt", direction: 1}]
|
|
119
|
-
[EntriesOrder.Cataloged, {text: "cataloged", orderField: "catalogedAt", timeField: "catalogedAt", direction: 1}]
|
|
114
|
+
[EntriesOrder.Score, {text: "score", orderField: "score", timeField: "publishedAt", direction: 1, default: true}],
|
|
115
|
+
[EntriesOrder.ScoreToZero, {text: "score ~ 0", orderField: "scoreToZero", timeField: "publishedAt", direction: 1}],
|
|
116
|
+
[EntriesOrder.ScoreBackward, {text: "score backward", orderField: "score", timeField: "publishedAt", direction: -1}],
|
|
117
|
+
[EntriesOrder.Published, {text: "published", orderField: "publishedAt", timeField: "publishedAt", direction: 1}]
|
|
120
118
|
]);
|
|
121
119
|
|
|
122
120
|
/////////////////////
|
package/src/logic/types.ts
CHANGED
|
@@ -129,8 +129,7 @@ export class Entry {
|
|
|
129
129
|
readonly score: number;
|
|
130
130
|
readonly scoreContributions: {[key: string]: number};
|
|
131
131
|
readonly scoreToZero: number;
|
|
132
|
-
|
|
133
|
-
readonly catalogedAt: Date;
|
|
132
|
+
publishedAt: Date | null;
|
|
134
133
|
body: string | null;
|
|
135
134
|
|
|
136
135
|
constructor({
|
|
@@ -143,7 +142,6 @@ export class Entry {
|
|
|
143
142
|
score,
|
|
144
143
|
scoreContributions,
|
|
145
144
|
publishedAt,
|
|
146
|
-
catalogedAt,
|
|
147
145
|
body
|
|
148
146
|
}: {
|
|
149
147
|
id: EntryId;
|
|
@@ -154,8 +152,7 @@ export class Entry {
|
|
|
154
152
|
markers: e.Marker[];
|
|
155
153
|
score: number;
|
|
156
154
|
scoreContributions: {[key: string]: number};
|
|
157
|
-
publishedAt: Date;
|
|
158
|
-
catalogedAt: Date;
|
|
155
|
+
publishedAt: Date | null;
|
|
159
156
|
body: string | null;
|
|
160
157
|
}) {
|
|
161
158
|
this.id = id;
|
|
@@ -167,7 +164,6 @@ export class Entry {
|
|
|
167
164
|
this.score = score;
|
|
168
165
|
this.scoreContributions = scoreContributions;
|
|
169
166
|
this.publishedAt = publishedAt;
|
|
170
|
-
this.catalogedAt = catalogedAt;
|
|
171
167
|
this.body = body;
|
|
172
168
|
|
|
173
169
|
this.scoreToZero = -Math.abs(score);
|
|
@@ -204,8 +200,7 @@ export function entryFromJSON(
|
|
|
204
200
|
markers: string[];
|
|
205
201
|
score: number;
|
|
206
202
|
scoreContributions: {[key: number]: number};
|
|
207
|
-
publishedAt: string;
|
|
208
|
-
catalogedAt: string;
|
|
203
|
+
publishedAt: string | null;
|
|
209
204
|
body: string | null;
|
|
210
205
|
},
|
|
211
206
|
tagsMapping: {[key: number]: string}
|
|
@@ -232,8 +227,7 @@ export function entryFromJSON(
|
|
|
232
227
|
score: rawEntry.score,
|
|
233
228
|
// map keys from int to string
|
|
234
229
|
scoreContributions: contributions,
|
|
235
|
-
publishedAt: new Date(rawEntry.publishedAt),
|
|
236
|
-
catalogedAt: new Date(rawEntry.catalogedAt),
|
|
230
|
+
publishedAt: rawEntry.publishedAt !== null ? new Date(rawEntry.publishedAt) : null,
|
|
237
231
|
|
|
238
232
|
body: rawEntry.body
|
|
239
233
|
});
|
package/src/stores/entries.ts
CHANGED
|
@@ -96,6 +96,10 @@ export const useEntriesStore = defineStore("entriesStore", () => {
|
|
|
96
96
|
entry.body = existingEntry.body;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
if (entry.publishedAt === null && existingEntry.publishedAt !== null) {
|
|
100
|
+
entry.publishedAt = existingEntry.publishedAt;
|
|
101
|
+
}
|
|
102
|
+
|
|
99
103
|
if (!updateTags) {
|
|
100
104
|
entry.tags = _.cloneDeep(existingEntry.tags);
|
|
101
105
|
}
|