Skip to content

Commit 8b8a55e

Browse files
authored
Merge pull request #4678 from akolson/merge-into-search-recs
Update branch with the latest unstable
2 parents 3d2f924 + 2df4aae commit 8b8a55e

323 files changed

Lines changed: 13307 additions & 5428 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/notify_team_new_comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
env:
2828
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
2929
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
30-
uses: slackapi/slack-github-action@v1.25.0
30+
uses: slackapi/slack-github-action@v1.27.0
3131
with:
3232
payload: |
3333
{

.readthedocs.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Kolibri Studio
22

3-
[![Python tests](https://github.com/learningequality/studio/actions/workflows/pythontest.yml/badge.svg)](https://github.com/learningequality/studio/actions/workflows/pythontest.yml) [![Javascript Tests](https://github.com/learningequality/studio/actions/workflows/frontendtest.yml/badge.svg)](https://github.com/learningequality/studio/actions/workflows/frontendtest.yml) [![codecov](http://codecov.io/github/learningequality/studio/coverage.svg?branch=develop)](http://codecov.io/github/learningequality/studio?branch=develop])
3+
[![Python tests](https://github.com/learningequality/studio/actions/workflows/pythontest.yml/badge.svg)](https://github.com/learningequality/studio/actions/workflows/pythontest.yml) [![Javascript Tests](https://github.com/learningequality/studio/actions/workflows/frontendtest.yml/badge.svg)](https://github.com/learningequality/studio/actions/workflows/frontendtest.yml)
44

55
[Kolibri Studio](https://studio.learningequality.org) is a web application designed to deliver educational materials to [Kolibri](http://learningequality.org/kolibri/). It supports:
66

cloudbuild-production.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ steps:
1111
- -c
1212
- >
1313
docker build
14+
--build_arg COMMIT_SHA=$COMMIT_SHA
1415
-f k8s/images/app/Dockerfile
1516
--cache-from gcr.io/$PROJECT_ID/learningequality-studio-app:latest
1617
-t gcr.io/$PROJECT_ID/learningequality-studio-app:$COMMIT_SHA
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FEEDBACK_TYPE_CHOICES = (
2+
('IMPORTED', 'Imported'),
3+
('REJECTED', 'Rejected'),
4+
('PREVIEWED', 'Previewed'),
5+
('SHOWMORE', 'Show More'),
6+
('IGNORED', 'Ignored'),
7+
('FLAGGED', 'Flagged'),
8+
)

contentcuration/contentcuration/forms.py

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import json
2-
from builtins import object
32

43
from django import forms
54
from django.conf import settings
65
from django.contrib.auth.forms import PasswordResetForm
76
from django.contrib.auth.forms import UserChangeForm
87
from django.contrib.auth.forms import UserCreationForm
98
from django.core import signing
9+
from django.core.exceptions import ValidationError
1010
from django.db.models import Q
1111
from django.template.loader import render_to_string
1212

@@ -16,23 +16,16 @@
1616
REGISTRATION_SALT = getattr(settings, 'REGISTRATION_SALT', 'registration')
1717

1818

19-
class ExtraFormMixin(object):
20-
21-
def check_field(self, field, error):
22-
if not self.cleaned_data.get(field):
23-
self.errors[field] = self.error_class()
24-
self.add_error(field, error)
25-
return False
26-
return self.cleaned_data.get(field)
27-
28-
2919
# LOGIN/REGISTRATION FORMS
3020
#################################################################
31-
class RegistrationForm(UserCreationForm, ExtraFormMixin):
21+
class RegistrationForm(UserCreationForm):
22+
CODE_ACCOUNT_ACTIVE = 'account_active'
23+
CODE_ACCOUNT_INACTIVE = 'account_inactive'
24+
3225
first_name = forms.CharField(required=True)
3326
last_name = forms.CharField(required=True)
34-
email = forms.CharField(required=True)
35-
password1 = forms.CharField(required=True)
27+
email = forms.EmailField(required=True)
28+
password1 = forms.CharField(required=True, min_length=8)
3629
password2 = forms.CharField(required=True)
3730
uses = forms.CharField(required=True)
3831
other_use = forms.CharField(required=False)
@@ -45,22 +38,18 @@ class RegistrationForm(UserCreationForm, ExtraFormMixin):
4538
locations = forms.CharField(required=True)
4639

4740
def clean_email(self):
48-
email = self.cleaned_data['email'].strip().lower()
49-
if User.objects.filter(Q(is_active=True) | Q(deleted=True), email__iexact=email).exists():
50-
raise UserWarning
41+
# ensure email is lower case
42+
email = self.cleaned_data["email"].strip().lower()
43+
user_qs = User.objects.filter(email__iexact=email)
44+
if user_qs.exists():
45+
if user_qs.filter(Q(is_active=True) | Q(deleted=True)).exists():
46+
raise ValidationError("Account already active", code=self.CODE_ACCOUNT_ACTIVE)
47+
else:
48+
raise ValidationError("Already registered.", code=self.CODE_ACCOUNT_INACTIVE)
5149
return email
5250

53-
def clean(self):
54-
super(RegistrationForm, self).clean()
55-
56-
# Errors should be caught on the frontend
57-
# or a warning should be thrown if the account exists
58-
self.errors.clear()
59-
return self.cleaned_data
60-
6151
def save(self, commit=True):
62-
user = super(RegistrationForm, self).save(commit=commit)
63-
user.set_password(self.cleaned_data["password1"])
52+
user = super(RegistrationForm, self).save(commit=False)
6453
user.first_name = self.cleaned_data["first_name"]
6554
user.last_name = self.cleaned_data["last_name"]
6655
user.information = {
@@ -165,7 +154,7 @@ def save(self, user):
165154
return user
166155

167156

168-
class StorageRequestForm(forms.Form, ExtraFormMixin):
157+
class StorageRequestForm(forms.Form):
169158
# Nature of content
170159
storage = forms.CharField(required=True)
171160
kind = forms.CharField(required=True)
@@ -194,7 +183,7 @@ class Meta:
194183
"audience", "import_count", "location", "uploading_for", "organization_type", "time_constraint", "message")
195184

196185

197-
class IssueReportForm(forms.Form, ExtraFormMixin):
186+
class IssueReportForm(forms.Form):
198187
operating_system = forms.CharField(required=True)
199188
browser = forms.CharField(required=True)
200189
channel = forms.CharField(required=False)
@@ -204,7 +193,7 @@ class Meta:
204193
fields = ("operating_system", "browser", "channel", "description")
205194

206195

207-
class DeleteAccountForm(forms.Form, ExtraFormMixin):
196+
class DeleteAccountForm(forms.Form):
208197
email = forms.CharField(required=True)
209198

210199
def __init__(self, user, *args, **kwargs):
@@ -214,5 +203,5 @@ def __init__(self, user, *args, **kwargs):
214203
def clean_email(self):
215204
email = self.cleaned_data['email'].strip().lower()
216205
if self.user.is_admin or self.user.email.lower() != self.cleaned_data['email']:
217-
raise UserWarning
206+
raise ValidationError("Not allowed")
218207
return email
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<template>
2+
3+
<KCard
4+
class="recommended-resource-card"
5+
:to="to"
6+
:title="title"
7+
layout="horizontal"
8+
:headingLevel="headingLevel"
9+
thumbnailScaleType="contain"
10+
thumbnailDisplay="small"
11+
thumbnailAlign="right"
12+
:thumbnailSrc="thumbnailSrc"
13+
:style="{ margin: '16px 0 16px 0' }"
14+
>
15+
<template #aboveTitle>
16+
<div>
17+
<KIcon
18+
icon="practiceSolid"
19+
/>
20+
<span>Practice</span>
21+
</div>
22+
</template>
23+
<template #title>
24+
</template>
25+
<template #belowTitle>
26+
<div class="bellow-title-style">
27+
<p>
28+
below title slot section for the KCard component:
29+
below title slot section for the KCard component
30+
</p>
31+
</div>
32+
</template>
33+
<template #footer>
34+
<div class="align-right-style">
35+
<KIconButton icon="openNewTab" class="card-icon-size" />
36+
<KIconButton icon="thumbDown" class="card-icon-size" />
37+
</div>
38+
</template>
39+
</KCard>
40+
41+
</template>
42+
43+
44+
<script>
45+
46+
export default {
47+
name: 'RecommendedResourceCard',
48+
props: {
49+
to: {
50+
type: Object,
51+
required: true,
52+
},
53+
title: {
54+
type: String,
55+
default: null,
56+
},
57+
headingLevel: {
58+
type: Number,
59+
required: true,
60+
},
61+
thumbnailSrc: {
62+
type: String,
63+
default: null,
64+
},
65+
},
66+
};
67+
68+
</script>
69+
70+
71+
<style>
72+
.align-right-style{
73+
display: flex;
74+
justify-content: flex-end;
75+
}
76+
.recommended-resource-card {
77+
max-width:400px
78+
}
79+
</style>

0 commit comments

Comments
 (0)