Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ac45850d
Commit
ac45850d
authored
Jul 05, 2017
by
Aamish Baloch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
YONK-691: Configurable profile image sizes
parent
c6e08517
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
12 deletions
+39
-12
cms/envs/aws.py
+7
-0
cms/envs/common.py
+9
-0
lms/envs/aws.py
+7
-0
lms/envs/common.py
+9
-0
openedx/core/djangoapps/user_api/accounts/image_helpers.py
+3
-8
openedx/core/djangoapps/user_api/accounts/tests/test_api.py
+1
-1
openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py
+1
-1
openedx/core/djangoapps/user_api/accounts/tests/test_views.py
+2
-2
No files found.
cms/envs/aws.py
View file @
ac45850d
...
@@ -501,3 +501,10 @@ HELP_TOKENS_BOOKS = ENV_TOKENS.get('HELP_TOKENS_BOOKS', HELP_TOKENS_BOOKS)
...
@@ -501,3 +501,10 @@ HELP_TOKENS_BOOKS = ENV_TOKENS.get('HELP_TOKENS_BOOKS', HELP_TOKENS_BOOKS)
############## Settings for CourseGraph ############################
############## Settings for CourseGraph ############################
COURSEGRAPH_JOB_QUEUE
=
ENV_TOKENS
.
get
(
'COURSEGRAPH_JOB_QUEUE'
,
LOW_PRIORITY_QUEUE
)
COURSEGRAPH_JOB_QUEUE
=
ENV_TOKENS
.
get
(
'COURSEGRAPH_JOB_QUEUE'
,
LOW_PRIORITY_QUEUE
)
############## Settings for Profile Image Size ######################
PROFILE_IMAGE_SIZES_MAP
=
ENV_TOKENS
.
get
(
'PROFILE_IMAGE_SIZES_MAP'
,
PROFILE_IMAGE_SIZES_MAP
)
cms/envs/common.py
View file @
ac45850d
...
@@ -1335,3 +1335,12 @@ RECALCULATE_GRADES_ROUTING_KEY = LOW_PRIORITY_QUEUE
...
@@ -1335,3 +1335,12 @@ RECALCULATE_GRADES_ROUTING_KEY = LOW_PRIORITY_QUEUE
############## Settings for CourseGraph ############################
############## Settings for CourseGraph ############################
COURSEGRAPH_JOB_QUEUE
=
LOW_PRIORITY_QUEUE
COURSEGRAPH_JOB_QUEUE
=
LOW_PRIORITY_QUEUE
############## Settings for Profile Image Size ######################
PROFILE_IMAGE_SIZES_MAP
=
{
'full'
:
500
,
'large'
:
120
,
'medium'
:
50
,
'small'
:
30
}
lms/envs/aws.py
View file @
ac45850d
...
@@ -1005,3 +1005,10 @@ ICP_LICENSE = ENV_TOKENS.get('ICP_LICENSE', None)
...
@@ -1005,3 +1005,10 @@ ICP_LICENSE = ENV_TOKENS.get('ICP_LICENSE', None)
############## Settings for CourseGraph ############################
############## Settings for CourseGraph ############################
COURSEGRAPH_JOB_QUEUE
=
ENV_TOKENS
.
get
(
'COURSEGRAPH_JOB_QUEUE'
,
LOW_PRIORITY_QUEUE
)
COURSEGRAPH_JOB_QUEUE
=
ENV_TOKENS
.
get
(
'COURSEGRAPH_JOB_QUEUE'
,
LOW_PRIORITY_QUEUE
)
############## Settings for Profile Image Size ######################
PROFILE_IMAGE_SIZES_MAP
=
ENV_TOKENS
.
get
(
'PROFILE_IMAGE_SIZES_MAP'
,
PROFILE_IMAGE_SIZES_MAP
)
lms/envs/common.py
View file @
ac45850d
...
@@ -3202,3 +3202,12 @@ COURSES_API_CACHE_TIMEOUT = 3600 # Value is in seconds
...
@@ -3202,3 +3202,12 @@ COURSES_API_CACHE_TIMEOUT = 3600 # Value is in seconds
############## Settings for CourseGraph ############################
############## Settings for CourseGraph ############################
COURSEGRAPH_JOB_QUEUE
=
LOW_PRIORITY_QUEUE
COURSEGRAPH_JOB_QUEUE
=
LOW_PRIORITY_QUEUE
############## Settings for Profile Image Size ######################
PROFILE_IMAGE_SIZES_MAP
=
{
'full'
:
500
,
'large'
:
120
,
'medium'
:
50
,
'small'
:
30
}
openedx/core/djangoapps/user_api/accounts/image_helpers.py
View file @
ac45850d
...
@@ -14,13 +14,8 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_
...
@@ -14,13 +14,8 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_
PROFILE_IMAGE_FILE_EXTENSION
=
'jpg'
# All processed profile images are converted to JPEGs
PROFILE_IMAGE_FILE_EXTENSION
=
'jpg'
# All processed profile images are converted to JPEGs
PROFILE_IMAGE_SIZES_MAP
=
{
'full'
:
500
,
_PROFILE_IMAGE_SIZES
=
settings
.
PROFILE_IMAGE_SIZES_MAP
.
values
()
'large'
:
120
,
'medium'
:
50
,
'small'
:
30
}
_PROFILE_IMAGE_SIZES
=
PROFILE_IMAGE_SIZES_MAP
.
values
()
def
get_profile_image_storage
():
def
get_profile_image_storage
():
...
@@ -60,7 +55,7 @@ def _get_profile_image_urls(name, storage, file_extension=PROFILE_IMAGE_FILE_EXT
...
@@ -60,7 +55,7 @@ def _get_profile_image_urls(name, storage, file_extension=PROFILE_IMAGE_FILE_EXT
)
)
return
'{}?v={}'
.
format
(
url
,
version
)
if
version
is
not
None
else
url
return
'{}?v={}'
.
format
(
url
,
version
)
if
version
is
not
None
else
url
return
{
size_display_name
:
_make_url
(
size
)
for
size_display_name
,
size
in
PROFILE_IMAGE_SIZES_MAP
.
items
()}
return
{
size_display_name
:
_make_url
(
size
)
for
size_display_name
,
size
in
settings
.
PROFILE_IMAGE_SIZES_MAP
.
items
()}
def
get_profile_image_names
(
username
):
def
get_profile_image_names
(
username
):
...
...
openedx/core/djangoapps/user_api/accounts/tests/test_api.py
View file @
ac45850d
...
@@ -246,7 +246,7 @@ class TestAccountApi(UserSettingsEventTestMixin, TestCase):
...
@@ -246,7 +246,7 @@ class TestAccountApi(UserSettingsEventTestMixin, TestCase):
@attr
(
shard
=
2
)
@attr
(
shard
=
2
)
@patch
(
'openedx.core.djangoapps.user_api.accounts.image_helpers._PROFILE_IMAGE_SIZES'
,
[
50
,
10
])
@patch
(
'openedx.core.djangoapps.user_api.accounts.image_helpers._PROFILE_IMAGE_SIZES'
,
[
50
,
10
])
@patch.dict
(
@patch.dict
(
'
openedx.core.djangoapps.user_api.accounts.image_helper
s.PROFILE_IMAGE_SIZES_MAP'
,
'
django.conf.setting
s.PROFILE_IMAGE_SIZES_MAP'
,
{
'full'
:
50
,
'small'
:
10
},
{
'full'
:
50
,
'small'
:
10
},
clear
=
True
clear
=
True
)
)
...
...
openedx/core/djangoapps/user_api/accounts/tests/test_image_helpers.py
View file @
ac45850d
...
@@ -18,7 +18,7 @@ TEST_PROFILE_IMAGE_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 01, tzinfo=
...
@@ -18,7 +18,7 @@ TEST_PROFILE_IMAGE_UPLOAD_DT = datetime.datetime(2002, 1, 9, 15, 43, 01, tzinfo=
@attr
(
shard
=
2
)
@attr
(
shard
=
2
)
@patch.dict
(
'
openedx.core.djangoapps.user_api.accounts.image_helper
s.PROFILE_IMAGE_SIZES_MAP'
,
TEST_SIZES
,
clear
=
True
)
@patch.dict
(
'
django.conf.setting
s.PROFILE_IMAGE_SIZES_MAP'
,
TEST_SIZES
,
clear
=
True
)
@skip_unless_lms
@skip_unless_lms
class
ProfileImageUrlTestCase
(
TestCase
):
class
ProfileImageUrlTestCase
(
TestCase
):
"""
"""
...
...
openedx/core/djangoapps/user_api/accounts/tests/test_views.py
View file @
ac45850d
...
@@ -200,7 +200,7 @@ class TestOwnUsernameAPI(CacheIsolationTestCase, UserAPITestCase):
...
@@ -200,7 +200,7 @@ class TestOwnUsernameAPI(CacheIsolationTestCase, UserAPITestCase):
@skip_unless_lms
@skip_unless_lms
@patch
(
'openedx.core.djangoapps.user_api.accounts.image_helpers._PROFILE_IMAGE_SIZES'
,
[
50
,
10
])
@patch
(
'openedx.core.djangoapps.user_api.accounts.image_helpers._PROFILE_IMAGE_SIZES'
,
[
50
,
10
])
@patch.dict
(
@patch.dict
(
'
openedx.core.djangoapps.user_api.accounts.image_helper
s.PROFILE_IMAGE_SIZES_MAP'
,
'
django.conf.setting
s.PROFILE_IMAGE_SIZES_MAP'
,
{
'full'
:
50
,
'small'
:
10
},
{
'full'
:
50
,
'small'
:
10
},
clear
=
True
clear
=
True
)
)
...
@@ -608,7 +608,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
...
@@ -608,7 +608,7 @@ class TestAccountsAPI(CacheIsolationTestCase, UserAPITestCase):
verify_change_info
(
name_change_info
[
1
],
"Mickey Mouse"
,
self
.
user
.
username
,
"Donald Duck"
)
verify_change_info
(
name_change_info
[
1
],
"Mickey Mouse"
,
self
.
user
.
username
,
"Donald Duck"
)
@patch.dict
(
@patch.dict
(
'
openedx.core.djangoapps.user_api.accounts.image_helper
s.PROFILE_IMAGE_SIZES_MAP'
,
'
django.conf.setting
s.PROFILE_IMAGE_SIZES_MAP'
,
{
'full'
:
50
,
'medium'
:
30
,
'small'
:
10
},
{
'full'
:
50
,
'medium'
:
30
,
'small'
:
10
},
clear
=
True
clear
=
True
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment