Allow to add emails to existing conversations

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2020-01-09 17:50:56 +01:00
Родитель 9673991e67
Коммит 8079051b67
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 7076EA9751AACDDA
4 изменённых файлов: 198 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,83 @@
<!--
- @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
-
- @author Joas Schilling <coding@schilljs.com>
-
- @license GNU AGPL version 3 or any later version
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<template>
<ul class="contacts-list">
<AppContentListItem
v-for="item of emails"
:key="item.id"
:title="item.label"
@click="onClick(item)">
<template v-slot:icon>
<ConversationIcon
:item="iconData" />
</template>
</AppContentListItem>
</ul>
</template>
<script>
import ConversationIcon from '../../ConversationIcon'
import AppContentListItem from '../ConversationsList/AppContentListItem/AppContentListItem'
import { CONVERSATION } from '../../../constants'
export default {
name: 'EmailsList',
components: {
ConversationIcon,
AppContentListItem,
},
props: {
emails: {
type: Array,
required: true,
},
isLoading: {
type: Boolean,
default: false,
},
},
computed: {
iconData() {
return {
type: CONVERSATION.TYPE.GROUP,
}
},
},
methods: {
// forward click event
onClick(item) {
this.$emit('click', item)
},
},
}
</script>
<style lang="scss" scoped>
.ellipsis {
text-overflow: ellipsis;
}
.contacts-list {
overflow: visible;
display: block;
}
</style>

Просмотреть файл

@ -0,0 +1,82 @@
<!--
- @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
-
- @author Joas Schilling <coding@schilljs.com>
-
- @license GNU AGPL version 3 or any later version
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<template>
<ul class="contacts-list">
<AppContentListItem
v-for="item of items"
:key="item.id"
:title="item.label"
@click="onClick(item)">
<template v-slot:icon>
<ConversationIcon
:item="iconData" />
</template>
</AppContentListItem>
</ul>
</template>
<script>
import ConversationIcon from './ConversationIcon'
import AppContentListItem from './LeftSidebar/ConversationsList/AppContentListItem/AppContentListItem'
import { CONVERSATION } from '../constants'
export default {
name: 'ParticipantOptionsList',
components: {
ConversationIcon,
AppContentListItem,
},
props: {
items: {
type: Array,
required: true,
},
isLoading: {
type: Boolean,
default: false,
},
},
computed: {
iconData() {
return {
type: CONVERSATION.TYPE.GROUP,
}
},
},
methods: {
// forward click event
onClick(item) {
this.$emit('click', item)
},
},
}
</script>
<style lang="scss" scoped>
.ellipsis {
text-overflow: ellipsis;
}
.contacts-list {
overflow: visible;
display: block;
}
</style>

Просмотреть файл

@ -47,6 +47,14 @@
@click="addParticipants" />
</template>
<template v-if="addableEmails.length !== 0">
<Caption
:title="t('spreed', 'Add emails')" />
<ParticipantOptionsList
:items="addableEmails"
@click="addParticipants" />
</template>
<template v-if="addableCircles.length !== 0">
<Caption
:title="t('spreed', 'Add circles')" />
@ -69,6 +77,7 @@ import CurrentParticipants from './CurrentParticipants/CurrentParticipants'
import Hint from '../../Hint'
import CirclesList from '../../LeftSidebar/CirclesList/CirclesList'
import ContactsList from '../../LeftSidebar/ContactsList/ContactsList'
import ParticipantOptionsList from '../../ParticipantOptionsList'
import GroupsList from '../../LeftSidebar/GroupsList/GroupsList'
import SearchBox from '../../LeftSidebar/SearchBox/SearchBox'
import debounce from 'debounce'
@ -87,6 +96,7 @@ export default {
CurrentParticipants,
CirclesList,
ContactsList,
ParticipantOptionsList,
GroupsList,
SearchBox,
Caption,
@ -199,6 +209,12 @@ export default {
}
return []
},
addableEmails() {
if (this.searchResults !== []) {
return this.searchResults.filter((item) => item.source === 'emails')
}
return []
},
addableCircles() {
if (this.searchResults !== []) {
return this.searchResults.filter((item) => item.source === 'circles')

Просмотреть файл

@ -56,9 +56,24 @@ const fetchConversation = async function(token) {
*/
const searchPossibleConversations = async function(searchText, token) {
token = token || 'new'
const shareTypes = [
SHARE.TYPE.USER,
SHARE.TYPE.GROUP,
SHARE.TYPE.CIRCLE,
]
if (token !== 'new') {
shareTypes.push(SHARE.TYPE.EMAIL)
}
try {
const response = await axios.get(generateOcsUrl('core/autocomplete', 2) + `get` + `?format=json` + `&search=${searchText}` + `&itemType=call` + `&itemId=${token}` + `&shareTypes[]=${SHARE.TYPE.USER}&shareTypes[]=${SHARE.TYPE.GROUP}&shareTypes[]=${SHARE.TYPE.CIRCLE}`)
return response
return await axios.get(generateOcsUrl('core/autocomplete', 2) + `get`, {
params: {
search: searchText,
itemType: 'call',
itemId: token,
shareTypes,
},
})
} catch (error) {
console.debug('Error while searching possible conversations: ', error)
}