feat(messages): add unpin button (📌) in pinned messages modal
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-03-27 15:12:42 +01:00
parent 2dc1ad9ae7
commit 3259ae3c05
2 changed files with 40 additions and 7 deletions

View File

@ -1976,20 +1976,53 @@
pins.forEach(function (pin) {
var item = el('div', '');
item.style.padding = '10px';
item.style.padding = '10px 10px 10px 12px';
item.style.borderBottom = '1px solid var(--conv-border)';
item.style.cursor = 'pointer';
item.style.fontSize = '13px';
item.style.display = 'flex';
item.style.alignItems = 'center';
item.style.gap = '8px';
var textWrap = el('div', '');
textWrap.style.flex = '1';
textWrap.style.cursor = 'pointer';
textWrap.style.fontSize = '13px';
var preview = pin.content_preview || stripHtml(pin.content || '').substring(0, 120);
var sender = pin.sender_name ? pin.sender_name + ': ' : '';
item.textContent = sender + (preview || '(pusta wiadomość)');
item.addEventListener('click', function () {
textWrap.textContent = sender + (preview || '(pusta wiadomość)');
textWrap.addEventListener('click', function () {
overlay.remove();
ChatView.scrollToMessage(pin.message_id || pin.id);
});
var unpinBtn = el('button', '', '📌');
unpinBtn.title = 'Odepnij';
unpinBtn.style.border = 'none';
unpinBtn.style.background = 'transparent';
unpinBtn.style.cursor = 'pointer';
unpinBtn.style.fontSize = '16px';
unpinBtn.style.padding = '4px';
unpinBtn.style.borderRadius = '4px';
unpinBtn.style.flexShrink = '0';
unpinBtn.style.opacity = '0.6';
unpinBtn.addEventListener('mouseenter', function () { unpinBtn.style.opacity = '1'; unpinBtn.style.background = 'var(--conv-surface-secondary)'; });
unpinBtn.addEventListener('mouseleave', function () { unpinBtn.style.opacity = '0.6'; unpinBtn.style.background = 'transparent'; });
unpinBtn.addEventListener('click', function (e) {
e.stopPropagation();
api('/api/messages/' + pin.message_id + '/pin', 'DELETE')
.then(function () {
item.remove();
// Update pin count
var remaining = panel.querySelectorAll('div[style*="flex"]').length;
Pins.updateBar(remaining);
if (remaining === 0) {
overlay.remove();
}
})
.catch(function () {});
});
item.appendChild(textWrap);
item.appendChild(unpinBtn);
panel.appendChild(item);
});

View File

@ -245,7 +245,7 @@ window.__CSRF_TOKEN__ = '{{ csrf_token() }}';
// Load conversations.js after data is set
(function() {
var s = document.createElement('script');
s.src = '{{ url_for("static", filename="js/conversations.js") }}?v=5';
s.src = '{{ url_for("static", filename="js/conversations.js") }}?v=6';
document.body.appendChild(s);
})();
{% endblock %}