@quadient/skillshare 1.13.0 → 1.13.1
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/README.md +2 -1
- package/dist/pages-comments.js +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -359,7 +359,8 @@ skillshare pages comments delete my-app 12
|
|
|
359
359
|
```
|
|
360
360
|
|
|
361
361
|
`--author` accepts `mine` or a user id and keeps threads that person started or
|
|
362
|
-
replied to.
|
|
362
|
+
replied to. Each thread is listed with a link that opens the Page on `/pa/` with that
|
|
363
|
+
thread selected; the **Copy link** action in the browser panel creates the same link. Text without an argument, or `-`, is read from stdin.
|
|
363
364
|
|
|
364
365
|
## Local Pages development (1.6.0+)
|
|
365
366
|
|
package/dist/pages-comments.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { formatDateTime } from './output.js';
|
|
2
|
+
/** Opens the Page on /pa/ with the panel focused on the thread; the browser script reads the parameter. */
|
|
3
|
+
export function pageCommentLink(baseUrl, slug, comment) {
|
|
4
|
+
return `${baseUrl.replace(/\/+$/, '')}/pa/${encodeURIComponent(slug)}/${comment.path}?skillshare-annotation=${comment.threadId}`;
|
|
5
|
+
}
|
|
2
6
|
const ACTIONS = ['list', 'add', 'reply', 'edit', 'resolve', 'reopen', 'delete', 'enable', 'disable'];
|
|
3
7
|
/** Keeps threads where the author (`mine` or a user id) wrote the first comment or any reply. */
|
|
4
8
|
export function filterPageComments(list, filter) {
|
|
@@ -26,7 +30,7 @@ function quote(comment) {
|
|
|
26
30
|
return null;
|
|
27
31
|
}
|
|
28
32
|
}
|
|
29
|
-
export function renderPageComments(slug, list, comments) {
|
|
33
|
+
export function renderPageComments(slug, list, comments, baseUrl) {
|
|
30
34
|
const header = list.enabled ? [] : [`/p/${slug}/ hides annotations; comment on /pa/${slug}/.`, ''];
|
|
31
35
|
if (comments.length === 0)
|
|
32
36
|
return [...header, `/p/${slug}/ has no matching comments.`].join('\n');
|
|
@@ -43,6 +47,8 @@ export function renderPageComments(slug, list, comments) {
|
|
|
43
47
|
const indent = isThread ? ' ' : ' ';
|
|
44
48
|
const status = isThread ? ` [${comment.kind}${comment.resolved ? `, resolved by ${comment.resolvedByDisplayName}` : ''}]` : '';
|
|
45
49
|
lines.push(`${indent}#${comment.id}${status} ${comment.authorDisplayName} · ${formatDateTime(comment.created)}`);
|
|
50
|
+
if (isThread && baseUrl)
|
|
51
|
+
lines.push(`${indent} ${pageCommentLink(baseUrl, slug, comment)}`);
|
|
46
52
|
const quoted = quote(comment);
|
|
47
53
|
if (quoted)
|
|
48
54
|
lines.push(`${indent} > ${quoted}`);
|
|
@@ -68,7 +74,10 @@ export async function runPageCommentsCommand(client, positionals, flags, print,
|
|
|
68
74
|
const query = flags.path !== undefined ? `?path=${encodeURIComponent(flags.path)}` : '';
|
|
69
75
|
const list = await expectJson(slug, await client.request(base + query, { method: 'GET' }));
|
|
70
76
|
const comments = filterPageComments(list, { path: flags.path, author: flags.author, resolved: flags.resolved === 'true' });
|
|
71
|
-
|
|
77
|
+
const output = client.baseUrl
|
|
78
|
+
? comments.map((comment) => ({ ...comment, link: pageCommentLink(client.baseUrl, slug, comment) }))
|
|
79
|
+
: comments;
|
|
80
|
+
print(output, () => renderPageComments(slug, list, comments, client.baseUrl));
|
|
72
81
|
return;
|
|
73
82
|
}
|
|
74
83
|
if (action === 'enable' || action === 'disable') {
|