mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-18 15:08:22 +00:00
11.0 fix translation (#6544)
* remove useless translation (#6543) * remove useless translation
This commit is contained in:
parent
c1fd9ddbe1
commit
f4908fa201
@ -57,7 +57,7 @@ class Plans extends Component {
|
|||||||
assetQuota = (assetQuotaUnitCount) * currentPlan.asset_quota_unit;
|
assetQuota = (assetQuotaUnitCount) * currentPlan.asset_quota_unit;
|
||||||
totalAmount = assetQuotaUnitCount * currentPlan.price_per_asset_quota_unit;
|
totalAmount = assetQuotaUnitCount * currentPlan.price_per_asset_quota_unit;
|
||||||
} else {
|
} else {
|
||||||
toaster.danger(gettext('Internal Server Error.'));
|
toaster.danger(gettext('Internal Server Error'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,8 +263,8 @@ class Plans extends Component {
|
|||||||
return this.renderAddUser();
|
return this.renderAddUser();
|
||||||
} else if (paymentType === 'buy_quota') {
|
} else if (paymentType === 'buy_quota') {
|
||||||
return this.renderBuyQuota();
|
return this.renderBuyQuota();
|
||||||
} else {
|
} else {
|
||||||
toaster.danger(gettext('Internal Server Error.'));
|
toaster.danger(gettext('Internal Server Error'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,13 @@ import moment from 'moment';
|
|||||||
const OPERATIONS =[
|
const OPERATIONS =[
|
||||||
{
|
{
|
||||||
value: 'active',
|
value: 'active',
|
||||||
text: gettext('active'),
|
text: gettext('Active'),
|
||||||
is_active: true,
|
is_active: true,
|
||||||
isSelected: false,
|
isSelected: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'inactive',
|
value: 'inactive',
|
||||||
text: gettext('inactive'),
|
text: gettext('Inactive'),
|
||||||
is_active: false,
|
is_active: false,
|
||||||
isSelected: false,
|
isSelected: false,
|
||||||
},
|
},
|
||||||
|
@ -239,7 +239,7 @@ class Account(APIView):
|
|||||||
|
|
||||||
if space_quota_mb < 0:
|
if space_quota_mb < 0:
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST,
|
return api_error(status.HTTP_400_BAD_REQUEST,
|
||||||
_('Space quota is too low (minimum value is 0)'))
|
'Space quota is too low (minimum value is 0)')
|
||||||
|
|
||||||
if is_org_context(request):
|
if is_org_context(request):
|
||||||
org_id = request.user.org.org_id
|
org_id = request.user.org.org_id
|
||||||
@ -247,7 +247,7 @@ class Account(APIView):
|
|||||||
get_file_size_unit('MB')
|
get_file_size_unit('MB')
|
||||||
if space_quota_mb > org_quota_mb:
|
if space_quota_mb > org_quota_mb:
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, \
|
return api_error(status.HTTP_400_BAD_REQUEST, \
|
||||||
_('Failed to set quota: maximum quota is %d MB' % org_quota_mb))
|
'Failed to set quota: maximum quota is %d MB' % org_quota_mb)
|
||||||
|
|
||||||
# argument check for is_trial
|
# argument check for is_trial
|
||||||
is_trial = request.data.get("is_trial", None)
|
is_trial = request.data.get("is_trial", None)
|
||||||
|
@ -174,7 +174,7 @@ class AdminUsersBatch(APIView):
|
|||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
if quota_total_mb < 0:
|
if quota_total_mb < 0:
|
||||||
error_msg = _('Space quota is too low (minimum value is 0)')
|
error_msg = 'Space quota is too low (minimum value is 0)'
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
quota_total_byte = quota_total_mb * get_file_size_unit('MB')
|
quota_total_byte = quota_total_mb * get_file_size_unit('MB')
|
||||||
|
@ -83,6 +83,6 @@ class RepoAutoDeleteView(APIView):
|
|||||||
repo_auto_delete, _ = RepoAutoDelete.objects.update_or_create(repo_id=repo_id, defaults={'days':auto_delete_days})
|
repo_auto_delete, _ = RepoAutoDelete.objects.update_or_create(repo_id=repo_id, defaults={'days':auto_delete_days})
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, 'Internal Server Error.')
|
return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, 'Internal Server Error')
|
||||||
|
|
||||||
return Response({'auto_delete_days':repo_auto_delete.days})
|
return Response({'auto_delete_days':repo_auto_delete.days})
|
@ -153,7 +153,7 @@ class SetUserQuotaForm(forms.Form):
|
|||||||
"""
|
"""
|
||||||
space_quota = forms.IntegerField(min_value=0,
|
space_quota = forms.IntegerField(min_value=0,
|
||||||
error_messages={'required': _('Space quota can\'t be empty'),
|
error_messages={'required': _('Space quota can\'t be empty'),
|
||||||
'min_value': _('Space quota is too low (minimum value is 0)')})
|
'min_value': 'Space quota is too low (minimum value is 0)'})
|
||||||
|
|
||||||
class RepoSettingForm(forms.Form):
|
class RepoSettingForm(forms.Form):
|
||||||
"""
|
"""
|
||||||
|
@ -175,7 +175,7 @@ class InstAdminUser(APIView):
|
|||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
if quota_total_mb < 0:
|
if quota_total_mb < 0:
|
||||||
error_msg = _("Space quota is too low (minimum value is 0).")
|
error_msg = "Space quota is too low (minimum value is 0)."
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
quota = quota_total_mb * get_file_size_unit('MB')
|
quota = quota_total_mb * get_file_size_unit('MB')
|
||||||
@ -183,7 +183,7 @@ class InstAdminUser(APIView):
|
|||||||
if available_quota is not None:
|
if available_quota is not None:
|
||||||
# None means has unlimit quota
|
# None means has unlimit quota
|
||||||
if available_quota == 0 or available_quota < quota:
|
if available_quota == 0 or available_quota < quota:
|
||||||
error_msg = _(f"Failed to set quota: maximum quota is {available_quota} MB")
|
error_msg = "Failed to set quota: maximum quota is %d MB" % available_quota
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
seafile_api.set_user_quota(email, quota)
|
seafile_api.set_user_quota(email, quota)
|
||||||
|
@ -240,7 +240,7 @@ def user_set_quota(request, email):
|
|||||||
available_quota = get_institution_available_quota(request.user.institution)
|
available_quota = get_institution_available_quota(request.user.institution)
|
||||||
if available_quota < quota:
|
if available_quota < quota:
|
||||||
result = {}
|
result = {}
|
||||||
result['error'] = _('Failed to set quota: maximum quota is %d MB' % (available_quota / 10 ** 6))
|
result['error'] = 'Failed to set quota: maximum quota is %d MB' % (available_quota / 10 ** 6)
|
||||||
return HttpResponse(json.dumps(result), status=400, content_type=content_type)
|
return HttpResponse(json.dumps(result), status=400, content_type=content_type)
|
||||||
|
|
||||||
seafile_api.set_user_quota(email, quota)
|
seafile_api.set_user_quota(email, quota)
|
||||||
|
@ -468,7 +468,7 @@ class OrgAdminUser(APIView):
|
|||||||
|
|
||||||
# -1 means org has unlimited quota
|
# -1 means org has unlimited quota
|
||||||
if org_quota > 0 and quota_total_mb > org_quota_mb:
|
if org_quota > 0 and quota_total_mb > org_quota_mb:
|
||||||
error_msg = _(u'Failed to set quota: maximum quota is %d MB' % org_quota_mb)
|
error_msg = 'Failed to set quota: maximum quota is %d MB' % org_quota_mb
|
||||||
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
return api_error(status.HTTP_400_BAD_REQUEST, error_msg)
|
||||||
|
|
||||||
quota_total = int(quota_total_mb) * get_file_size_unit('MB')
|
quota_total = int(quota_total_mb) * get_file_size_unit('MB')
|
||||||
|
@ -4,7 +4,6 @@ import time
|
|||||||
import json
|
import json
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
from django.http import HttpResponse, HttpResponseBadRequest, \
|
from django.http import HttpResponse, HttpResponseBadRequest, \
|
||||||
HttpResponseForbidden
|
HttpResponseForbidden
|
||||||
|
|
||||||
@ -84,7 +83,7 @@ def rate_limit(number=REQUEST_RATE_LIMIT_NUMBER,
|
|||||||
cache.set(cache_key, data, timeout=period)
|
cache.set(cache_key, data, timeout=period)
|
||||||
|
|
||||||
if data['count'] > number:
|
if data['count'] > number:
|
||||||
return HttpResponse(_("Too many requests"), status=429)
|
return HttpResponse("Too many requests", status=429)
|
||||||
|
|
||||||
return func(request, *args, **kwargs)
|
return func(request, *args, **kwargs)
|
||||||
return wrapped
|
return wrapped
|
||||||
|
@ -298,8 +298,7 @@ def user_set_quota(request, email):
|
|||||||
org_id = org[0].org_id
|
org_id = org[0].org_id
|
||||||
org_quota_mb = seafserv_threaded_rpc.get_org_quota(org_id) / get_file_size_unit('MB')
|
org_quota_mb = seafserv_threaded_rpc.get_org_quota(org_id) / get_file_size_unit('MB')
|
||||||
if space_quota_mb > org_quota_mb:
|
if space_quota_mb > org_quota_mb:
|
||||||
result['error'] = _('Failed to set quota: maximum quota is %d MB' % \
|
result['error'] = 'Failed to set quota: maximum quota is %d MB' % org_quota_mb
|
||||||
org_quota_mb)
|
|
||||||
return HttpResponse(json.dumps(result), status=400, content_type=content_type)
|
return HttpResponse(json.dumps(result), status=400, content_type=content_type)
|
||||||
else:
|
else:
|
||||||
seafile_api.set_org_user_quota(org_id, email, space_quota)
|
seafile_api.set_org_user_quota(org_id, email, space_quota)
|
||||||
|
Loading…
Reference in New Issue
Block a user