Skip to content

Commit f7fbd7e

Browse files
committed
Merge branch 'master' into issue1516
2 parents 8c7369c + ef35004 commit f7fbd7e

File tree

17 files changed

+1655
-1065
lines changed

17 files changed

+1655
-1065
lines changed

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ jobs:
4545
- name: Pull docker images
4646
run: docker compose -f docker-compose.test.yml pull
4747

48-
- uses: jpribyl/[email protected]
49-
continue-on-error: true
50-
5148
- name: Build base image
5249
run: make -C docker
5350

.gitignore

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,18 @@
11
freesound-data
2-
*.project
3-
*.pydevproject
42
*.pyc
53
*~
64
*.DS_Store
7-
*settings_local.py
8-
\#*\#
9-
*.settings*
10-
utils/search/config*/data
11-
.amateras
125
freesound/local_settings.py
13-
logger.ini
146
_docs/api/build/
15-
*.initial_data.json
16-
*.settings.py
17-
*beta_release_mails.json
18-
*usernames_passwords.csv
19-
*jmeter.log
20-
*jmeter.jtl
21-
_sandbox/load_testing/results/
22-
_docs/freesound_logo/white background - red - black/freesound_logo_tshirt.ai
23-
freesound.komodoproject
247
.idea/
258
.env
26-
see_last_email
27-
build_static.sh
28-
create_caches.sh
29-
run_tests.sh
30-
clear_cache.sh
319
.venv
3210

33-
# BW fornt end
11+
# BW frontend
3412
.cache
3513
node_modules
3614
freesound/static/bw-frontend/dist/
3715
bw_static/
3816
npm-debug.log
3917
color-theme.scss
4018
dist-dark
41-

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Below are instructions for setting up a local Freesound installation for develop
7474
# or if the above command does not work, try this one
7575
docker compose run --rm --no-TTY db psql -h db -U freesound -d freesound < freesound-data/db_dev_dump/freesound-small-dev-dump-2023-09.sql
7676

77+
If you a prompted for a password, use `localfreesoundpgpassword`, this is defined in the `docker-compose.yml` file.
78+
7779
10. Update database by running Django migrations
7880

7981
docker compose run --rm web python manage.py migrate
@@ -84,7 +86,7 @@ Below are instructions for setting up a local Freesound installation for develop
8486

8587
12. Install static build dependencies
8688

87-
docker compose run --rm web npm install --force
89+
docker compose run --rm web npm install
8890

8991
13. Build static files. Note that this step will need to be re-run every time there are changes in Freesound's static code (JS, CSS and static media files).
9092

accounts/admin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,10 @@ class FreesoundUserAdmin(DjangoObjectActions, UserAdmin):
140140
('Personal info', {'fields': ('email', )}),
141141
('Permissions', {'fields': ('is_active', 'is_staff', 'is_superuser', 'groups')}),
142142
('Important dates', {'fields': ('last_login', 'date_joined')}),
143-
)
143+
)
144+
add_fieldsets = (
145+
(None, {'fields': ('username', 'email', 'password1', 'password2')}),
146+
)
144147

145148
paginator = LargeTablePaginator
146149

accounts/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def __init__(self, request, *args, **kwargs):
363363
% (settings.USERNAME_CHANGE_MAX_TIMES - self.n_times_changed_username,
364364
's' if (settings.USERNAME_CHANGE_MAX_TIMES - self.n_times_changed_username) != 1 else '')
365365
else:
366-
help_text = "You already changed your username the maximum times allowed"
366+
help_text = "You have already changed your username the maximum number of times allowed"
367367
self.fields['username'].disabled = True
368368
self.fields['username'].help_text += " " + help_text
369369

accounts/tests/test_upload.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ def test_bulk_describe_view_permissions(self):
234234
resp = self.client.get(reverse('accounts-bulk-describe', args=[bulk.id]))
235235
self.assertEqual(resp.status_code, 200) # After login, page loads normally (200 OK)
236236

237-
User.objects.create_user("testuser2", password="testpass", email='[email protected]')
238-
self.client.login(username='testuser2', password='testpass')
237+
user = User.objects.create_user("testuser2", email='[email protected]')
238+
self.client.force_login(user)
239239
resp = self.client.get(reverse('accounts-bulk-describe', args=[bulk.id]))
240240
self.assertEqual(resp.status_code, 404) # User without permission (not owner of object) gets 404
241241

accounts/tests/test_user.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,8 @@ def test_change_username_creates_old_username(self):
921921
@override_settings(USERNAME_CHANGE_MAX_TIMES=2)
922922
def test_change_username_form_profile_page(self):
923923
# Create user and login
924-
userA = User.objects.create_user('userA', email='[email protected]', password='testpass')
925-
self.client.login(username='userA', password='testpass')
924+
userA = User.objects.create_user('userA', email='[email protected]')
925+
self.client.force_login(userA)
926926

927927
# Test save profile without changing username (note we set all mandatory fields)
928928
resp = self.client.post(reverse('accounts-edit'), data={'profile-username': ['userA'], 'profile-ui_theme_preference': 'f'})
@@ -990,11 +990,11 @@ def test_change_username_mark_sounds_dirty(self):
990990

991991
@override_settings(USERNAME_CHANGE_MAX_TIMES=2)
992992
def test_change_username_form_admin(self):
993-
User.objects.create_user('superuser', password='testpass', is_superuser=True, is_staff=True)
994-
self.client.login(username='superuser', password='testpass')
993+
superuser = User.objects.create_user('superuser', is_superuser=True, is_staff=True)
994+
self.client.force_login(superuser)
995995

996996
# Create user and get admin change url
997-
userA = User.objects.create_user('userA', email='[email protected]', password='testpass')
997+
userA = User.objects.create_user('userA', email='[email protected]')
998998
admin_change_url = reverse('admin:auth_user_change', args=[userA.id])
999999

10001000
post_data = {'username': 'userA',
@@ -1068,8 +1068,8 @@ def test_change_username_case_insensitiveness(self):
10681068
OldUsername entry because usernames should be treated as case insensitive.
10691069
"""
10701070
# Create user and login
1071-
userA = User.objects.create_user('userA', email='[email protected]', password='testpass')
1072-
self.client.login(username='userA', password='testpass')
1071+
userA = User.objects.create_user('userA', email='[email protected]')
1072+
self.client.force_login(userA)
10731073

10741074
# Rename "userA" to "UserA", should not create OldUsername object
10751075
resp = self.client.post(reverse('accounts-edit'), data={'profile-username': ['UserA'], 'profile-ui_theme_preference': 'f'})
@@ -1113,8 +1113,8 @@ def test_username_whitespace(self):
11131113
class ChangeEmailViaAdminTestCase(TestCase):
11141114

11151115
def test_change_email_form_admin(self):
1116-
User.objects.create_user('superuser', password='testpass', is_superuser=True, is_staff=True)
1117-
self.client.login(username='superuser', password='testpass')
1116+
superuser = User.objects.create_user('superuser', is_superuser=True, is_staff=True)
1117+
self.client.force_login(superuser)
11181118

11191119
# Create user and get admin change url
11201120
userA = User.objects.create_user('userA', email='[email protected]', password='testpass')

apiv2/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(self, msg="Server error", resource=None):
105105
errors_logger.info(apiv2.apiv2_utils.log_message_helper(summary_message, data_dict={
106106
'summary_message': summary_message, 'long_message': msg, 'status': self.status_code}, resource=resource))
107107
self.detail = msg
108-
sentry_sdk.capture_exception(self) # Manually capture exception so it has mroe info and Sentry can organize it properly
108+
sentry_sdk.capture_exception(self)
109109

110110

111111
class OtherException(APIException):

comments/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
class CommentForm(forms.Form):
2626
comment = HtmlCleaningCharField(
2727
widget=forms.Textarea, max_length=4000, label='',
28-
help_text="You can add comments with a timestamp using the syntax #minute:second (e.g., \"The sound in #1:34 is really neat\").")
28+
help_text='You can add comments with a timestamp using the syntax #minute:second (e.g., "The sound at #1:34 is really neat").')
2929

3030
def __init__(self, request, *args, **kwargs):
3131
self.request = request

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ services:
88

99
# Database server
1010
db:
11-
image: postgres:12.1
11+
image: postgres:16.6
1212
volumes:
1313
- pgdata:/var/lib/postgresql/data
1414
- ./freesound-data/db_dev_dump:/freesound-data/db_dev_dump
15-
env_file:
16-
- environment
1715
ports:
1816
- "${FS_BIND_HOST:-127.0.0.1}:${LOCAL_PORT_PREFIX}5432:5432"
1917
environment:
2018
- POSTGRES_USER=freesound
2119
- POSTGRES_DB=freesound
20+
- POSTGRES_PASSWORD=localfreesoundpgpassword
2221
- FS_USER_ID
2322

2423
# Web worker

0 commit comments

Comments
 (0)