Revert "Poll notifications on an hourly schedule"

This reverts commit 98720aa072.
This commit is contained in:
amcmanu3 2023-09-04 17:46:22 -04:00
parent 98720aa072
commit 4cd8e540f7
3 changed files with 2 additions and 33 deletions

View File

@ -82,7 +82,6 @@ class Helpers:
self.translation = Translation(self)
self.update_available = False
self.ignored_names = ["crafty_managed.txt", "db_stats"]
self.announcements = []
@staticmethod
def auto_installer_fix(ex):
@ -580,7 +579,7 @@ class Helpers:
return version_data
def refresh_announcements(self):
def get_announcements(self):
data = []
try:
response = requests.get("https://craftycontrol.com/notify", timeout=2)
@ -588,10 +587,6 @@ class Helpers:
except Exception as e:
logger.error(f"Failed to fetch notifications with error: {e}")
self.announcements = data
def get_announcements(self):
data = self.announcements
if self.update_available:
data.append(self.update_available)
return data

View File

@ -200,14 +200,6 @@ class TasksManager:
id="update_watcher",
start_date=datetime.datetime.now(),
)
self.helper.refresh_announcements()
self.scheduler.add_job(
self.helper.refresh_announcements,
"interval",
hours=1,
id="annoucement_watcher",
start_date=datetime.datetime.now(),
)
# self.scheduler.add_job(
# self.scheduler.print_jobs, "interval", seconds=10, id="-1"
# )

View File

@ -7,8 +7,7 @@
text-danger
{% end %}
"></i><span id="notif-count" class="badge badge-notify"></span> </a>
<div class="dropdown-menu dropdown-menu-right navbar-dropdown notif-drop"
style="width: 40vw; max-height: 80vh; overflow-y: scroll;" aria-labelledby="notifDropdown">
<div class="dropdown-menu dropdown-menu-right navbar-dropdown" style="width: 40vw;" aria-labelledby="notifDropdown">
<ul style="padding-top: 10px;" id="announcements">
</ul>
</div>
@ -79,19 +78,6 @@
.clear-button:hover {
cursor: pointer;
}
/* Hide scrollbar for Chrome, Safari and Opera */
.notif-drop::-webkit-scrollbar {
display: none;
}
/* Hide scrollbar for IE, Edge and Firefox */
.notif-drop {
-ms-overflow-style: none;
/* IE and Edge */
scrollbar-width: none;
/* Firefox */
}
</style>
<script>
function pfpError(image) {
@ -131,10 +117,6 @@
});
}
async function getAnnouncements() {
setTimeout(() => {
getAnnouncements();
console.log("Notifications Refreshed")
}, 5 * 60 * 1000);
var token = getCookie("_xsrf");
let res = await fetch(`/api/v2/crafty/announcements/`, {
method: 'GET',