Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/components/LeftSidebar/ConversationsList/Conversation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@

<ActionSeparator />

<ActionButton v-if="canLeaveConversation"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong permission check

:icon="iconArchive"
@click.prevent.exact="toggleArchiveConversation">
{{ labelArchive }}
</ActionButton>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is a purely moderator option it should go into the moderator menu?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's only a moderator option.
Everybody should archiv a room to have a cleaner room list.
But wait, this is not possible with this setup. This needs to be done on a user basis.
So maybe I don't understand the aim here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A per user archiving is way over the top from my pov.

<ActionButton v-if="canLeaveConversation"
:icon="iconLeaveConversation"
@click.prevent.exact="leaveConversation">
Expand Down Expand Up @@ -137,6 +142,7 @@ export default {
type: 0,
displayName: '',
isFavorite: false,
isArchived: false,
notificationLevel: 0,
lastMessage: {},
}
Expand Down Expand Up @@ -164,6 +170,14 @@ export default {
return this.item.isFavorite ? t('spreed', 'Remove from favorites') : t('spreed', 'Add to favorites')
},

iconArchive() {
return this.item.isArchived ? 'icon-star-dark' : 'icon-starred'
},

labelArchive() {
return this.item.isArchived ? t('spreed', 'Remove from archive') : t('spreed', 'Archive conversation')
},

isNotifyAlways() {
return this.item.notificationLevel === PARTICIPANT.NOTIFY.ALWAYS
},
Expand Down Expand Up @@ -345,6 +359,9 @@ export default {
}
}
},
async toggleArchiveConversation() {
this.$store.dispatch('toggleArchive', this.item)
},
async toggleFavoriteConversation() {
this.$store.dispatch('toggleFavorite', this.item)
},
Expand Down
13 changes: 13 additions & 0 deletions src/components/LeftSidebar/LeftSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
@abort-search="abortSearch" />
<NewGroupConversation
v-if="canStartConversations" />
<ActionButton
icon="icon-filter"
:close-after-click="true"
@click.stop="showArchived=!showArchived" />
</div>
<template #list class="left-sidebar__list">
<Caption v-if="isSearching"
Expand Down Expand Up @@ -119,6 +123,7 @@ import { CONVERSATION } from '../../constants'
import { loadState } from '@nextcloud/initial-state'
import NewGroupConversation from './NewGroupConversation/NewGroupConversation'
import arrowNavigation from '../../mixins/arrowNavigation'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'

export default {

Expand All @@ -132,6 +137,7 @@ export default {
Hint,
SearchBox,
NewGroupConversation,
ActionButton,
},

mixins: [
Expand All @@ -149,6 +155,7 @@ export default {
isCirclesEnabled: loadState('talk', 'circles_enabled'),
canStartConversations: loadState('talk', 'start_conversations'),
initialisedConversations: false,
showArchived: false,
}
},

Expand All @@ -161,6 +168,12 @@ export default {
conversations = conversations.filter(conversation => conversation.displayName.toLowerCase().indexOf(lowerSearchText) !== -1 || conversation.name.toLowerCase().indexOf(lowerSearchText) !== -1)
}

console.log(conversations)
conversations.forEach(conversation => console.log(conversation.isArchived))
if (this.showArchived === false) {
conversations = conversations.filter(conversation => conversation.isArchived == undefined || conversation.isArchived === false)
}

return conversations.sort(this.sortConversations)
},

Expand Down
16 changes: 16 additions & 0 deletions src/store/conversationsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,22 @@ const actions = {
commit('addConversation', conversation)
},

async toggleArchive({ commit, getters }, { token, isArchived }) {
const conversation = Object.assign({}, getters.conversations[token])
if (!conversation) {
return
}

// if (isArchived) {
// await DearchiveConversation(token)
// } else {
// await archiveConversation(token)
// }
conversation.isArchived = !isArchived

commit('addConversation', conversation)
},

async toggleLobby({ commit, getters }, { token, enableLobby }) {
const conversation = Object.assign({}, getters.conversations[token])
if (!conversation) {
Expand Down