mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-02 07:47:32 +00:00
Merge pull request #5034 from haiwen/onlyoffice-co-editing-change-name
can change name when anonymous user edit file
This commit is contained in:
commit
fa4bdcec3c
@ -171,13 +171,22 @@ def get_onlyoffice_dict(request, username, repo_id, file_path, file_id='',
|
||||
"customization": {
|
||||
"forcesave": ONLYOFFICE_FORCE_SAVE,
|
||||
},
|
||||
"user": {
|
||||
"id": username,
|
||||
"name": email2nickname(username)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if request.user.is_authenticated:
|
||||
user_dict = {
|
||||
"id": username,
|
||||
"name": email2nickname(username)
|
||||
}
|
||||
config['editorConfig']['user'] = user_dict
|
||||
else:
|
||||
anonymous_dict = {
|
||||
"request": True,
|
||||
"label": "Guest"
|
||||
}
|
||||
config['editorConfig']['customization']['anonymous'] = anonymous_dict
|
||||
|
||||
return_dict['onlyoffice_jwt_token'] = jwt.encode(config, ONLYOFFICE_JWT_SECRET)
|
||||
|
||||
return return_dict
|
||||
|
@ -44,11 +44,19 @@ html, body { padding:0; margin:0; height:100%; }
|
||||
"mode": {% if can_edit %}"edit"{% else %}"view"{% endif %},
|
||||
"customization": {
|
||||
"forcesave": {% if onlyoffice_force_save %}true{% else %}false{% endif %},
|
||||
{% if not request.user.is_authenticated %}
|
||||
"anonymous": {
|
||||
"request": true,
|
||||
"label": "Guest"
|
||||
},
|
||||
{% endif %}
|
||||
},
|
||||
{% if request.user.is_authenticated %}
|
||||
"user": {
|
||||
"id": "{{ username|escapejs }}",
|
||||
"name": "{{ username|email2nickname|escapejs }}"
|
||||
}
|
||||
{% endif %}
|
||||
}
|
||||
};
|
||||
var docEditor = new DocsAPI.DocEditor("placeholder", config);
|
||||
|
Loading…
Reference in New Issue
Block a user