(action)
| 1202 | } |
| 1203 | |
| 1204 | async function updateMustRead(action) { |
| 1205 | const userId = ensureUser(); |
| 1206 | const itemType = $("mustReadType").value; |
| 1207 | const value = $("mustReadValue").value.trim(); |
| 1208 | if (!value) throw new Error("请输入必读规则的值。"); |
| 1209 | setStatus(`${action === "add" ? "添加" : "移除"}必读规则`, true); |
| 1210 | const data = await api("/api/must-read", { |
| 1211 | method: "POST", |
| 1212 | body: JSON.stringify({ user_id: userId, item_type: itemType, value, action }), |
| 1213 | }); |
| 1214 | renderMustRead(data.must_read || {}); |
| 1215 | await refreshProfile(); |
| 1216 | setStatus("必读规则已更新"); |
| 1217 | } |
| 1218 | |
| 1219 | async function refreshWikiStats() { |
| 1220 | const userId = activeUser(); |
no test coverage detected