v0.9.3 added user feature to disable participation in private messages

This commit is contained in:
2026-03-13 16:25:33 -04:00
parent 5301d8a525
commit 62b89b6548
10 changed files with 72 additions and 43 deletions

View File

@@ -18,12 +18,13 @@ export default function ProfileModal({ onClose }) {
const [loading, setLoading] = useState(false);
const [tab, setTab] = useState('profile'); // 'profile' | 'password'
const [hideAdminTag, setHideAdminTag] = useState(!!user?.hide_admin_tag);
const [allowDm, setAllowDm] = useState(user?.allow_dm !== 0);
const handleSaveProfile = async () => {
if (displayNameWarning) return toast('Display name is already in use', 'error');
setLoading(true);
try {
const { user: updated } = await api.updateProfile({ displayName, aboutMe, hideAdminTag });
const { user: updated } = await api.updateProfile({ displayName, aboutMe, hideAdminTag, allowDm });
updateUser(updated);
setSavedDisplayName(displayName);
toast('Profile updated', 'success');
@@ -149,6 +150,15 @@ export default function ProfileModal({ onClose }) {
Hide "Admin" tag next to my name in messages
</label>
)}
<label className="flex items-center gap-2 text-sm pointer" style={{ color: 'var(--text-secondary)', userSelect: 'none' }}>
<input
type="checkbox"
checked={allowDm}
onChange={e => setAllowDm(e.target.checked)}
style={{ accentColor: 'var(--primary)', width: 16, height: 16 }}
/>
Allow others to send me direct messages
</label>
<button className="btn btn-primary" onClick={handleSaveProfile} disabled={loading}>
{loading ? 'Saving...' : 'Save Changes'}
</button>