Skip to content

Commit 07dde98

Browse files
authored
Merge pull request #4581 from bjester/covid-free
Remove pinned covid channel collection
2 parents b10e013 + 7d91bad commit 07dde98

File tree

4 files changed

+0
-133
lines changed

4 files changed

+0
-133
lines changed

contentcuration/contentcuration/frontend/channelList/views/Channel/CatalogFilterBar.vue

-95
Original file line numberDiff line numberDiff line change
@@ -19,68 +19,6 @@
1919
@click="clearFilters"
2020
/>
2121
</div>
22-
<div v-else>
23-
<VLayout row wrap>
24-
<VFlex
25-
v-for="collection in collections"
26-
:key="`public-collection-${collection.id}`"
27-
xs12
28-
class="py-2"
29-
>
30-
<VCard
31-
tabindex="0"
32-
class="pt-2"
33-
data-test="collection"
34-
@click="setCollection(collection.id)"
35-
@keyup.enter="setCollection(collection.id)"
36-
>
37-
<VLayout>
38-
<div class="px-2 text-xs-center">
39-
<Icon style="font-size: 75px;">
40-
local_hospital
41-
</Icon>
42-
</div>
43-
<VCardTitle primary-title class="pb-2 pt-2">
44-
45-
<!-- TODO: add 'notranslate' class once we figure out how to handle collections
46-
that have multiple channel languages inside -->
47-
<h3 class="headline mb-0">
48-
{{ collection.name }}
49-
</h3>
50-
<p class="body-1 grey--text">
51-
{{ $tr('channelCount', { count: collection.count }) }}
52-
</p>
53-
<p v-if="collection.description">
54-
{{ collection.description }}
55-
</p>
56-
</VCardTitle>
57-
</VLayout>
58-
<VCardActions>
59-
<VSpacer />
60-
<IconButton
61-
icon="copy"
62-
:text="$tr('copyToken')"
63-
@click.stop="displayToken = collection.token"
64-
/>
65-
</VCardActions>
66-
</VCard>
67-
</VFlex>
68-
</VLayout>
69-
70-
<KModal
71-
v-if="displayToken"
72-
:title="$tr('copyTitle')"
73-
:text="$tr('copyTokenInstructions')"
74-
:cancelText="$tr('close')"
75-
@cancel="displayToken = null"
76-
>
77-
<div class="mb-3">
78-
{{ $tr('copyTokenInstructions') }}
79-
</div>
80-
<CopyToken :token="displayToken" />
81-
</KModal>
82-
83-
</div>
8422
</VContainer>
8523

8624
</template>
@@ -90,10 +28,6 @@
9028
import flatten from 'lodash/flatten'; // Tests fail with native Array.flat() method
9129
import { catalogFilterMixin } from './mixins';
9230
import { constantsTranslationMixin } from 'shared/mixins';
93-
import IconButton from 'shared/views/IconButton';
94-
import CopyToken from 'shared/views/CopyToken';
95-
96-
const publicCollections = window.publicCollections || [];
9731
9832
/*
9933
Returns the expected format for filters
@@ -108,16 +42,7 @@
10842
10943
export default {
11044
name: 'CatalogFilterBar',
111-
components: {
112-
IconButton,
113-
CopyToken,
114-
},
11545
mixins: [constantsTranslationMixin, catalogFilterMixin],
116-
data() {
117-
return {
118-
displayToken: null,
119-
};
120-
},
12146
computed: {
12247
currentFilters() {
12348
return flatten([
@@ -150,24 +75,10 @@
15075
createFilter(this.coach, this.$tr('coachContent'), this.resetCoach),
15176
createFilter(this.assessments, this.$tr('assessments'), this.resetAssessments),
15277
createFilter(this.subtitles, this.$tr('subtitles'), this.resetSubtitles),
153-
createFilter(this.collection, this.getCollectionName(), this.resetCollection),
15478
]).filter(Boolean);
15579
},
156-
collections() {
157-
return publicCollections;
158-
},
15980
},
16081
methods: {
161-
getCollectionName() {
162-
const collection = this.collections.find(c => c.id === this.collection);
163-
return collection && collection.name;
164-
},
165-
setCollection(collectionId) {
166-
this.collection = collectionId;
167-
},
168-
resetCollection() {
169-
this.setCollection(null);
170-
},
17182
resetKeywords() {
17283
this.keywords = '';
17384
},
@@ -200,12 +111,6 @@
200111
subtitles: 'Subtitles',
201112
starred: 'Starred',
202113
clearAll: 'Clear all',
203-
channelCount: '{count, plural,\n =1 {# channel}\n other {# channels}}',
204-
copyToken: 'Copy collection token',
205-
copyTitle: 'Copy collection token',
206-
copyTokenInstructions:
207-
'Paste this token into Kolibri to import the channels contained in this collection',
208-
close: 'Close',
209114
},
210115
};
211116

contentcuration/contentcuration/frontend/channelList/views/Channel/__tests__/catalogFilterBar.spec.js

-19
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,6 @@ describe('catalogFilterBar', () => {
3535
wrapper = makeWrapper();
3636
});
3737

38-
describe('public collections', () => {
39-
it('should list collections if no filters are selected', () => {
40-
expect(wrapper.find('[data-test="collection"]').exists()).toBe(true);
41-
});
42-
it('should filter by collection if one on click', () => {
43-
wrapper.find('[data-test="collection"]').trigger('click');
44-
expect(wrapper.vm.collection).toBe(collection.id);
45-
});
46-
});
47-
4838
describe('removing filters', () => {
4939
beforeEach(() => {
5040
Object.entries(query).forEach(([key, val]) => {
@@ -75,15 +65,6 @@ describe('catalogFilterBar', () => {
7565
expect(wrapper.vm.$route.query.languages).toBeTruthy();
7666
expect(wrapper.vm.$route.query.keywords).toBeTruthy();
7767
});
78-
it('removing collection filter should remove it from the query', () => {
79-
wrapper.vm.resetCollection();
80-
expect(wrapper.vm.$route.query.collection).toBeUndefined();
81-
82-
// Make sure other queries weren't affected
83-
expect(wrapper.vm.$route.query.coach).toBeTruthy();
84-
expect(wrapper.vm.$route.query.languages).toBeTruthy();
85-
expect(wrapper.vm.$route.query.keywords).toBeTruthy();
86-
});
8768
it('removing list-based filter should only remove that item from the query', () => {
8869
wrapper.vm.removeLanguage('en');
8970
expect(wrapper.vm.$route.query.languages).toBe('es');

contentcuration/contentcuration/templates/channel_list.html

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
var publicLanguages = JSON.parse({{ public_languages | safe }});
3232
var publicLicenses = JSON.parse({{ public_licenses | safe }});
3333
var publicKinds = JSON.parse({{ public_kinds | safe }});
34-
var publicCollections = JSON.parse({{ public_collections | safe }});
3534
</script>
3635
{% render_bundle 'channel_list' 'js' %}
3736

contentcuration/contentcuration/views/base.py

-18
Original file line numberDiff line numberDiff line change
@@ -263,23 +263,6 @@ def channel_list(request):
263263
kinds = list(public_kind_query)
264264
cache.set(PUBLIC_CHANNELS_CACHE_KEYS["kinds"], json_for_parse_from_data(kinds), None)
265265

266-
# Get public channel sets
267-
collections = cache.get(PUBLIC_CHANNELS_CACHE_KEYS["collections"])
268-
if collections is None:
269-
public_channelset_query = ChannelSet.objects.filter(public=True).annotate(
270-
count=SQCountDistinct(
271-
Channel.objects.filter(
272-
secret_tokens=OuterRef("secret_token"),
273-
public=True,
274-
main_tree__published=True,
275-
deleted=False,
276-
).values_list("id", flat=True),
277-
field="id",
278-
)
279-
)
280-
cache.set(PUBLIC_CHANNELS_CACHE_KEYS["collections"], json_for_parse_from_serializer(
281-
PublicChannelSetSerializer(public_channelset_query, many=True)), None)
282-
283266
return render(
284267
request,
285268
"channel_list.html",
@@ -291,7 +274,6 @@ def channel_list(request):
291274
"public_languages": languages,
292275
"public_kinds": kinds,
293276
"public_licenses": licenses,
294-
"public_collections": collections,
295277
},
296278
)
297279

0 commit comments

Comments
 (0)