QS 0.9.1 Bugs bearbeitet

This commit is contained in:
Holger Trampe 2020-06-02 11:28:28 +02:00
parent a850dddc65
commit e6f0279b24
4 changed files with 32 additions and 39 deletions

1
.cred
View File

@ -2,3 +2,4 @@ https://holger.trampe:Zerogoogle123_@git.vhevents.de/
https://holger.trampe:Zerogoogle123_@git.vhevents.de/
https://holger.trampe:Zerogoogle123_@git.vhevents.de/
https://holger.trampe:Zerogoogle123_@git.vhevents.de/
https://holger.trampe:Zerogoogle123_@git.vhevents.de/

View File

@ -70,7 +70,9 @@ class UsersConsumer(WebsocketConsumer):
# NEW AGENCY NEWS
def agency_newnews(self, event):
self.send("Neue Agenturnews!")
print(event["pushtext"])
self.send("pushnotification__news__" + event["pushtext"])
#self.send("Neue Agenturnews!")
# SOMETHING IN PRESENCE CHANGED
def update_presence_live(self, event):

View File

@ -268,14 +268,15 @@ def save_news(sender, instance, **kwargs):
GLOBALSENDMAILS = True
if(kwargs["created"]):
# Hier wird allen verbundenne Agenturmitgliedern die Info geschickt, dass es neue Agenturnews gibt
# Hier wird an alle in der Agentur geschickt, lokal wird geprüft, ob der User diese Push-Info haben will
channel_layer = channels.layers.get_channel_layer()
async_to_sync(channel_layer.group_send)("agency_" + str(instance.agency.pk), {'type' : 'agency_newnews'})
async_to_sync(channel_layer.group_send)("agency_" + str(instance.agency.pk), {'type' : 'agency_newnews', 'pushtext' : "Neue Agenturnews | " + instance.name})
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
targeturl = settings.BASE_URL + "news/news/" + str(instance.pk) + "/single"
# Prüfung, ob die News SOFORT online geht oder später
if(instance.go_online_on < timezone.now() and instance.agnotify):
for user in usersofagency:
@ -302,12 +303,17 @@ def save_news(sender, instance, **kwargs):
newnotification.save()
else:
instance.agnotify = False
instance.save()
# News wurden aktualisiert
else:
channel_layer = channels.layers.get_channel_layer()
async_to_sync(channel_layer.group_send)("agency_" + str(instance.agency.pk), {'type' : 'agency_newnews'})
pass
# Hier wird an alle in der Agentur geschickt, lokal wird geprüft, ob der User diese Push-Info haben will
#channel_layer = channels.layers.get_channel_layer()
#async_to_sync(channel_layer.group_send)("agency_" + str(instance.agency.pk), {'type' : 'agency_newnews', 'pushtext' : "Neue Agenturnews | " + instance.name})

View File

@ -602,33 +602,6 @@ $( window ).resize(function() {
sidebar_hidden = true;
}
});
/*
delay = 250;
throttled = false;
function getDimensions() {
width = window.innerWidth;
if(width >= 768){
$("#content-wrapper").css("margin-left" , "212px");
}
else{
$("#content-wrapper").css("margin-left" , "105px");
}
}
// window.resize event listener
window.addEventListener('resize', function() {
if (!throttled) { // nur wenn throttled nicht gesetzt ist
getDimensions(); // Callback-Aktion
throttled = true; // Jetzt wird wieder ausgebremst
setTimeout(function() { // Timeout
throttled = false;
}, delay);
}
});
getDimensions();
*/
/*
AJAX CALL FOR NOTIFICATIONS
@ -733,9 +706,20 @@ $(document).ready(function(){
mainwebsocket.onmessage = function(e) {
if(e["data"] != "presence_update")
{
//HANDLER FOR ALL PUSHNOTIFICATIONS
if(e["data"].split("__")[0] == "pushnotification"){
{% if user.profile.news_push %}
// USER WANTS TO SEE NEWS PUSH
if(e["data"].split("__")[1] == "news"){
var notify = new Notification('Digitale Agentur', {
body: e["data"]
body: e["data"].split("__")[2]
});
}
{% endif %}
}
loadUnsendNotifications();
loadUnviewnNotifications();
}