Gruppenordner werden angelegt
This commit is contained in:
parent
52de2bc847
commit
39759cfeb6
|
|
@ -10,15 +10,24 @@
|
|||
<div id="groups_process_groups"></div>
|
||||
<h5 id="user_process" style="display: none;">Es werden {{users|length}} Benutzer angelegt und in die Gruppen gepackt. Die Nutzer müssen sich dann ein neues Passwort setzen.</h5>
|
||||
<div id="user_process_user" style="display: none;"></div>
|
||||
<h5 id="cloud_process" style="display: none;">Es werden Dateien und Ordner kopiert und mit Zugriffsrechten gesetzt.</h5>
|
||||
<div id="cloud_process_main" style="display: none;">Gruppenordner wird angelegt</div>
|
||||
<div id="cloud_process_cloud" style="display: none;"></div>
|
||||
</div>
|
||||
<h5 id="migfinished" style="display: none;">Migration vollständig. Bitte diese Seite ausdrucken oder Speichern. Ein erneuter Import ist nicht möglich!</h5>
|
||||
<script>
|
||||
var userids = [{% for us in users %} "{{us.pk}}" {% if forloop.counter < users|length %}, {% endif %} {% endfor %}];
|
||||
var groupids = [{% for g in groups %} "{{g.name}}" {% if forloop.counter < groups|length %}, {% endif %} {% endfor %}];
|
||||
|
||||
var filesid = [{% for f in files %} "{{f.pk}}" {% if forloop.counter < files|length %}, {% endif %} {% endfor %}];
|
||||
var dirsid = [{% for d in dirs %} "{{d.pk}}" {% if forloop.counter < dirs|length %}, {% endif %} {% endfor %}];
|
||||
|
||||
$(document).ready(function(){
|
||||
// FIRST CALL GROUPS, When Groups finished User will call by Groups
|
||||
createAgencyGroups(groupids[0]);
|
||||
//createAgencyGroups(groupids[0]);
|
||||
|
||||
//DEV
|
||||
addGroupFolder();
|
||||
})
|
||||
|
||||
var groupcounter = 0;
|
||||
|
|
@ -54,7 +63,6 @@
|
|||
|
||||
var usercounter = 0;
|
||||
function createUsers(userid){
|
||||
console.log(userid);
|
||||
$("#user_process").show();
|
||||
$("#user_process_user").show();
|
||||
$.ajax({
|
||||
|
|
@ -76,6 +84,65 @@
|
|||
if(usercounter < userids.length){
|
||||
createUsers(userids[usercounter]);
|
||||
}
|
||||
else {
|
||||
addGroupFolder();
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(e){
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var groupfolderid = "";
|
||||
function addGroupFolder(){
|
||||
$("#cloud_process").show();
|
||||
$("#cloud_process_main").show();
|
||||
$.ajax({
|
||||
url: "{% url 'api:apiaddgf' %}",
|
||||
headers: {
|
||||
'Authorization':'Token {{ ncid }}',
|
||||
"Access-Control-Allow-Origin" : "*"
|
||||
},
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'agencyid' : {{agency.pk}},
|
||||
},
|
||||
success: function(data){
|
||||
console.log(data);
|
||||
if(data['status'] == true){
|
||||
|
||||
//addCloud();
|
||||
}
|
||||
},
|
||||
error: function(e){
|
||||
console.log(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addCloud(){
|
||||
$("#cloud_process_cloud").show();
|
||||
$.ajax({
|
||||
url: "{% url 'api:apiaddcloud' %}",
|
||||
headers: {
|
||||
'Authorization':'Token {{ ncid }}',
|
||||
"Access-Control-Allow-Origin" : "*"
|
||||
},
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
'agencyid' : {{agency.pk}},
|
||||
},
|
||||
success: function(data){
|
||||
if(data['status'] == true){
|
||||
$("#groups_process_groups").append('<p>' + data['message'] + "</p>");
|
||||
groupcounter += 1;
|
||||
if(groupcounter < groupids.length){
|
||||
//createAgencyGroups(groupids[groupcounter]);
|
||||
}
|
||||
else {
|
||||
$("#migfinished").show();
|
||||
}
|
||||
|
|
|
|||
10
adm/views.py
10
adm/views.py
|
|
@ -691,6 +691,9 @@ class AdmImport(TemplateView):
|
|||
return context
|
||||
|
||||
from django.contrib.auth.models import Group
|
||||
|
||||
from cloud.models import *
|
||||
|
||||
class AdmImportFlow(TemplateView):
|
||||
template_name="adm/adm_import_flow.html"
|
||||
|
||||
|
|
@ -704,6 +707,12 @@ class AdmImportFlow(TemplateView):
|
|||
# Users in that Agency
|
||||
context.update({'users' : User.objects.filter(profile__agency=agency)})
|
||||
|
||||
# DataFiles
|
||||
context.update({'files' : DataFile.objects.filter(agency=agency)})
|
||||
|
||||
# DataDirs
|
||||
context.update({'dirs' : DataDir.objects.filter(agency=agency)})
|
||||
|
||||
# Groups of the Agency
|
||||
groups = Group.objects.all()
|
||||
ag_pk = str(agency.pk)
|
||||
|
|
@ -711,6 +720,7 @@ class AdmImportFlow(TemplateView):
|
|||
for g in groups:
|
||||
if(ag_pk in g.name):
|
||||
ag_groups.append(g)
|
||||
|
||||
context.update({'groups' : ag_groups})
|
||||
|
||||
# LINK TO THE NC-INSTANCE
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ urlpatterns = [
|
|||
path('migrateagencyusers/<int:pk>', views.migrateAgencyUsers, name="api-migrateagencyusers"),
|
||||
path('addgroup/', views.NCAddGroup, name="apiaddgroup"),
|
||||
path('adduser/', views.NCAddUser, name="apiadduser"),
|
||||
|
||||
path('addgf/', views.NCAddGroupFolder, name="apiaddgf"),
|
||||
path('addcloud/', views.NCAddDirsFiles, name="apiaddcloud"),
|
||||
# EXTERNAL FROM NC
|
||||
path('logout/<str:uid>', views.apilogout, name="api-logout"),
|
||||
path('uschanged/<str:uid>/<str:sid>', views.userChangedInNc, name="api-userchanged"),
|
||||
|
|
|
|||
84
api/views.py
84
api/views.py
|
|
@ -173,35 +173,34 @@ def NCAddGroup(request):
|
|||
'Access-Control-Allow-Headers' : 'OCS-APIRequest',
|
||||
'OCS-APIRequest' : 'true'
|
||||
}
|
||||
request_status = False
|
||||
trycounter = 0
|
||||
while(request_status == False or trycounter < 3):
|
||||
data = {
|
||||
"groupid" : newgroupid
|
||||
}
|
||||
r = requests.post(settings.NEXTCLOUD_URL + "ocs/v1.php/cloud/groups", data=data, headers=headers, auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API))
|
||||
r_status = json.loads(r.text)
|
||||
if(r_status['ocs']['meta']['statuscode'] == 100):
|
||||
# Group created, save new group id in Django
|
||||
aggroup.nc_name = newgroupid
|
||||
aggroup.save()
|
||||
data = {
|
||||
"groupid" : newgroupid
|
||||
}
|
||||
r = requests.post(settings.NEXTCLOUD_URL + "ocs/v1.php/cloud/groups", data=data, headers=headers, auth=(settings.NEXTCLOUD_USER_API, settings.NEXTCLOUD_PW_API))
|
||||
r_status = json.loads(r.text)
|
||||
if(r_status['ocs']['meta']['statuscode'] == 100):
|
||||
# Group created, save new group id in Django
|
||||
aggroup.nc_name = newgroupid
|
||||
aggroup.save()
|
||||
|
||||
# Group created, set display name in NC
|
||||
data = {
|
||||
"name": aggroup.agencygroupname,
|
||||
"id" : newgroupid
|
||||
}
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + request.COOKIES['nc_session_id']
|
||||
}
|
||||
r = requests.post(settings.NEXTCLOUD_URL + "apps/agency/regr", data=data, headers=headers)
|
||||
request_status = True
|
||||
return JsonResponse({'status' : True, 'message': 'Gruppe ' + aggroup.agencygroupname + ' erzeugt - ID: ' + newgroupid})
|
||||
else:
|
||||
trycounter += 1
|
||||
newgroupid = create_group_id(aggroup.agencygroupname, agency)
|
||||
# Group created, set display name in NC
|
||||
data = {
|
||||
"name": aggroup.agencygroupname,
|
||||
"id" : newgroupid
|
||||
}
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + request.COOKIES['nc_session_id']
|
||||
}
|
||||
r = requests.post(settings.NEXTCLOUD_URL + "apps/agency/regr", data=data, headers=headers)
|
||||
return JsonResponse({'status' : True, 'message': 'Gruppe ' + aggroup.agencygroupname + ' erzeugt - ID: ' + newgroupid})
|
||||
else:
|
||||
return JsonResponse({'status' : True, 'message': 'Gruppe ' + aggroup.agencygroupname + ' (ID '+aggroup.group.name+') konnte nicht erzeugt werden. Bitte manuell prüfen'})
|
||||
return JsonResponse({"status" : "NO AUTH"})
|
||||
|
||||
|
||||
'''
|
||||
Hier werden die Nutzer angelegt.
|
||||
'''
|
||||
@api_view(['POST'], )
|
||||
def NCAddUser(request):
|
||||
if request.method == "POST":
|
||||
|
|
@ -214,7 +213,8 @@ def NCAddUser(request):
|
|||
for g in user.groups.all():
|
||||
groups.append(AgencyGroup.objects.get(group=g).nc_name)
|
||||
|
||||
password = get_random_password(50)
|
||||
#password = get_random_password(50)
|
||||
password = ""
|
||||
userid = user.username
|
||||
displayName = user.first_name + " " + user.last_name
|
||||
email = user.email
|
||||
|
|
@ -242,4 +242,34 @@ def NCAddUser(request):
|
|||
else:
|
||||
return JsonResponse({'status' : True, 'message': 'Benutzer ' + user.first_name + " " + user.last_name + ' konnte nicht angelegt werden. Bitte manuell prüfen!'})
|
||||
|
||||
return JsonResponse({"status" : "NO AUTH"})
|
||||
|
||||
'''
|
||||
Anlegen des Gruppenordners der Agentur in NC
|
||||
'''
|
||||
@api_view(['POST'], )
|
||||
def NCAddGroupFolder(request):
|
||||
if request.method == "POST":
|
||||
agency = Agency.objects.get(pk=request.POST.get('agencyid'))
|
||||
data = {
|
||||
"gid" : "agencymaingroupid_" + str(agency.pk)
|
||||
}
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + request.COOKIES['nc_session_id']
|
||||
}
|
||||
r = requests.post(settings.NEXTCLOUD_URL + "apps/agency/createagf", data=data, headers=headers)
|
||||
print(r.text)
|
||||
return JsonResponse({'status' : True, 'message': 'Gruppenordner angelegt!'})
|
||||
|
||||
return JsonResponse({"status" : "NO AUTH"})
|
||||
|
||||
'''
|
||||
Hier werden die Dateien und Ordner angelegt und entsprechende Zugriffsrechte der Gruppen gesetzt.
|
||||
'''
|
||||
@api_view(['POST'], )
|
||||
def NCAddDirsFiles(request):
|
||||
if request.method == "POST":
|
||||
agency = Agency.objects.get(pk=request.POST.get('agencyid'))
|
||||
print(agency)
|
||||
pass
|
||||
return JsonResponse({"status" : "NO AUTH"})
|
||||
|
|
@ -201,8 +201,8 @@ def adjust_group_notifications_permission(instance, action, reverse, model, pk_s
|
|||
newnotification = UserNotification(touser=user, notificationtext="Die Gruppe " + group_touched.agencygroupname + " hat neue Rechte erhalten.", notificationtype="groupchanges")
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Gruppenaktivität | Die Gruppe " + group_touched.agencygroupname + " hat neue Rechte erhalten."})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Gruppenaktivität | Die Gruppe " + group_touched.agencygroupname + " hat neue Rechte erhalten."})
|
||||
|
||||
# Rechte wurden entfernt
|
||||
elif(action == "post_remove"):
|
||||
|
|
@ -215,8 +215,8 @@ def adjust_group_notifications_permission(instance, action, reverse, model, pk_s
|
|||
newnotification = UserNotification(touser=user, notificationtext="Der Gruppe " + group_touched.agencygroupname + " wurden Rechte entzogen.", notificationtype="groupchanges")
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Gruppenaktivität | Der Gruppe " + group_touched.agencygroupname + " wurden Rechte entzogen."})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Gruppenaktivität | Der Gruppe " + group_touched.agencygroupname + " wurden Rechte entzogen."})
|
||||
|
||||
# Signal, wenn ein Nutzer aus der Gruppe entfernt/hinzugefügt wird
|
||||
@receiver(signal=m2m_changed, sender=User.groups.through)
|
||||
|
|
@ -231,8 +231,8 @@ def adjust_group_notifications(instance, action, reverse, model, pk_set, using,
|
|||
newnotification = UserNotification(touser=user_touched, notificationtext="Sie wurden aus der Gruppe " + group_touched.agencygroupname + " entfernt.", notificationtype="groupchanges")
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Gruppenaktivität | Sie wurden aus der Gruppe " + group_touched.agencygroupname + " entfernt."})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Gruppenaktivität | Sie wurden aus der Gruppe " + group_touched.agencygroupname + " entfernt."})
|
||||
|
||||
# A USER WAS ADDED TO A GROUP
|
||||
elif(action == 'post_add'):
|
||||
|
|
@ -240,8 +240,8 @@ def adjust_group_notifications(instance, action, reverse, model, pk_set, using,
|
|||
newnotification = UserNotification(touser=user_touched, notificationtext="Sie wurden zur Gruppe " + group_touched.agencygroupname + " hinzugefügt.", notificationtype="groupchanges")
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Gruppenaktivität | Sie wurden zur Gruppe " + group_touched.agencygroupname + " hinzugefügt."})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Gruppenaktivität | Sie wurden zur Gruppe " + group_touched.agencygroupname + " hinzugefügt."})
|
||||
|
||||
# E-MAILNOTIFICATIONS FOR GROUPCHANGES
|
||||
if(user_touched.usernotifications.group_activity_mail):
|
||||
|
|
@ -300,8 +300,8 @@ def save_standard(sender, instance, **kwargs):
|
|||
newnotification = UserNotification(touser=user, notificationtext="Neuer unveröffentlichter Agenturstandard: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Neuer unveröffentlichter Agenturstandard: " + instance.name})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Neuer unveröffentlichter Agenturstandard: " + instance.name})
|
||||
|
||||
if(user.has_perm("users.standardmanager") and user.usernotifications.standard_created_unpub_mail):
|
||||
notificationtext = " es wurde ein neuer unveröffentlichter Agenturstandard erstellt: " + instance.name
|
||||
|
|
@ -339,16 +339,16 @@ def adjust_group_notifications_task(instance, action, reverse, model, pk_set, us
|
|||
newnotification = UserNotification(touser=user_touched, notificationtext="Sie wurden von der Tätigkeit " + taskname + " entfernt.", notificationtype="taskchange")
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Tätigkeitsbereich | Sie wurden von der Tätigkeitn " + instance.name + " entfernt."})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Tätigkeitsbereich | Sie wurden von der Tätigkeitn " + instance.name + " entfernt."})
|
||||
|
||||
# A USER WAS ADDED TO A GROUP
|
||||
elif(action == 'post_add'):
|
||||
newnotification = UserNotification(touser=user_touched, notificationtext="Sie wurden der Tätigkeit " + taskname + " zugeordnet.", notificationtype="taskchange")
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Tätigkeitsbereich | Sie wurden der Tätigkeitn " + instance.name + " zugeordnet."})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user_touched.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Tätigkeitsbereich | Sie wurden der Tätigkeitn " + instance.name + " zugeordnet."})
|
||||
|
||||
# E-MAILNOTIFICATIONS FOR GROUPCHANGES
|
||||
if(user_touched.usernotifications.task_activity_mail):
|
||||
|
|
@ -449,8 +449,8 @@ def newNotifiyPush(mode, instance, mailtext, notifytext, pushtext, notifytype, t
|
|||
newnotification = UserNotification(touser=user, notificationtext=notifytext + instance.name, notificationtype="", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__"+ pushtext + notifytext + instance.name})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__"+ pushtext + notifytext + instance.name})
|
||||
# UPDATED
|
||||
elif(mode == 1):
|
||||
if(update_mail):
|
||||
|
|
@ -461,8 +461,8 @@ def newNotifiyPush(mode, instance, mailtext, notifytext, pushtext, notifytype, t
|
|||
newnotification = UserNotification(touser=user, notificationtext=notifytext + instance.name, notificationtype="", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__" + pushtext + notifytext + instance.name})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__" + pushtext + notifytext + instance.name})
|
||||
#DELETE
|
||||
elif(mode == 2):
|
||||
if(delete_mail):
|
||||
|
|
@ -474,8 +474,8 @@ def newNotifiyPush(mode, instance, mailtext, notifytext, pushtext, notifytype, t
|
|||
newnotification = UserNotification(touser=user, notificationtext=notifytext + instance.name, notificationtype="", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__" + pushtext + notifytext + instance.name})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__" + pushtext + notifytext + instance.name})
|
||||
|
||||
# DIRS
|
||||
@receiver(post_save, sender=DataDir)
|
||||
|
|
@ -741,15 +741,15 @@ def new_chat_message(sender, instance, **kwargs):
|
|||
for u in instance.room.chatmembers.all():
|
||||
if u != instance.author:
|
||||
if u.usernotifications.chat_received_push and u not in sended_users:
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(u.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Chat | Neue Nachricht im Gruppenchat " + instance.room.roomname + " von " + instance.author.first_name + " " + instance.author.last_name + ": " + instance.content})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(u.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Chat | Neue Nachricht im Gruppenchat " + instance.room.roomname + " von " + instance.author.first_name + " " + instance.author.last_name + ": " + instance.content})
|
||||
sended_users.append(u)
|
||||
|
||||
for u in instance.room.chatmembers_admin.all():
|
||||
if u != instance.author:
|
||||
if u.usernotifications.chat_received_push and u not in sended_users:
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(u.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Chat | Neue Nachricht im Gruppenchat " + instance.room.roomname + " von " + instance.author.first_name + " " + instance.author.last_name + ": " + instance.content})
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(u.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Chat | Neue Nachricht im Gruppenchat " + instance.room.roomname + " von " + instance.author.first_name + " " + instance.author.last_name + ": " + instance.content})
|
||||
sended_users.append(u)
|
||||
|
||||
|
||||
|
|
@ -758,8 +758,9 @@ def new_chat_message(sender, instance, **kwargs):
|
|||
u = instance.room.chatmember_single
|
||||
|
||||
if u.usernotifications.chat_received_push and u != instance.author:
|
||||
channel_layer = channels.layers.get_channel_layer()
|
||||
async_to_sync(channel_layer.group_send)("user_" + str(u.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Chat | Neue Nachricht von " + instance.author.first_name + " " + instance.author.last_name + ": " + instance.content})
|
||||
pass
|
||||
#channel_layer = channels.layers.get_channel_layer()
|
||||
#async_to_sync(channel_layer.group_send)("user_" + str(u.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Chat | Neue Nachricht von " + instance.author.first_name + " " + instance.author.last_name + ": " + instance.content})
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue