feat: retire per-channel private flag on profile page

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NfPpSpccTWBfZg1FTveyaU
This commit is contained in:
2026-07-09 16:53:55 -04:00
co-authored by Claude Fable 5
parent ca2868a888
commit 5fe069a1a2
2 changed files with 3 additions and 13 deletions
+1 -1
View File
@@ -1058,7 +1058,7 @@ async def start(
"name": name, "name": name,
"type": cfg.get("type", ""), "type": cfg.get("type", ""),
"owner": cfg.get("owner"), "owner": cfg.get("owner"),
"private": bool(cfg.get("private", False)), "private": not config_access.is_global(cfg),
} }
for name, cfg in visible_channels.items() for name, cfg in visible_channels.items()
if isinstance(cfg, dict) if isinstance(cfg, dict)
+2 -12
View File
@@ -240,7 +240,6 @@
} }
.my-ch-name { font-weight: 600; font-size: .9em; color: #222; } .my-ch-name { font-weight: 600; font-size: .9em; color: #222; }
.my-ch-type { padding: 2px 7px; border-radius: 8px; font-size: .72em; font-weight: 600; background: #e8eaf6; color: #3949ab; } .my-ch-type { padding: 2px 7px; border-radius: 8px; font-size: .72em; font-weight: 600; background: #e8eaf6; color: #3949ab; }
.my-ch-private { padding: 2px 7px; border-radius: 8px; font-size: .72em; font-weight: 600; background: #fce4ec; color: #c62828; }
.my-ch-actions { margin-left: auto; display: flex; gap: 5px; } .my-ch-actions { margin-left: auto; display: flex; gap: 5px; }
.btn-sm-edit { background: #888; color: #fff; border: none; border-radius: 4px; padding: 2px 8px; font-size: .78em; cursor: pointer; } .btn-sm-edit { background: #888; color: #fff; border: none; border-radius: 4px; padding: 2px 8px; font-size: .78em; cursor: pointer; }
.btn-sm-edit:hover { background: #666; } .btn-sm-edit:hover { background: #666; }
@@ -465,7 +464,7 @@
{% if current_user %} {% if current_user %}
<div class="section"> <div class="section">
<h2>My Channels</h2> <h2>My Channels</h2>
<p style="font-size:.82em;color:#888;margin:0 0 12px">Channels you own. Public channels are available to all users; private channels are visible only to you.</p> <p style="font-size:.82em;color:#888;margin:0 0 12px">Channels you own are private to you. Global channels are managed by administrators.</p>
<div id="my-channels-list"> <div id="my-channels-list">
{% set my_channels = all_channels | selectattr('owner', 'equalto', current_user.username) | list %} {% set my_channels = all_channels | selectattr('owner', 'equalto', current_user.username) | list %}
{% for ch in my_channels %} {% for ch in my_channels %}
@@ -473,7 +472,6 @@
<div class="my-ch-header"> <div class="my-ch-header">
<span class="my-ch-name">{{ ch.name | e }}</span> <span class="my-ch-name">{{ ch.name | e }}</span>
<span class="my-ch-type">{{ ch.type | e }}</span> <span class="my-ch-type">{{ ch.type | e }}</span>
{% if ch.private %}<span class="my-ch-private">private</span>{% endif %}
<span class="my-ch-actions"> <span class="my-ch-actions">
<button class="btn-sm-edit" onclick="openMyChModal('{{ ch.name | e }}')">Edit</button> <button class="btn-sm-edit" onclick="openMyChModal('{{ ch.name | e }}')">Edit</button>
<button class="btn-sm-del" onclick="deleteMyChannel('{{ ch.name | e }}')"></button> <button class="btn-sm-del" onclick="deleteMyChannel('{{ ch.name | e }}')"></button>
@@ -513,11 +511,6 @@
<option value="CRITICAL">CRITICAL only</option> <option value="CRITICAL">CRITICAL only</option>
</select> </select>
</div> </div>
<div class="ch-form-row">
<label style="display:flex;align-items:center;gap:6px;cursor:pointer">
<input type="checkbox" id="my-ch-private"> Private — visible only to you
</label>
</div>
<div id="my-ch-modal-status" class="ch-modal-status"></div> <div id="my-ch-modal-status" class="ch-modal-status"></div>
<div class="ch-modal-footer"> <div class="ch-modal-footer">
<button class="btn-save" style="background:#888" onclick="closeMyChModal()">Cancel</button> <button class="btn-save" style="background:#888" onclick="closeMyChModal()">Cancel</button>
@@ -744,7 +737,6 @@
document.getElementById('my-ch-type').value = ''; document.getElementById('my-ch-type').value = '';
document.getElementById('my-ch-type-fields').innerHTML = ''; document.getElementById('my-ch-type-fields').innerHTML = '';
document.getElementById('my-ch-min-level').value = 'WARNING'; document.getElementById('my-ch-min-level').value = 'WARNING';
document.getElementById('my-ch-private').checked = false;
if (name) { if (name) {
try { try {
@@ -755,7 +747,6 @@
document.getElementById('my-ch-type').value = ch.type; document.getElementById('my-ch-type').value = ch.type;
onMyChTypeChange(); onMyChTypeChange();
document.getElementById('my-ch-min-level').value = ch.min_level || 'WARNING'; document.getElementById('my-ch-min-level').value = ch.min_level || 'WARNING';
document.getElementById('my-ch-private').checked = ch.private || false;
(ch.fields || []).forEach(f => { (ch.fields || []).forEach(f => {
const inp = document.getElementById('mychf-' + f.key); const inp = document.getElementById('mychf-' + f.key);
if (inp) inp.value = f.value || ''; if (inp) inp.value = f.value || '';
@@ -774,14 +765,13 @@
const name = document.getElementById('my-ch-name').value.trim(); const name = document.getElementById('my-ch-name').value.trim();
const type = document.getElementById('my-ch-type').value; const type = document.getElementById('my-ch-type').value;
const minLevel = document.getElementById('my-ch-min-level').value; const minLevel = document.getElementById('my-ch-min-level').value;
const isPrivate = document.getElementById('my-ch-private').checked;
const statusEl = document.getElementById('my-ch-modal-status'); const statusEl = document.getElementById('my-ch-modal-status');
statusEl.textContent = ''; statusEl.textContent = '';
if (!name) { statusEl.textContent = 'Name is required.'; statusEl.style.color = '#c62828'; return; } if (!name) { statusEl.textContent = 'Name is required.'; statusEl.style.color = '#c62828'; return; }
if (!type) { statusEl.textContent = 'Please select a type.'; statusEl.style.color = '#c62828'; return; } if (!type) { statusEl.textContent = 'Please select a type.'; statusEl.style.color = '#c62828'; return; }
const body = { name, type, min_level: minLevel, private: isPrivate }; const body = { name, type, min_level: minLevel };
if (_myChSchemas[type]) { if (_myChSchemas[type]) {
(_myChSchemas[type].fields || []).forEach(sf => { (_myChSchemas[type].fields || []).forEach(sf => {
const inp = document.getElementById('mychf-' + sf.key); const inp = document.getElementById('mychf-' + sf.key);