N°2039 - Empty newsroom cache when modifying notifications from view all page

This commit is contained in:
Stephen Abello
2024-03-04 15:23:57 +01:00
parent 3404306de8
commit e00112d6e1
4 changed files with 16 additions and 4 deletions

View File

@@ -1620,7 +1620,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
'UI:Newsroom:Preferences' => 'Préférences du centre d\'information',
'UI:Newsroom:ConfigurationLink' => 'Configuration',
'UI:Newsroom:ResetCache' => 'Ràz du cache',
'UI:Newsroom:ResetCache:Success:Message' => 'Le cache a été réinitialisé avec succès',
'UI:Newsroom:ResetCache:Success:Message' => 'Le cache de la newsroom a été réinitialisé avec succès',
'UI:Newsroom:DisplayMessagesFor_Provider' => 'Afficher les messages de %1$s',
'UI:Newsroom:DisplayAtMost_X_Messages' => 'Afficher au plus %1$s messages dans le menu %2$s.',
));

View File

@@ -363,7 +363,6 @@ $(function()
var sKey = this._makeCacheKey(idx);
localStorage.removeItem(sKey);
}
CombodoToast.OpenSuccessToast(Dict.S('UI:Newsroom:ResetCache:Success:Message'));
},
_makeCacheKey: function(idxProvider)
{

View File

@@ -15,6 +15,8 @@ $('body').on('itop.notification.deleted', '.ibo-notifications--view-all--contain
$('.ibo-notifications--view-all--unread-action').attr('disabled', 'disabled');
$('.ibo-notifications--view-all--delete-action').attr('disabled', 'disabled');
}
$('#ibo-navigation-menu--notifications-menu').newsroom_menu("clearCache");
});
let fReadUnreadDisabled = function() {
@@ -28,6 +30,8 @@ let fReadUnreadDisabled = function() {
$('.ibo-notifications--view-all--read-action').removeAttr('disabled');
$('.ibo-notifications--view-all--unread-action').removeAttr('disabled');
}
$('#ibo-navigation-menu--notifications-menu').newsroom_menu("clearCache");
}
$('body').on('itop.notification.read itop.notification.unread', '.ibo-notifications--view-all--container', fReadUnreadDisabled);

View File

@@ -315,7 +315,11 @@ JS
// - Reset button
$oNewsroomResetCacheButton = ButtonUIBlockFactory::MakeForAlternativeDestructiveAction(Dict::S('UI:Newsroom:ResetCache'));
$oNewsroomResetCacheButton->SetOnClickJsCode("$('#ibo-navigation-menu--notifications-menu').newsroom_menu('clearCache')");
$oNewsroomResetCacheButton->SetOnClickJsCode(<<<JS
$('#ibo-navigation-menu--notifications-menu').newsroom_menu('clearCache')
CombodoToast.OpenSuccessToast(Dict.S('UI:Newsroom:ResetCache:Success:Message'));
JS
);
$oNewsroomToolbar->AddSubBlock($oNewsroomResetCacheButton);
// - Cancel button
$oNewsroomCancelButton = ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'));
@@ -916,7 +920,12 @@ try {
}
if ($bProvidersModified)
{
$oPage->add_ready_script('$(".itop-newsroom_menu").newsroom_menu("clearCache");');
$oPage->add_ready_script(
<<<JS
$('#ibo-navigation-menu--notifications-menu').newsroom_menu("clearCache");
CombodoToast.OpenSuccessToast(Dict.S('UI:Newsroom:ResetCache:Success:Message'));
JS
);
}
DisplayPreferences($oPage);
break;