Skip to content

Commit 75c9a2a

Browse files
authored
Merge pull request #48944 from nextcloud/backport/48871/stable29
[stable29] fix(app-store): Update update count in navigation
2 parents 73c31a9 + 87014dc commit 75c9a2a

File tree

10 files changed

+35
-15
lines changed

10 files changed

+35
-15
lines changed

apps/settings/src/components/AppList.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,11 @@
157157

158158
<script>
159159
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
160+
import { useAppsStore } from '../store/apps-store'
160161
import AppItem from './AppList/AppItem.vue'
161162
import pLimit from 'p-limit'
162163
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
164+
import AppManagement from '../mixins/AppManagement'
163165
164166
export default {
165167
name: 'AppList',
@@ -168,13 +170,22 @@ export default {
168170
NcButton,
169171
},
170172
173+
mixins: [AppManagement],
174+
171175
props: {
172176
category: {
173177
type: String,
174178
required: true,
175179
},
176180
},
177181
182+
setup() {
183+
const store = useAppsStore()
184+
return {
185+
store,
186+
}
187+
},
188+
178189
data() {
179190
return {
180191
search: '',
@@ -321,8 +332,9 @@ export default {
321332
const limit = pLimit(1)
322333
this.apps
323334
.filter(app => app.update)
324-
.map(app => limit(() => this.$store.dispatch('updateApp', { appId: app.id })),
325-
)
335+
.map((app) => limit(() => {
336+
this.update(app.id)
337+
}))
326338
},
327339
},
328340
}

apps/settings/src/components/AppList/AppItem.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@
129129
</template>
130130

131131
<script>
132+
import { useAppsStore } from '../../store/apps-store.js'
133+
132134
import AppScore from './AppScore.vue'
133135
import AppLevelBadge from './AppLevelBadge.vue'
134136
import AppManagement from '../../mixins/AppManagement.js'
@@ -169,6 +171,10 @@ export default {
169171
default: false,
170172
},
171173
},
174+
setup() {
175+
const store = useAppsStore()
176+
return { store }
177+
},
172178
data() {
173179
return {
174180
isSelected: false,

apps/settings/src/mixins/AppManagement.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ export default {
138138
},
139139
update(appId) {
140140
this.$store.dispatch('updateApp', { appId })
141-
.then((response) => { rebuildNavigation() })
142141
.catch((error) => { showError(error) })
142+
.then(() => {
143+
rebuildNavigation()
144+
this.store.updateCount = Math.max(this.store.updateCount - 1, 0)
145+
})
143146
},
144147
},
145148
}

apps/settings/src/views/AppStoreNavigation.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
<NcIconSvgWrapper :path="APPSTORE_CATEGORY_ICONS.disabled" />
3232
</template>
3333
</NcAppNavigationItem>
34-
<NcAppNavigationItem v-if="updateCount > 0"
34+
<NcAppNavigationItem v-if="store.updateCount > 0"
3535
id="app-category-updates"
3636
:to="{ name: 'apps-category', params: { category: 'updates' } }"
3737
:name="APPS_SECTION_ENUM.updates">
3838
<template #counter>
39-
<NcCounterBubble>{{ updateCount }}</NcCounterBubble>
39+
<NcCounterBubble>{{ store.updateCount }}</NcCounterBubble>
4040
</template>
4141
<template #icon>
4242
<NcIconSvgWrapper :path="APPSTORE_CATEGORY_ICONS.updates" />
@@ -110,7 +110,6 @@ import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
110110
111111
import APPSTORE_CATEGORY_ICONS from '../constants/AppstoreCategoryIcons.ts'
112112
113-
const updateCount = loadState<number>('settings', 'appstoreUpdateCount', 0)
114113
const appstoreEnabled = loadState<boolean>('settings', 'appstoreEnabled', true)
115114
const developerDocsUrl = loadState<string>('settings', 'appstoreDeveloperDocs', '')
116115

dist/8630-8630.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/8630-8630.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-apps-view-4529.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-apps-view-4529.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-vue-settings-apps-users-management.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-vue-settings-apps-users-management.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)