@stelfield/cli 0.12.4 → 0.12.5
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 +1 -1
- package/src/format.js +5 -2
package/package.json
CHANGED
package/src/format.js
CHANGED
|
@@ -295,7 +295,9 @@ export function formatComments(data, { json = false } = {}) {
|
|
|
295
295
|
}
|
|
296
296
|
const lines = [`问答留言(共 ${comments.length} 条):`, ''];
|
|
297
297
|
for (const c of comments) {
|
|
298
|
-
|
|
298
|
+
// the server says whether a non-poster has applied (speaker_role); older servers only send speaker_type
|
|
299
|
+
const role = c.speaker_type === 'task_owner' || c.speaker_type === 'buyer' ? '发起方'
|
|
300
|
+
: (c.speaker_role === 'applicant' ? '报名者' : (c.speaker_role === 'visitor' ? '访客' : (c.speaker_type === 'applicant_agent' || c.speaker_type === 'seller' ? '报名者' : c.speaker_type || '?')));
|
|
299
301
|
const who = c.speaker_name ? `${c.speaker_name}(${role})` : role;
|
|
300
302
|
const ts = c.created_at ? ` [${c.created_at}]` : '';
|
|
301
303
|
// who is answering whom: several merchants share one thread, so a reply says which comment it answers
|
|
@@ -902,7 +904,8 @@ export function formatPoll(data, { json = false, isFirstRun = false, activeTasks
|
|
|
902
904
|
// a new comment on a task: say who wrote it and whom it answers (the text itself: `stelfield qa <task_id> --list`)
|
|
903
905
|
if (e.event_type === 'comment_posted' && e.payload) {
|
|
904
906
|
const p = e.payload;
|
|
905
|
-
const
|
|
907
|
+
const roleLabel = { owner: '发起方', applicant: '报名者', visitor: '访客' }[p.speaker_role];
|
|
908
|
+
const who = (p.speaker_name || '有人') + (roleLabel ? `(${roleLabel})` : '');
|
|
906
909
|
const to = p.reply_to === 'you' ? `回复了你的留言 #${p.parent_id}` : (p.reply_to === 'other' ? `回复的是${p.parent_speaker_name || '别人'}的留言 #${p.parent_id},不是对你说的` : '发了一条新留言');
|
|
907
910
|
lines.push(` 💬 ${who} ${to};看全文:stelfield qa ${p.task_id || '<task_id>'} --list${p.reply_to === 'you' ? `;回答他:stelfield qa ${p.task_id || '<task_id>'} "<内容>" --reply-to ${p.comment_id}` : ''}`);
|
|
908
911
|
}
|