mirror of https://github.com/Chocobozzz/PeerTube
Avoid follow SQL conflicts
parent
db84cf89bc
commit
ab4d4db44a
|
@ -7,7 +7,8 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
|
||||||
import { VideoService } from '@app/shared/video/video.service'
|
import { VideoService } from '@app/shared/video/video.service'
|
||||||
import { FeedFormat } from '../../../../../shared/models/feeds'
|
import { FeedFormat } from '../../../../../shared/models/feeds'
|
||||||
import { Account } from '@app/shared/account/account.model'
|
import { Account } from '@app/shared/account/account.model'
|
||||||
import { forkJoin, merge } from 'rxjs'
|
import { concat, forkJoin, merge } from 'rxjs'
|
||||||
|
import { toArray } from 'rxjs/operators'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'my-subscribe-button',
|
selector: 'my-subscribe-button',
|
||||||
|
@ -82,12 +83,14 @@ export class SubscribeButtonComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
localSubscribe () {
|
localSubscribe () {
|
||||||
|
const subscribedStatus = this.subscribeStatus(false)
|
||||||
|
|
||||||
const observableBatch = this.videoChannels
|
const observableBatch = this.videoChannels
|
||||||
.map(videoChannel => this.getChannelHandler(videoChannel))
|
.map(videoChannel => this.getChannelHandler(videoChannel))
|
||||||
.filter(handle => this.subscribeStatus(false).includes(handle))
|
.filter(handle => subscribedStatus.includes(handle))
|
||||||
.map(handle => this.userSubscriptionService.addSubscription(handle))
|
.map(handle => this.userSubscriptionService.addSubscription(handle))
|
||||||
|
|
||||||
merge(observableBatch, 2)
|
forkJoin(observableBatch)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
() => {
|
() => {
|
||||||
this.notifier.success(
|
this.notifier.success(
|
||||||
|
@ -116,25 +119,27 @@ export class SubscribeButtonComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
localUnsubscribe () {
|
localUnsubscribe () {
|
||||||
|
const subscribeStatus = this.subscribeStatus(true)
|
||||||
|
|
||||||
const observableBatch = this.videoChannels
|
const observableBatch = this.videoChannels
|
||||||
.map(videoChannel => this.getChannelHandler(videoChannel))
|
.map(videoChannel => this.getChannelHandler(videoChannel))
|
||||||
.filter(handle => this.subscribeStatus(true).includes(handle))
|
.filter(handle => subscribeStatus.includes(handle))
|
||||||
.map(handle => this.userSubscriptionService.deleteSubscription(handle))
|
.map(handle => this.userSubscriptionService.deleteSubscription(handle))
|
||||||
|
|
||||||
forkJoin(observableBatch)
|
concat(...observableBatch)
|
||||||
.subscribe(
|
.subscribe({
|
||||||
() => {
|
complete: () => {
|
||||||
this.notifier.success(
|
this.notifier.success(
|
||||||
this.account
|
this.account
|
||||||
? this.i18n('Unsubscribed from all channels of {{nameWithHost}}', { nameWithHost: this.account.nameWithHost })
|
? this.i18n('Unsubscribed from all channels of {{nameWithHost}}', { nameWithHost: this.account.nameWithHost })
|
||||||
: this.i18n('Unsubscribed from {{nameWithHost}}', { nameWithHost: this.videoChannels[0].nameWithHost })
|
: this.i18n('Unsubscribed from {{nameWithHost}}', { nameWithHost: this.videoChannels[ 0 ].nameWithHost })
|
||||||
,
|
,
|
||||||
this.i18n('Unsubscribed')
|
this.i18n('Unsubscribed')
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
||||||
err => this.notifier.error(err.message)
|
error: err => this.notifier.error(err.message)
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
isUserLoggedIn () {
|
isUserLoggedIn () {
|
||||||
|
@ -176,15 +181,15 @@ export class SubscribeButtonComponent implements OnInit {
|
||||||
for (const videoChannel of this.videoChannels) {
|
for (const videoChannel of this.videoChannels) {
|
||||||
const handle = this.getChannelHandler(videoChannel)
|
const handle = this.getChannelHandler(videoChannel)
|
||||||
this.subscribed.set(handle, false)
|
this.subscribed.set(handle, false)
|
||||||
|
|
||||||
merge(
|
merge(
|
||||||
this.userSubscriptionService.listenToSubscriptionCacheChange(handle),
|
this.userSubscriptionService.listenToSubscriptionCacheChange(handle),
|
||||||
this.userSubscriptionService.doesSubscriptionExist(handle)
|
this.userSubscriptionService.doesSubscriptionExist(handle)
|
||||||
)
|
).subscribe(
|
||||||
.subscribe(
|
res => this.subscribed.set(handle, res),
|
||||||
res => this.subscribed.set(handle, res),
|
|
||||||
|
|
||||||
err => this.notifier.error(err.message)
|
err => this.notifier.error(err.message)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ const JOB_CONCURRENCY: { [id in (JobType | 'video-file')]: number } = {
|
||||||
'activitypub-http-broadcast': 1,
|
'activitypub-http-broadcast': 1,
|
||||||
'activitypub-http-unicast': 5,
|
'activitypub-http-unicast': 5,
|
||||||
'activitypub-http-fetcher': 1,
|
'activitypub-http-fetcher': 1,
|
||||||
'activitypub-follow': 3,
|
'activitypub-follow': 1,
|
||||||
'video-file-import': 1,
|
'video-file-import': 1,
|
||||||
'video-transcoding': 1,
|
'video-transcoding': 1,
|
||||||
'video-file': 1,
|
'video-file': 1,
|
||||||
|
|
Loading…
Reference in New Issue