mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-06 06:41:05 +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
|
else
|
||||||
return callback()
|
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
|
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 = '') ->
|
_addSuffixToProjectName: (name, suffix = '') ->
|
||||||
# append the suffix and truncate the project title if needed
|
# append the suffix and truncate the project title if needed
|
||||||
|
|
Loading…
Reference in a new issue