forked from retoor/devplacepy
docs: add block/mute user relations, emoji-sync CLI, and uid indexes
- Add `/block`, `/mute` endpoints with block/unblock and mute/unmute functionality in `routers/relations.py`, hiding blocked users' content everywhere except their own profile while muting only suppresses notifications - Introduce `devplace emoji-sync` CLI command to regenerate `static/js/emoji-shortcodes.js` from the emoji library, documented in `CLAUDE.md` and wired in `cli.py` - Create `get_blocked_uids()` database helper and apply it in `content.py` `load_detail()` to filter blocked users' posts from detail views - Implement `_uid_index()` and `_drop_index()` helpers in `database.py` for unique uid indexes across tables, with `user_relations` added to `SOFT_DELETE_TABLES` - Document new routes in `AGENTS.md` and `README.md`, including emoji shortcodes rendering behavior distinct from the emoji picker
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
<span class="profile-stat-label">Stars</span>
|
||||
</div>
|
||||
<div class="profile-stat">
|
||||
<a href="/leaderboard" class="profile-stat-value">{% if rank %}#{{ rank }}{% else %}-{% endif %}</a>
|
||||
<a href="/leaderboard" class="profile-stat-value" aria-label="Rank{% if rank %} number {{ rank }}{% else %} not ranked{% endif %}, view leaderboard">{% if rank %}#{{ rank }}{% else %}-{% endif %}</a>
|
||||
<span class="profile-stat-label">Rank</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
{% if not is_self(user, profile_user['uid']) %}
|
||||
<div class="profile-actions">
|
||||
<a href="{% if user %}/messages?with_uid={{ profile_user['uid'] }}{% else %}/auth/login{% endif %}" class="btn btn-secondary btn-sm full-width justify-center{% if not user %} login-required{% endif %}"{% if not user %} title="Log in to participate"{% endif %}><span class="icon">✉️</span>Send Message</a>
|
||||
<a href="{% if user %}/messages?with_uid={{ profile_user['uid'] }}{% else %}/auth/login{% endif %}" class="btn btn-secondary btn-sm full-width justify-center{% if not user %} login-required{% endif %}"><span class="icon">✉️</span>Send Message</a>
|
||||
{% if is_following %}
|
||||
<form method="POST" action="/follow/unfollow/{{ profile_user['username'] }}">
|
||||
<button type="submit" class="btn btn-secondary btn-sm full-width"{{ guest_disabled(user) }}><span class="icon">➖</span>Unfollow</button>
|
||||
@@ -66,6 +66,24 @@
|
||||
<button type="submit" class="btn btn-primary btn-sm full-width"{{ guest_disabled(user) }}><span class="icon">➕</span>Follow</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if is_blocked %}
|
||||
<form method="POST" action="/block/unblock/{{ profile_user['username'] }}">
|
||||
<button type="submit" class="btn btn-secondary btn-sm full-width" data-confirm="Unblock {{ profile_user['username'] }}? Their posts, comments and messages will be visible to you again."{{ guest_disabled(user) }}><span class="icon">🔓</span>Unblock</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form method="POST" action="/block/{{ profile_user['username'] }}">
|
||||
<button type="submit" class="btn btn-secondary btn-sm full-width" data-confirm="Block {{ profile_user['username'] }}? You will no longer see their posts, comments or messages anywhere except on this profile." data-confirm-danger{{ guest_disabled(user) }}><span class="icon">🚫</span>Block</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% if is_muted %}
|
||||
<form method="POST" action="/mute/unmute/{{ profile_user['username'] }}">
|
||||
<button type="submit" class="btn btn-secondary btn-sm full-width" data-confirm="Unmute {{ profile_user['username'] }}? They will be able to create notifications for you again."{{ guest_disabled(user) }}><span class="icon">🔊</span>Unmute</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form method="POST" action="/mute/{{ profile_user['username'] }}">
|
||||
<button type="submit" class="btn btn-secondary btn-sm full-width" data-confirm="Mute {{ profile_user['username'] }}? They will no longer create notifications for you." data-confirm-danger{{ guest_disabled(user) }}><span class="icon">🔇</span>Mute</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -76,44 +94,44 @@
|
||||
<span class="profile-info-label">Bio</span>
|
||||
<div class="flex-center-gap">
|
||||
<span class="profile-info-value bio-display" id="display-bio">{{ profile_user.get('bio', '') or 'Not set' }}</span>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="bio">✎</button>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="bio" aria-label="Edit bio">✎</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="auth-field hidden input-edit-field" id="input-bio">
|
||||
<textarea name="bio" maxlength="500" rows="2" class="input-sm">{{ profile_user.get('bio', '') }}</textarea>
|
||||
<textarea name="bio" maxlength="500" rows="2" class="input-sm" aria-label="Bio">{{ profile_user.get('bio', '') }}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="profile-info-row">
|
||||
<span class="profile-info-label">Location</span>
|
||||
<div class="flex-center-gap">
|
||||
<span class="profile-info-value" id="display-location">{{ profile_user.get('location', '') or 'Not set' }}</span>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="location">✎</button>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="location" aria-label="Edit location">✎</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="auth-field hidden input-edit-field" id="input-location">
|
||||
<input type="text" name="location" maxlength="200" value="{{ profile_user.get('location', '') }}" class="input-sm">
|
||||
<input type="text" name="location" maxlength="200" value="{{ profile_user.get('location', '') }}" class="input-sm" aria-label="Location">
|
||||
</div>
|
||||
|
||||
<div class="profile-info-row">
|
||||
<span class="profile-info-label">Git Link</span>
|
||||
<div class="flex-center-gap">
|
||||
<span class="profile-info-value" id="display-git_link">{{ profile_user.get('git_link', '') or 'Not set' }}</span>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="git_link">✎</button>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="git_link" aria-label="Edit Git link">✎</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="auth-field hidden input-edit-field" id="input-git_link">
|
||||
<input type="url" name="git_link" maxlength="500" value="{{ profile_user.get('git_link', '') }}" class="input-sm">
|
||||
<input type="url" name="git_link" maxlength="500" value="{{ profile_user.get('git_link', '') }}" class="input-sm" aria-label="Git link">
|
||||
</div>
|
||||
|
||||
<div class="profile-info-row">
|
||||
<span class="profile-info-label">Website</span>
|
||||
<div class="flex-center-gap">
|
||||
<span class="profile-info-value" id="display-website">{{ profile_user.get('website', '') or 'Not set' }}</span>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="website">✎</button>
|
||||
<button type="button" class="profile-info-edit" data-edit-field="website" aria-label="Edit website">✎</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="auth-field hidden input-edit-field" id="input-website">
|
||||
<input type="url" name="website" maxlength="500" value="{{ profile_user.get('website', '') }}" class="input-sm">
|
||||
<input type="url" name="website" maxlength="500" value="{{ profile_user.get('website', '') }}" class="input-sm" aria-label="Website">
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary btn-sm full-width save-btn-top">Save Changes</button>
|
||||
@@ -189,20 +207,20 @@
|
||||
<div class="customization-row">
|
||||
<span class="customization-label">Enable correction</span>
|
||||
<label class="ai-correction-switch">
|
||||
<input type="checkbox" data-ai-correction-toggle {% if ai_correction_enabled %}checked{% endif %}>
|
||||
<input type="checkbox" data-ai-correction-toggle aria-label="Enable AI content correction" {% if ai_correction_enabled %}checked{% endif %}>
|
||||
</label>
|
||||
</div>
|
||||
<div class="customization-row">
|
||||
<span class="customization-label">Apply mode</span>
|
||||
<select data-ai-correction-sync class="input-sm">
|
||||
<select data-ai-correction-sync class="input-sm" aria-label="AI content correction apply mode">
|
||||
<option value="async" {% if not ai_correction_sync %}selected{% endif %}>In background (faster, applies after saving)</option>
|
||||
<option value="sync" {% if ai_correction_sync %}selected{% endif %}>Synchronously (wait while saving)</option>
|
||||
</select>
|
||||
</div>
|
||||
<textarea data-ai-correction-prompt class="input-sm ai-correction-prompt" maxlength="2000" rows="3">{{ ai_correction_prompt }}</textarea>
|
||||
<textarea data-ai-correction-prompt class="input-sm ai-correction-prompt" maxlength="2000" rows="3" aria-label="AI content correction prompt">{{ ai_correction_prompt }}</textarea>
|
||||
<div class="customization-row">
|
||||
<button type="button" class="btn btn-sm btn-primary" data-ai-correction-save>Save</button>
|
||||
<span class="ai-correction-status" data-ai-correction-status></span>
|
||||
<span class="ai-correction-status" data-ai-correction-status role="status" aria-live="polite"></span>
|
||||
</div>
|
||||
<p class="customization-hint">Corrections apply to new and edited content using your API key, on posts, comments, projects, gists, direct messages and your bio. Code and source files are never changed. In background mode the correction is applied just after saving; in synchronous mode the save waits for the correction to finish.</p>
|
||||
</div>
|
||||
@@ -214,20 +232,20 @@
|
||||
<div class="customization-row">
|
||||
<span class="customization-label">Enable modifier</span>
|
||||
<label class="ai-correction-switch">
|
||||
<input type="checkbox" data-ai-modifier-toggle {% if ai_modifier_enabled %}checked{% endif %}>
|
||||
<input type="checkbox" data-ai-modifier-toggle aria-label="Enable AI modifier" {% if ai_modifier_enabled %}checked{% endif %}>
|
||||
</label>
|
||||
</div>
|
||||
<div class="customization-row">
|
||||
<span class="customization-label">Apply mode</span>
|
||||
<select data-ai-modifier-sync class="input-sm">
|
||||
<select data-ai-modifier-sync class="input-sm" aria-label="AI modifier apply mode">
|
||||
<option value="async" {% if not ai_modifier_sync %}selected{% endif %}>In background (applies after saving)</option>
|
||||
<option value="sync" {% if ai_modifier_sync %}selected{% endif %}>Synchronously (wait while saving)</option>
|
||||
</select>
|
||||
</div>
|
||||
<textarea data-ai-modifier-prompt class="input-sm ai-correction-prompt" maxlength="2000" rows="3">{{ ai_modifier_prompt }}</textarea>
|
||||
<textarea data-ai-modifier-prompt class="input-sm ai-correction-prompt" maxlength="2000" rows="3" aria-label="AI modifier prompt">{{ ai_modifier_prompt }}</textarea>
|
||||
<div class="customization-row">
|
||||
<button type="button" class="btn btn-sm btn-primary" data-ai-modifier-save>Save</button>
|
||||
<span class="ai-correction-status" data-ai-modifier-status></span>
|
||||
<span class="ai-correction-status" data-ai-modifier-status role="status" aria-live="polite"></span>
|
||||
</div>
|
||||
<p class="customization-hint">Runs only when your text contains an inline `@ai instruction` directive: it executes that instruction and removes the `@ai` marker, using your API key. Applies to posts, comments, projects, gists, direct messages and your bio. Code and source files are never touched.</p>
|
||||
</div>
|
||||
@@ -239,7 +257,7 @@
|
||||
<p class="customization-hint">Chat with your Devii from Telegram. Open the DevPlace bot in Telegram, then send it the four digit code below to connect this account.</p>
|
||||
<div class="customization-row">
|
||||
<span class="customization-label">Status</span>
|
||||
<span data-telegram-status>{{ 'Connected' if telegram_paired else 'Not connected' }}</span>
|
||||
<span data-telegram-status role="status" aria-live="polite">{{ 'Connected' if telegram_paired else 'Not connected' }}</span>
|
||||
</div>
|
||||
<div class="customization-row">
|
||||
<button type="button" class="btn btn-sm btn-primary" data-telegram-request>Request pairing code</button>
|
||||
@@ -249,7 +267,7 @@
|
||||
<code class="api-key-value" data-telegram-code-value></code>
|
||||
<p class="customization-hint" data-telegram-code-hint></p>
|
||||
</div>
|
||||
<span class="ai-correction-status" data-telegram-status-msg></span>
|
||||
<span class="ai-correction-status" data-telegram-status-msg role="status" aria-live="polite"></span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</aside>
|
||||
@@ -577,13 +595,13 @@
|
||||
</td>
|
||||
<td class="notif-prefs-col">
|
||||
<label class="notif-switch">
|
||||
<input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="in_app" {% if pref.in_app %}checked{% endif %}>
|
||||
<input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="in_app" aria-label="In-app notifications for {{ pref.label }}" {% if pref.in_app %}checked{% endif %}>
|
||||
<span class="notif-switch-track"></span>
|
||||
</label>
|
||||
</td>
|
||||
<td class="notif-prefs-col">
|
||||
<label class="notif-switch">
|
||||
<input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="push" {% if pref.push %}checked{% endif %}>
|
||||
<input type="checkbox" data-notif-toggle data-type="{{ pref.key }}" data-channel="push" aria-label="Push notifications for {{ pref.label }}" {% if pref.push %}checked{% endif %}>
|
||||
<span class="notif-switch-track"></span>
|
||||
</label>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user