fix: dismiss license warnings should be also possible in non base.mako pages

This commit is contained in:
RhodeCode Admin 2025-03-21 13:13:59 +00:00
parent 552b0cfeb1
commit c2914495c0
2 changed files with 32 additions and 33 deletions

View file

@ -1111,39 +1111,6 @@
}
});
var dismissNotice = function(noticeId) {
var url = pyroutes.url('user_notice_dismiss',
{"user_id": templateContext.rhodecode_user.user_id});
var postData = {
'csrf_token': CSRF_TOKEN,
'notice_id': noticeId,
};
var success = function(response) {
$('#notice-message-' + noticeId).remove();
return false;
};
var failure = function(data, textStatus, xhr) {
alert("error processing request: " + textStatus);
return false;
};
ajaxPOST(url, postData, success, failure);
}
var hideLicenseWarning = function () {
var fingerprint = templateContext.session_attrs.license_fingerprint;
storeUserSessionAttr('rc_user_session_attr.hide_license_warning', fingerprint);
$('#notifications').hide();
}
var hideLicenseError = function () {
var fingerprint = templateContext.session_attrs.license_fingerprint;
storeUserSessionAttr('rc_user_session_attr.hide_license_error', fingerprint);
$('#notifications').hide();
}
</script>
<script src="${h.asset('js/rhodecode/base/keyboard-bindings.js', ver=c.rhodecode_version_hash)}"></script>
</%def>

View file

@ -104,6 +104,38 @@ c.template_context['attachment_store'] = {
rhodecode_edition: '${c.rhodecode_edition}'
}
};
var dismissNotice = function(noticeId) {
var url = pyroutes.url('user_notice_dismiss',
{"user_id": templateContext.rhodecode_user.user_id});
var postData = {
'csrf_token': CSRF_TOKEN,
'notice_id': noticeId,
};
var success = function(response) {
$('#notice-message-' + noticeId).remove();
return false;
};
var failure = function(data, textStatus, xhr) {
alert("error processing request: " + textStatus);
return false;
};
ajaxPOST(url, postData, success, failure);
}
var hideLicenseWarning = function () {
var fingerprint = templateContext.session_attrs.license_fingerprint;
storeUserSessionAttr('rc_user_session_attr.hide_license_warning', fingerprint);
$('#notifications').hide();
}
var hideLicenseError = function () {
var fingerprint = templateContext.session_attrs.license_fingerprint;
storeUserSessionAttr('rc_user_session_attr.hide_license_error', fingerprint);
$('#notifications').hide();
}
</script>
<%include file="/base/plugins_base.mako"/>