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 ## 2.2.1 - 2024-05-18
### Removed ### Removed

View File

@ -17,14 +17,26 @@
<template #subname> <template #subname>
{{ feed.author }} {{ feed.author }}
</template> </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> </NcListItem>
</ul> </ul>
</div> </div>
</template> </template>
<script> <script>
import { NcAvatar, NcListItem } from '@nextcloud/vue' import { NcActionButton, NcAvatar, NcListItem } from '@nextcloud/vue'
import Loading from '../Atoms/Loading.vue' import Loading from '../Atoms/Loading.vue'
import PlusIcon from 'vue-material-design-icons/Plus.vue'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import { debounce } from '../../utils/debounce.js' import { debounce } from '../../utils/debounce.js'
import { formatLocaleDate } from '../../utils/time.js' import { formatLocaleDate } from '../../utils/time.js'
@ -36,8 +48,10 @@ export default {
name: 'Search', name: 'Search',
components: { components: {
Loading, Loading,
NcActionButton,
NcAvatar, NcAvatar,
NcListItem, NcListItem,
PlusIcon,
}, },
props: { props: {
value: { value: {
@ -59,6 +73,22 @@ export default {
methods: { methods: {
formatLocaleDate, formatLocaleDate,
toUrl, 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() { search: debounce(async function value() {
try { try {
this.loading = true this.loading = true