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' import App from '../../../base'
export default App.service('ProjectListService', () => ({ export default App.service('ProjectListService', function() {
getOwnerName(project) { return {
if (project.accessLevel === 'owner') { getOwnerName(project) {
return 'You' if (project.accessLevel === 'owner') {
} else if (project.owner != null) { return 'You'
return this.getUserName(project.owner) } else if (project.owner != null) {
} else { return this.getUserName(project.owner)
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 { } 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'
} }
} }
})) })