nodebb-plugin-link-preview 2.0.10 → 2.0.12

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/library.js CHANGED
@@ -14,6 +14,7 @@ const { isURL } = require('validator');
14
14
  const meta = require.main.require('./src/meta');
15
15
  const cache = require.main.require('./src/cache');
16
16
  const posts = require.main.require('./src/posts');
17
+ const postsCache = require.main.require('./src/posts/cache');
17
18
  const websockets = require.main.require('./src/socket.io');
18
19
 
19
20
  const controllers = require('./lib/controllers');
@@ -201,7 +202,9 @@ async function process(content, { type, pid, tid, attachments }) {
201
202
 
202
203
  // bust posts cache item
203
204
  if (pid) {
204
- posts.clearCachedPost(pid);
205
+ const cache = postsCache.getOrCreate();
206
+ const cacheKey = `${String(pid)}|default`;
207
+ cache.set(cacheKey, content);
205
208
 
206
209
  // fire post edit event with mocked data
207
210
  if (tid) {
@@ -311,7 +314,7 @@ plugin.onParse = async (payload) => {
311
314
  };
312
315
 
313
316
  plugin.onPost = async ({ post }) => {
314
- if (post._activitypub) {
317
+ if (post.hasOwnProperty('_activitypub')) {
315
318
  return; // no attachment parsing for content from activitypub; attachments saved via notes.assert
316
319
  }
317
320
 
package/package-lock.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "nodebb-plugin-link-preview",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "nodebb-plugin-link-preview",
9
- "version": "2.0.10",
9
+ "version": "2.0.12",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "cheerio": "^1.0.0-rc.12",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-link-preview",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "description": "A starter kit for quickly creating NodeBB plugins",
5
5
  "main": "library.js",
6
6
  "repository": {