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:
Alasdair Smith 2021-04-14 09:59:20 +01:00 committed by Copybot
parent 7288fef34f
commit 2b154e273e

View file

@ -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'
}
}
}))
})