mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #3898 from overleaf/as-fix-angular-service-arrow-function
Refactor Angular service method away from an arrow function GitOrigin-RevId: a83d90d0d44a28d1b898aef0490084def3089f47
This commit is contained in:
parent
7288fef34f
commit
2b154e273e
1 changed files with 26 additions and 24 deletions
|
@ -3,31 +3,33 @@
|
|||
*/
|
||||
import App from '../../../base'
|
||||
|
||||
export default App.service('ProjectListService', () => ({
|
||||
getOwnerName(project) {
|
||||
if (project.accessLevel === 'owner') {
|
||||
return 'You'
|
||||
} else if (project.owner != null) {
|
||||
return this.getUserName(project.owner)
|
||||
} else {
|
||||
return 'None'
|
||||
}
|
||||
},
|
||||
|
||||
getUserName(user) {
|
||||
if (user && user._id === window.user_id) {
|
||||
return 'You'
|
||||
} else if (user) {
|
||||
const { first_name, last_name, email } = user
|
||||
if (first_name || last_name) {
|
||||
return [first_name, last_name].filter(n => n != null).join(' ')
|
||||
} else if (email) {
|
||||
return email
|
||||
export default App.service('ProjectListService', function() {
|
||||
return {
|
||||
getOwnerName(project) {
|
||||
if (project.accessLevel === 'owner') {
|
||||
return 'You'
|
||||
} else if (project.owner != null) {
|
||||
return this.getUserName(project.owner)
|
||||
} else {
|
||||
return 'An Overleaf v1 User'
|
||||
return 'None'
|
||||
}
|
||||
},
|
||||
|
||||
getUserName(user) {
|
||||
if (user && user._id === window.user_id) {
|
||||
return 'You'
|
||||
} else if (user) {
|
||||
const { first_name, last_name, email } = user
|
||||
if (first_name || last_name) {
|
||||
return [first_name, last_name].filter(n => n != null).join(' ')
|
||||
} else if (email) {
|
||||
return email
|
||||
} else {
|
||||
return 'An Overleaf v1 User'
|
||||
}
|
||||
} else {
|
||||
return 'None'
|
||||
}
|
||||
} else {
|
||||
return 'None'
|
||||
}
|
||||
}
|
||||
}))
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue