fix(ui): update shared badge on change
This commit is contained in:
@@ -909,6 +909,7 @@ const contextMenus = {
|
|||||||
btn.closest('.existing-share-item').remove();
|
btn.closest('.existing-share-item').remove();
|
||||||
if (existingSharesContainer.children.length === 0) {
|
if (existingSharesContainer.children.length === 0) {
|
||||||
document.getElementById('existing-shares-section').classList.add('hidden');
|
document.getElementById('existing-shares-section').classList.add('hidden');
|
||||||
|
ui.setSharedVisualState(item.id, item.type, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -992,6 +993,9 @@ const contextMenus = {
|
|||||||
shareUrl.select();
|
shareUrl.select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update Item's shared badge
|
||||||
|
ui.setSharedVisualState(item.id, item.type, true);
|
||||||
|
|
||||||
// Show success message
|
// Show success message
|
||||||
ui.showNotification(
|
ui.showNotification(
|
||||||
i18n ? i18n.t('notifications.link_created') : 'Link created',
|
i18n ? i18n.t('notifications.link_created') : 'Link created',
|
||||||
|
|||||||
@@ -575,6 +575,7 @@ const sharedView = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// FIXME: redundance with fileSharing
|
||||||
const res = await fetch(`/api/shares/${this.currentItem.id}`, {
|
const res = await fetch(`/api/shares/${this.currentItem.id}`, {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: this._headers(true),
|
headers: this._headers(true),
|
||||||
@@ -589,7 +590,8 @@ const sharedView = {
|
|||||||
console.error('Error updating share:', err);
|
console.error('Error updating share:', err);
|
||||||
this.showNotification(err.message || 'Error updating share', 'error');
|
this.showNotification(err.message || 'Error updating share', 'error');
|
||||||
}
|
}
|
||||||
|
// update UI
|
||||||
|
ui.setSharedVisualState(this.currentItem.item_id, this.currentItem.item_type, true);
|
||||||
this.closeShareDialog();
|
this.closeShareDialog();
|
||||||
await this.loadItems(true);
|
await this.loadItems(true);
|
||||||
this.filterAndSortItems();
|
this.filterAndSortItems();
|
||||||
@@ -600,6 +602,7 @@ const sharedView = {
|
|||||||
if (!this.currentItem) return;
|
if (!this.currentItem) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// FIXME: redundance with fileSharing
|
||||||
const res = await fetch(`/api/shares/${this.currentItem.id}`, {
|
const res = await fetch(`/api/shares/${this.currentItem.id}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: this._headers()
|
headers: this._headers()
|
||||||
@@ -614,6 +617,8 @@ const sharedView = {
|
|||||||
this.closeShareDialog();
|
this.closeShareDialog();
|
||||||
await this.loadItems(true);
|
await this.loadItems(true);
|
||||||
this.filterAndSortItems();
|
this.filterAndSortItems();
|
||||||
|
// update UI
|
||||||
|
ui.setSharedVisualState(this.currentItem.item_id, this.currentItem.item_type, this.isShared(this.currentItem.item_id, this.currentItem.item_type));
|
||||||
},
|
},
|
||||||
|
|
||||||
// Send notification (stub)
|
// Send notification (stub)
|
||||||
|
|||||||
Reference in New Issue
Block a user