mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-05 19:51:37 +00:00
Merge branch 'master' into master-redesign
This commit is contained in:
commit
99705ebb4f
13 changed files with 76 additions and 31 deletions
|
@ -9,7 +9,7 @@ module.exports =
|
|||
title:"Reset Password"
|
||||
|
||||
requestReset: (req, res)->
|
||||
email = req.body.email.trim()
|
||||
email = req.body.email.trim().toLowerCase()
|
||||
opts =
|
||||
endpointName:"auto_compile"
|
||||
timeInterval:60
|
||||
|
|
|
@ -293,10 +293,6 @@ module.exports = class Router
|
|||
AuthorizationManager.ensureClientCanEditProject client, (error, project_id) =>
|
||||
EditorController.setRootDoc(project_id, newRootDocID, callback)
|
||||
|
||||
client.on 'deleteProject', (callback)->
|
||||
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
||||
EditorController.deleteProject(project_id, callback)
|
||||
|
||||
client.on 'setPublicAccessLevel', (newAccessLevel, callback)->
|
||||
AuthorizationManager.ensureClientCanAdminProject client, (error, project_id) =>
|
||||
EditorController.setPublicAccessLevel(project_id, newAccessLevel, callback)
|
||||
|
|
|
@ -24,6 +24,10 @@ define [
|
|||
hideToggle: () ->
|
||||
@$(".js-toggle").hide()
|
||||
|
||||
makeReadOnly: () ->
|
||||
|
||||
makeReadWrite: () ->
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ define [
|
|||
render: () ->
|
||||
@$el.append(Mustache.to_html @entityTemplate, @model.attributes)
|
||||
@_bindToDomElements()
|
||||
@_makeEditable()
|
||||
@_initializeRenameBox()
|
||||
@_initializeDrag()
|
||||
return @
|
||||
|
||||
_bindToDomElements: () ->
|
||||
|
@ -32,12 +33,6 @@ define [
|
|||
@$entityListItemEl = @$el.children(".entity-list-item")
|
||||
@$labelEl = @$entityListItemEl.children(".entity-label")
|
||||
|
||||
_makeEditable: () ->
|
||||
if @ide.isAllowedToDoIt "readAndWrite"
|
||||
@_initializeRenameBox()
|
||||
@_initializeDrag()
|
||||
@hideRenameBox()
|
||||
|
||||
bindToModel: () ->
|
||||
@model.on "change:name", (model) =>
|
||||
@$nameEl.text(model.get("name"))
|
||||
|
@ -84,7 +79,7 @@ define [
|
|||
onDoubleClick: (e) ->
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
if @ide.isAllowedToDoIt "readAndWrite"
|
||||
if !@readonly
|
||||
@startRename()
|
||||
|
||||
showContextMenuFromCaret: (e) ->
|
||||
|
@ -121,6 +116,7 @@ define [
|
|||
delete @contextMenu
|
||||
|
||||
getContextMenuEntries: () ->
|
||||
return null if @readonly
|
||||
return [{
|
||||
text: "Rename"
|
||||
onClick: () =>
|
||||
|
@ -171,5 +167,13 @@ define [
|
|||
@manager.renameEntity(@model, name)
|
||||
@hideRenameBox()
|
||||
|
||||
makeReadOnly: () ->
|
||||
@$entityListItemEl.draggable("disable")
|
||||
@readonly = true
|
||||
|
||||
makeReadWrite: () ->
|
||||
@$entityListItemEl.draggable("enable")
|
||||
delete @readonly
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ define [
|
|||
@multiSelectedEntities = []
|
||||
@ide.on "afterJoinProject", (@project) =>
|
||||
@populateFileTree()
|
||||
@makeReadWriteIfAllowed()
|
||||
@project_id = @project.id
|
||||
if @ide.editor?.current_doc_id?
|
||||
@openDoc(@ide.editor.current_doc_id)
|
||||
|
@ -312,3 +313,17 @@ define [
|
|||
|
||||
hideDeletedDocs: () ->
|
||||
@deletedDocsView.$el.hide()
|
||||
|
||||
makeReadOnly: () ->
|
||||
for id, view of @views or []
|
||||
view.makeReadOnly?()
|
||||
|
||||
makeReadWrite: () ->
|
||||
for id, view of @views or []
|
||||
view.makeReadWrite?()
|
||||
|
||||
makeReadWriteIfAllowed: () ->
|
||||
if @ide.isAllowedToDoIt("readAndWrite")
|
||||
@makeReadWrite()
|
||||
else
|
||||
@makeReadOnly()
|
||||
|
|
|
@ -123,6 +123,7 @@ define [
|
|||
@showEntries()
|
||||
|
||||
getContextMenuEntries: (args...) ->
|
||||
return null if @readonly
|
||||
entries = EntityView::getContextMenuEntries.apply(this, args)
|
||||
entries.push {
|
||||
divider: true
|
||||
|
|
|
@ -36,8 +36,7 @@ define [
|
|||
type: "project"
|
||||
})
|
||||
@_bindToDomElements()
|
||||
if @ide.isAllowedToDoIt("readAndWrite")
|
||||
@renderActions()
|
||||
@renderActions()
|
||||
@hideRenameBox()
|
||||
@hideToggle()
|
||||
@renderEntries()
|
||||
|
@ -45,8 +44,8 @@ define [
|
|||
return @
|
||||
|
||||
renderActions: () ->
|
||||
actions = $(@actionsTemplate)
|
||||
actions.insertAfter(@$entityListItemEl)
|
||||
@$actions = $(@actionsTemplate)
|
||||
@$actions.insertAfter(@$entityListItemEl)
|
||||
@$(".js-new-entity-menu > a").dropdown()
|
||||
|
||||
onClick: () ->
|
||||
|
@ -61,6 +60,12 @@ define [
|
|||
hideToggle: () ->
|
||||
@$(".js-toggle").hide()
|
||||
|
||||
makeReadOnly: () ->
|
||||
@$actions.hide()
|
||||
|
||||
makeReadWrite: () ->
|
||||
@$actions.show()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -36,11 +36,11 @@ define [
|
|||
owner.set("privileges", "owner")
|
||||
members.add owner
|
||||
|
||||
for rawMember in rawAttributes.members
|
||||
for rawMember in rawAttributes.members or []
|
||||
member = User.findOrBuild rawMember._id, rawMember
|
||||
members.add member
|
||||
|
||||
for doc in rawAttributes.deletedDocs
|
||||
for doc in rawAttributes.deletedDocs or []
|
||||
doc.deleted = true
|
||||
|
||||
attributes.deletedDocs = new Folder({
|
||||
|
|
|
@ -125,11 +125,6 @@ define [
|
|||
@_refreshPdfWhenProjectIsLoaded(opts)
|
||||
|
||||
_refreshPdfWhenProjectIsLoaded: (opts = {}) ->
|
||||
doneCompiling = _.once =>
|
||||
@compiling = false
|
||||
@view.doneCompiling()
|
||||
@syncButtonsView?.show()
|
||||
setTimeout doneCompiling, 1000 * 60
|
||||
|
||||
if !@ide.project.get("rootDoc_id")?
|
||||
new Modal
|
||||
|
@ -145,8 +140,9 @@ define [
|
|||
@compiling = true
|
||||
@_doCompile opts, (error, status, outputFiles) =>
|
||||
@compiling = false
|
||||
doneCompiling()
|
||||
|
||||
@view.doneCompiling()
|
||||
@syncButtonsView?.show()
|
||||
|
||||
if error?
|
||||
@view.updateLog(systemError: true)
|
||||
@view.unsetPdf()
|
||||
|
|
|
@ -38,9 +38,14 @@ define [
|
|||
$("#deleteProject").click (event)=>
|
||||
event.preventDefault()
|
||||
self = @
|
||||
deleteProject = ->
|
||||
self.ide.socket.emit 'deleteProject', ->
|
||||
window.location = '/'
|
||||
deleteProject = =>
|
||||
$.ajax
|
||||
url: "/Project/#{@ide.project_id}",
|
||||
type: 'DELETE'
|
||||
data:
|
||||
_csrf: window.csrfToken
|
||||
success: ->
|
||||
window.location = '/'
|
||||
modalOptions =
|
||||
templateId:'deleteEntityModal'
|
||||
isStatic: false
|
||||
|
|
|
@ -279,7 +279,7 @@ define [
|
|||
@aceEditor.scrollToLine(@firstHiddenChangeAfter.range.end.row, true, false)
|
||||
|
||||
resize: () ->
|
||||
@aceEditor.resize()
|
||||
@aceEditor?.resize()
|
||||
|
||||
return DiffView
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ define [
|
|||
@ide.editor.disable()
|
||||
@ide.fileViewManager.disable()
|
||||
|
||||
@ide.fileTreeManager.makeReadOnly()
|
||||
@ide.fileTreeManager.showDeletedDocs()
|
||||
|
||||
@enable()
|
||||
|
@ -93,9 +94,16 @@ define [
|
|||
@ide.editor.enable()
|
||||
@ide.fileViewManager.enable()
|
||||
@disable()
|
||||
@ide.fileTreeManager.openDoc(@doc_id)
|
||||
|
||||
doc = @ide.fileTreeManager.getEntity(@doc_id, include_deleted: true)
|
||||
if doc? and doc.get("deleted")
|
||||
@ide.fileTreeManager.openDoc(@ide.project.get("rootDoc_id"))
|
||||
else
|
||||
@ide.fileTreeManager.openDoc(@doc_id)
|
||||
|
||||
@ide.tabManager.show "code"
|
||||
@resetLabels()
|
||||
@ide.fileTreeManager.makeReadWriteIfAllowed()
|
||||
@ide.fileTreeManager.hideDeletedDocs()
|
||||
|
||||
autoSelectDiff: () ->
|
||||
|
|
|
@ -63,6 +63,17 @@ describe "PasswordResetController", ->
|
|||
done()
|
||||
@PasswordResetController.requestReset @req, @res
|
||||
|
||||
it "should lowercase the email address", (done)->
|
||||
@email = "UPerCaseEMAIL@example.Com"
|
||||
@req.body.email = @email
|
||||
@RateLimiter.addCount.callsArgWith(1, null, true)
|
||||
@PasswordResetHandler.generateAndEmailResetToken.callsArgWith(1)
|
||||
@res.send = (code)=>
|
||||
code.should.equal 200
|
||||
@PasswordResetHandler.generateAndEmailResetToken.calledWith(@email.toLowerCase()).should.equal true
|
||||
done()
|
||||
@PasswordResetController.requestReset @req, @res
|
||||
|
||||
describe "setNewUserPassword", ->
|
||||
|
||||
it "should tell the user handler to reset the password", (done)->
|
||||
|
|
Loading…
Reference in a new issue