mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-05 23:43:42 +00:00
use generateUniquename to create names with timestamps
This commit is contained in:
parent
a640397052
commit
ad6b3a625a
1 changed files with 5 additions and 2 deletions
|
@ -67,9 +67,12 @@ module.exports = ProjectDetailsHandler =
|
|||
else
|
||||
return callback()
|
||||
|
||||
generateUniqueName: (user_id, name, callback = (error, newName) -> ) ->
|
||||
generateUniqueName: (user_id, name, suffixes = [], callback = (error, newName) -> ) ->
|
||||
if arguments.length is 3 && typeof suffixes is 'function' # make suffixes an optional argument
|
||||
callback = suffixes
|
||||
suffixes = []
|
||||
timestamp = new Date().toISOString().replace(/T(\d+):(\d+):(\d+)\..*/,' $1$2$3') # strip out unwanted characters
|
||||
ProjectDetailsHandler.ensureProjectNameIsUnique user_id, name, [" #{timestamp}"], callback
|
||||
ProjectDetailsHandler.ensureProjectNameIsUnique user_id, name, suffixes.concat(" (#{timestamp})"), callback
|
||||
|
||||
_addSuffixToProjectName: (name, suffix = '') ->
|
||||
# append the suffix and truncate the project title if needed
|
||||
|
|
Loading…
Reference in a new issue