mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-12 07:30:46 +02:00
Merge pull request #1948 from overleaf/cmg-allow-array-archiving
Make checking for project.archived array-friendly GitOrigin-RevId: 2902a12fb4611a5786d4b10feba534b1cd29668b
This commit is contained in:
committed by
sharelatex
parent
c8140f9641
commit
3422c17dc4
@@ -23,6 +23,7 @@ const projectDeleter = require('./ProjectDeleter')
|
||||
const projectDuplicator = require('./ProjectDuplicator')
|
||||
const projectCreationHandler = require('./ProjectCreationHandler')
|
||||
const editorController = require('../Editor/EditorController')
|
||||
const ProjectHelper = require('./ProjectHelper')
|
||||
const metrics = require('metrics-sharelatex')
|
||||
const { User } = require('../../models/User')
|
||||
const TagsHandler = require('../Tags/TagsHandler')
|
||||
@@ -289,8 +290,8 @@ module.exports = ProjectController = {
|
||||
if (err != null) {
|
||||
return next(err)
|
||||
}
|
||||
projects = ProjectController._buildProjectList(projects)
|
||||
.filter(p => !p.archived)
|
||||
projects = ProjectController._buildProjectList(projects, user_id)
|
||||
.filter(p => !ProjectHelper.isArchived(p, user_id))
|
||||
.filter(p => !p.isV1Project)
|
||||
.map(p => ({ _id: p.id, name: p.name, accessLevel: p.accessLevel }))
|
||||
|
||||
@@ -405,6 +406,7 @@ module.exports = ProjectController = {
|
||||
)
|
||||
const projects = ProjectController._buildProjectList(
|
||||
results.projects,
|
||||
user_id,
|
||||
results.v1Projects != null ? results.v1Projects.projects : undefined
|
||||
)
|
||||
const { user } = results
|
||||
@@ -720,7 +722,7 @@ module.exports = ProjectController = {
|
||||
)
|
||||
},
|
||||
|
||||
_buildProjectList(allProjects, v1Projects) {
|
||||
_buildProjectList(allProjects, userId, v1Projects) {
|
||||
let project
|
||||
if (v1Projects == null) {
|
||||
v1Projects = []
|
||||
@@ -738,7 +740,8 @@ module.exports = ProjectController = {
|
||||
ProjectController._buildProjectViewModel(
|
||||
project,
|
||||
'owner',
|
||||
Sources.OWNER
|
||||
Sources.OWNER,
|
||||
userId
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -748,7 +751,8 @@ module.exports = ProjectController = {
|
||||
ProjectController._buildProjectViewModel(
|
||||
project,
|
||||
'readWrite',
|
||||
Sources.INVITE
|
||||
Sources.INVITE,
|
||||
userId
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -757,7 +761,8 @@ module.exports = ProjectController = {
|
||||
ProjectController._buildProjectViewModel(
|
||||
project,
|
||||
'readOnly',
|
||||
Sources.INVITE
|
||||
Sources.INVITE,
|
||||
userId
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -776,7 +781,8 @@ module.exports = ProjectController = {
|
||||
ProjectController._buildProjectViewModel(
|
||||
project,
|
||||
'readAndWrite',
|
||||
Sources.TOKEN
|
||||
Sources.TOKEN,
|
||||
userId
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -790,7 +796,8 @@ module.exports = ProjectController = {
|
||||
ProjectController._buildProjectViewModel(
|
||||
project,
|
||||
'readOnly',
|
||||
Sources.TOKEN
|
||||
Sources.TOKEN,
|
||||
userId
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -799,7 +806,7 @@ module.exports = ProjectController = {
|
||||
return projects
|
||||
},
|
||||
|
||||
_buildProjectViewModel(project, accessLevel, source) {
|
||||
_buildProjectViewModel(project, accessLevel, source, userId) {
|
||||
TokenAccessHandler.protectTokens(project, accessLevel)
|
||||
const model = {
|
||||
id: project._id,
|
||||
@@ -809,7 +816,7 @@ module.exports = ProjectController = {
|
||||
publicAccessLevel: project.publicAccesLevel,
|
||||
accessLevel,
|
||||
source,
|
||||
archived: !!project.archived,
|
||||
archived: ProjectHelper.isArchived(project, userId),
|
||||
owner_ref: project.owner_ref,
|
||||
tokens: project.tokens,
|
||||
isV1Project: false
|
||||
|
||||
Reference in New Issue
Block a user