mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 07:15:25 -05:00
Show the creator as the owner if no owner present
This commit is contained in:
parent
08593f1f4b
commit
d7706f642b
2 changed files with 17 additions and 9 deletions
|
@ -395,19 +395,27 @@ module.exports = ProjectController =
|
|||
return model
|
||||
|
||||
_buildV1ProjectViewModel: (project) ->
|
||||
{
|
||||
projectViewModel = {
|
||||
id: project.id
|
||||
name: project.title
|
||||
lastUpdated: new Date(project.updated_at * 1000) # Convert from epoch
|
||||
accessLevel: if project.owner?.user_is_owner then "owner" else "readOnly"
|
||||
archived: project.removed || project.archived
|
||||
owner: {
|
||||
# Unlisted V1 projects don't have an owner, so just show N/A
|
||||
first_name: if project.owner then project.owner.name else 'N/A'
|
||||
last_name: ''
|
||||
}
|
||||
isV1Project: true
|
||||
}
|
||||
if (project.owner? and project.owner.user_is_owner) or (project.creator? and project.creator.user_is_creator)
|
||||
projectViewModel.accessLevel = "owner"
|
||||
else
|
||||
projectViewModel.accessLevel = "readOnly"
|
||||
if project.owner?
|
||||
projectViewModel.owner = {
|
||||
first_name: project.owner.name
|
||||
}
|
||||
else if project.creator?
|
||||
projectViewModel.owner = {
|
||||
first_name: project.creator.name
|
||||
}
|
||||
return projectViewModel
|
||||
|
||||
|
||||
_injectProjectOwners: (projects, callback = (error, projects) ->) ->
|
||||
users = {}
|
||||
|
|
|
@ -480,9 +480,9 @@ define [
|
|||
if $scope.project.accessLevel == "owner"
|
||||
return "You"
|
||||
else if $scope.project.owner?
|
||||
return "#{$scope.project.owner.first_name} #{$scope.project.owner.last_name}"
|
||||
return [$scope.project.owner.first_name, $scope.project.owner.last_name].filter((n) -> n?).join(" ")
|
||||
else
|
||||
return "?"
|
||||
return "None"
|
||||
|
||||
$scope.$watch "project.selected", (value) ->
|
||||
if value?
|
||||
|
|
Loading…
Reference in a new issue