users: fix avatar handling and various translations
This commit is contained in:
@@ -31,7 +31,6 @@ const id = ref('');
|
||||
const upstreamUri = ref('');
|
||||
const label = ref('');
|
||||
const tags = ref([]);
|
||||
const iconFile = ref(null);
|
||||
const iconUrl = ref('');
|
||||
const accessRestrictionOption = ref('');
|
||||
const accessRestriction = ref({
|
||||
@@ -53,8 +52,9 @@ const isValid = computed(() => {
|
||||
return true;
|
||||
});
|
||||
|
||||
let iconFile = null;
|
||||
function onIconChanged(file) {
|
||||
iconFile.value = file;
|
||||
iconFile = file;
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
@@ -73,10 +73,10 @@ async function onSubmit() {
|
||||
data.accessRestriction.groups = accessRestriction.value.groups.map(function (g) { return g.id; });
|
||||
}
|
||||
|
||||
if (iconFile.value === 'fallback') { // user reset the icon
|
||||
if (iconFile === 'fallback') { // user reset the icon
|
||||
data.icon = '';
|
||||
} else if (iconFile.value !== 'src') { // user loaded custom icon
|
||||
data.icon = (await getDataURLFromFile(iconFile.value)).replace(/^data:image\/[a-z]+;base64,/, '');
|
||||
} else if (iconFile !== 'src') { // user loaded custom icon
|
||||
data.icon = (await getDataURLFromFile(iconFile)).replace(/^data:image\/[a-z]+;base64,/, '');
|
||||
}
|
||||
|
||||
let error;
|
||||
@@ -118,7 +118,7 @@ defineExpose({
|
||||
upstreamUri.value = applink ? applink.upstreamUri : '';
|
||||
label.value = applink ? applink.label : '';
|
||||
iconUrl.value = applink ? applink.iconUrl : 'fallback';
|
||||
iconFile.value = applink?.iconUrl ? 'src' : 'fallback';
|
||||
iconFile = applink?.iconUrl ? 'src' : 'fallback';
|
||||
tags.value = applink ? applink.tags : [];
|
||||
accessRestrictionOption.value = applink && applink.accessRestriction ? 'groups' : 'any';
|
||||
accessRestriction.value = applink && applink.accessRestriction ? applink.accessRestriction : { users: [], groups: [] };
|
||||
|
||||
Reference in New Issue
Block a user