Skip to content

Commit

Permalink
Merge pull request #8616 from nextcloud/parse-mailto-links
Browse files Browse the repository at this point in the history
feat: parse mailto addresses
  • Loading branch information
st3iny authored Aug 21, 2023
2 parents f791813 + 6261efc commit e43e34c
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 6 deletions.
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@nextcloud/vue-dashboard": "^2.0.1",
"@riophae/vue-treeselect": "^0.4.0",
"@vue/babel-preset-app": "^5.0.8",
"address-rfc2822": "^2.1.0",
"buffer": "^6.0.3",
"color-convert": "^2.0.1",
"core-js": "^3.31.1",
Expand Down
26 changes: 20 additions & 6 deletions src/components/MailboxThread.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ import { NcAppContent as AppContent, NcAppContentList as AppContentList, NcButto
import isMobile from '@nextcloud/vue/dist/Mixins/isMobile'
import SectionTitle from './SectionTitle'
import Vue from 'vue'
import addressParser from 'address-rfc2822'
import infiniteScroll from '../directives/infinite-scroll'
import IconInfo from 'vue-material-design-icons/Information'
Expand Down Expand Up @@ -269,12 +270,25 @@ export default {
return []
}
return [
{
label: str,
email: str,
},
]
let addresses = []
try {
addresses = addressParser.parse(str)
} catch (error) {
logger.debug('could not parse string into email addresses', { str, error })
}
return addresses.map(address => {
const result = {
label: address.name(),
email: address.address,
}
if (result.label === '') {
result.label = result.email
}
return result
})
},
onUpdateSearchQuery(query) {
this.searchQuery = query
Expand Down

0 comments on commit e43e34c

Please sign in to comment.