Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] fix(Users/Quota setting): Prevent floating point value from getting truncated in locales other than english #42172

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions apps/settings/src/components/UserList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ import Vue from 'vue'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcMultiselect from '@nextcloud/vue/dist/Components/NcMultiselect.js'
import { formatFileSize, parseFileSize } from '@nextcloud/files'

import userRow from './UserList/UserRow.vue'

Expand Down Expand Up @@ -486,10 +487,10 @@ export default {
*/
validateQuota(quota) {
// only used for new presets sent through @Tag
const validQuota = OC.Util.computerFileSize(quota)
const validQuota = parseFileSize(quota, true)
if (validQuota !== null && validQuota >= 0) {
// unify format output
quota = OC.Util.humanFileSize(OC.Util.computerFileSize(quota))
quota = formatFileSize(parseFileSize(quota, true))
this.newUser.quota = { id: quota, label: quota }
return this.newUser.quota
}
Expand Down
7 changes: 4 additions & 3 deletions apps/settings/src/components/UserList/UserRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@

<script>
import ClickOutside from 'vue-click-outside'
import { formatFileSize, parseFileSize } from '@nextcloud/files'

import {
NcPopoverMenu,
Expand Down Expand Up @@ -688,7 +689,7 @@ export default {
await this.$store.dispatch('setUserData', {
userid: this.user.id,
key: 'quota',
value: quota,
value: '' + parseFileSize(quota, true),
})
} catch (error) {
console.error(error)
Expand All @@ -706,10 +707,10 @@ export default {
*/
validateQuota(quota) {
// only used for new presets sent through @Tag
const validQuota = OC.Util.computerFileSize(quota)
const validQuota = parseFileSize(quota, true)
if (validQuota !== null && validQuota >= 0) {
// unify format output
return this.setUserQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(quota)))
return this.setUserQuota(formatFileSize(parseFileSize(quota, true)))
}
// if no valid do not change
return false
Expand Down
3 changes: 2 additions & 1 deletion apps/settings/src/store/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import api from './api.js'
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
import logger from '../logger.js'
import { parseFileSize } from '@nextcloud/files'

const orderGroups = function(groups, orderBy) {
/* const SORT_USERCOUNT = 1;
Expand Down Expand Up @@ -211,7 +212,7 @@ const mutations = {
},
setUserData(state, { userid, key, value }) {
if (key === 'quota') {
const humanValue = OC.Util.computerFileSize(value)
const humanValue = parseFileSize(value, true)
state.users.find(user => user.id === userid)[key][key] = humanValue !== null ? humanValue : value
} else {
state.users.find(user => user.id === userid)[key] = value
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/UserMenu/UserMenuEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
<NcLoadingIcon v-if="loading"
class="menu-entry__loading-icon"
:size="18" />
<img v-else :src="cachedIcon" alt="" />
<img v-else :src="cachedIcon" alt="">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In future let's not add unrelated changes in backports @marcelklehr ;)

{{ name }}
</a>
<button v-else>
<img :src="cachedIcon" alt="" />
<img :src="cachedIcon" alt="">
{{ name }}
</button>
</li>
Expand Down
1 change: 0 additions & 1 deletion dist/6799-6799.js

This file was deleted.

4 changes: 2 additions & 2 deletions dist/comments-comments-app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/comments-comments-app.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-common.js

Large diffs are not rendered by default.

63 changes: 31 additions & 32 deletions dist/core-common.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,6 @@ object-assign
* Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */

/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

/**
*
*
Expand All @@ -483,28 +481,6 @@ object-assign
*
*/

/**
* @copyright 2019 Christoph Wurst <[email protected]>
*
* @author Christoph Wurst <[email protected]>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @copyright 2019 Christoph Wurst <[email protected]>
*
Expand Down Expand Up @@ -884,7 +860,7 @@ object-assign
*/

/**
* @copyright Copyright (c) 2021 John Molakvoæ <[email protected]>
* @copyright Copyright (c) 2022 John Molakvoæ <[email protected]>
*
* @author John Molakvoæ <[email protected]>
*
Expand All @@ -906,9 +882,9 @@ object-assign
*/

/**
* @copyright Copyright (c) 2022 John Molakvoæ <[email protected]>
* @copyright Copyright (c) 2023 Ferdinand Thiessen <[email protected]>
*
* @author John Molakvoæ <[email protected]>
* @author Ferdinand Thiessen <[email protected]>
*
* @license AGPL-3.0-or-later
*
Expand Down Expand Up @@ -946,7 +922,6 @@ object-assign
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
Expand All @@ -963,17 +938,19 @@ object-assign
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @copyright Copyright (c) 2023 Ferdinand Thiessen <[email protected]>
*
* @author Ferdinand Thiessen <[email protected]>
* @author John Molakvoæ <[email protected]>
*
* @license AGPL-3.0-or-later
*
Expand All @@ -993,9 +970,8 @@ object-assign
*/

/**
* @copyright Copyright (c) 2023 Ferdinand Thiessen <[email protected]>
* @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
*
* @author Ferdinand Thiessen <[email protected]>
* @author John Molakvoæ <[email protected]>
*
* @license AGPL-3.0-or-later
Expand All @@ -1007,7 +983,30 @@ object-assign
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
*
* @author John Molakvoæ <[email protected]>
* @author Ferdinand Thiessen <[email protected]>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
Expand Down
2 changes: 1 addition & 1 deletion dist/core-common.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-login.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-login.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-main.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-profile.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-profile.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-unified-search.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-unified-search.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/core-unsupported-browser-redirect.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/core-unsupported-browser-redirect.js.map

Large diffs are not rendered by default.

Loading
Loading