python: removed the ability to add mentions for anonymous users

This commit is contained in:
metoou
2021-05-21 17:33:27 +03:00
parent 487adb11a7
commit 97fc45a15c
2 changed files with 5 additions and 4 deletions

View File

@ -56,10 +56,8 @@ def getUserFromReq(req):
return DEFAULT_USER
# get users data for mentions
def getUsersForMentions(req):
uid = req.COOKIES.get('uid')
def getUsersForMentions(uid):
usersData = []
for user in USERS:
if(user.id != uid and user.name != None and user.email != None):
usersData.append({'name':user.name, 'email':user.email})

View File

@ -222,6 +222,9 @@ def edit(request):
'url': docManager.getServerUrl(True, request) + 'csv'
}
# users data for mentions
usersData = users.getUsersForMentions(user.id) if user.id !='uid-0' else None
if jwtManager.isEnabled(): # if the secret key to generate token exists
edConfig['token'] = jwtManager.encode(edConfig) # encode the edConfig object into a token
dataInsertImage['token'] = jwtManager.encode(dataInsertImage) # encode the dataInsertImage object into a token
@ -239,7 +242,7 @@ def edit(request):
'dataInsertImage': json.dumps(dataInsertImage)[1 : len(json.dumps(dataInsertImage)) - 1], # the image which will be inserted into the document
'dataCompareFile': dataCompareFile, # document which will be compared with the current document
'dataMailMergeRecipients': json.dumps(dataMailMergeRecipients), # recipient data for mail merging
'users': json.dumps(users.getUsersForMentions(request))
'users': json.dumps(usersData)
}
return render(request, 'editor.html', context) # execute the "editor.html" template with context data