QS 0.9.1 Bugs bearbeitet
This commit is contained in:
parent
a850dddc65
commit
e6f0279b24
1
.cred
1
.cred
|
|
@ -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/
|
||||||
https://holger.trampe:Zerogoogle123_@git.vhevents.de/
|
https://holger.trampe:Zerogoogle123_@git.vhevents.de/
|
||||||
|
https://holger.trampe:Zerogoogle123_@git.vhevents.de/
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,9 @@ class UsersConsumer(WebsocketConsumer):
|
||||||
|
|
||||||
# NEW AGENCY NEWS
|
# NEW AGENCY NEWS
|
||||||
def agency_newnews(self, event):
|
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
|
# SOMETHING IN PRESENCE CHANGED
|
||||||
def update_presence_live(self, event):
|
def update_presence_live(self, event):
|
||||||
|
|
|
||||||
|
|
@ -267,15 +267,16 @@ def save_standard(sender, instance, **kwargs):
|
||||||
def save_news(sender, instance, **kwargs):
|
def save_news(sender, instance, **kwargs):
|
||||||
GLOBALSENDMAILS = True
|
GLOBALSENDMAILS = True
|
||||||
if(kwargs["created"]):
|
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()
|
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)
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
targeturl = settings.BASE_URL + "news/news/" + str(instance.pk) + "/single"
|
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):
|
if(instance.go_online_on < timezone.now() and instance.agnotify):
|
||||||
|
|
||||||
for user in usersofagency:
|
for user in usersofagency:
|
||||||
|
|
@ -296,18 +297,23 @@ def save_news(sender, instance, **kwargs):
|
||||||
html_message=msg_html,
|
html_message=msg_html,
|
||||||
fail_silently=True
|
fail_silently=True
|
||||||
)
|
)
|
||||||
|
|
||||||
if(user.profile.news_push):
|
if(user.profile.news_push):
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="agencynews", elementid=instance.pk)
|
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="agencynews", elementid=instance.pk)
|
||||||
newnotification.save()
|
newnotification.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
instance.agnotify = False
|
instance.agnotify = False
|
||||||
instance.save()
|
instance.save()
|
||||||
else:
|
# News wurden aktualisiert
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
else:
|
||||||
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})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -602,33 +602,6 @@ $( window ).resize(function() {
|
||||||
sidebar_hidden = true;
|
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
|
AJAX CALL FOR NOTIFICATIONS
|
||||||
|
|
||||||
|
|
@ -733,9 +706,20 @@ $(document).ready(function(){
|
||||||
mainwebsocket.onmessage = function(e) {
|
mainwebsocket.onmessage = function(e) {
|
||||||
if(e["data"] != "presence_update")
|
if(e["data"] != "presence_update")
|
||||||
{
|
{
|
||||||
var notify = new Notification('Digitale Agentur', {
|
//HANDLER FOR ALL PUSHNOTIFICATIONS
|
||||||
body: e["data"]
|
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"].split("__")[2]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
}
|
||||||
loadUnsendNotifications();
|
loadUnsendNotifications();
|
||||||
loadUnviewnNotifications();
|
loadUnviewnNotifications();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue