feat: ability to subscribe to podcast from search list (#105) #106

Merged
Xefir merged 2 commits from search-add-subs into main 2024-05-29 12:18:38 +00:00
2 changed files with 43 additions and 1 deletions

View File

@ -1,3 +1,15 @@
## 2.3.0 - 2024-05-29
### Added
- Ability to subscribe to podcast from search list
[#105](https://git.crystalyx.net/Xefir/repod/issues/105) suggested by @crystalyz
### Changed
- 💀 Drop support for Nextcloud 26
- ⚰️ Drop support for PHP 8.0
- 🔖 Full support for Nextcloud 29
- ⬆️ Update @nextcloud/vue to 8.12.0
## 2.2.1 - 2024-05-18
### Removed

View File

@ -17,14 +17,26 @@
<template #subname>
{{ feed.author }}
</template>
<template #actions>
<NcActionButton
v-if="!isSubscribed"
:name="t('repod', 'Subscribe')"
:title="t('repod', 'Subscribe')"
@click="addSubscription(feed.link)">
<template #icon>
<PlusIcon :size="20" />
</template>
</NcActionButton>
</template>
</NcListItem>
</ul>
</div>
</template>
<script>
import { NcAvatar, NcListItem } from '@nextcloud/vue'
import { NcActionButton, NcAvatar, NcListItem } from '@nextcloud/vue'
import Loading from '../Atoms/Loading.vue'
import PlusIcon from 'vue-material-design-icons/Plus.vue'
import axios from '@nextcloud/axios'
import { debounce } from '../../utils/debounce.js'
import { formatLocaleDate } from '../../utils/time.js'
@ -36,8 +48,10 @@ export default {
name: 'Search',
components: {
Loading,
NcActionButton,
NcAvatar,
NcListItem,
PlusIcon,
},
props: {
value: {
@ -59,6 +73,22 @@ export default {
methods: {
formatLocaleDate,
toUrl,
async addSubscription(url) {
try {
await axios.post(
generateUrl('/apps/gpoddersync/subscription_change/create'),
{
add: [url],
remove: [],
},
)
} catch (e) {
console.error(e)
showError(t('repod', 'Error while adding the feed'))
}
this.$store.dispatch('subscriptions/fetch')
},
search: debounce(async function value() {
try {
this.loading = true