(targetId, items, filter)
| 1153 | } |
| 1154 | |
| 1155 | function renderActivityList(targetId, items, filter) { |
| 1156 | const target = $(targetId); |
| 1157 | if (!target) return; |
| 1158 | if (filter) { |
| 1159 | items = items.filter((item) => item.action === filter || item.action_type === filter); |
| 1160 | } |
| 1161 | if (!items.length) { |
| 1162 | target.className = "activity-list empty"; |
| 1163 | target.textContent = "暂无最近活动。"; |
| 1164 | return; |
| 1165 | } |
| 1166 | target.className = "activity-list"; |
| 1167 | target.innerHTML = items.map((item) => ` |
| 1168 | <div class="activity-item"> |
| 1169 | <h4>${escapeHtml(labelAction(item.action))} | ${escapeHtml(labelAction(item.action_type || ""))}</h4> |
| 1170 | <p>${escapeHtml(item.paper_title || item.push_id || "")}</p> |
| 1171 | <p>${escapeHtml(item.timestamp || "")}</p> |
| 1172 | </div> |
| 1173 | `).join(""); |
| 1174 | } |
| 1175 | |
| 1176 | async function refreshMustRead() { |
| 1177 | const userId = activeUser(); |
no test coverage detected