Merge branch 'RED-6435' into 'master'

RED-6435: Removed add to dict character limit

Closes RED-6435

See merge request redactmanager/red-ui!187
This commit is contained in:
Dan Percic 2023-11-14 14:25:11 +01:00
commit 4706a3d425
5 changed files with 9 additions and 13 deletions

View File

@ -12,7 +12,6 @@ import { DossierDictionariesMapService } from '@services/entity-services/dossier
import { List } from '@iqser/common-ui/lib/utils';
import { IMAGE_CATEGORIES } from '../../modules/file-preview/utils/constants';
const MIN_WORD_LENGTH = 2;
const IMAGE_TYPES = ['image', 'formula', 'ocr'];
@Injectable({
@ -100,20 +99,13 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
) {
const entriesToAdd: Array<string> = [];
const initialEntriesSet = new Set(initialEntries);
let hasInvalidRows = false;
for (let i = 0; i < entries.length; i++) {
const entry = entries.at(i);
if (!entry.trim() || initialEntriesSet.has(entry)) {
continue;
}
hasInvalidRows ||= entry.length < MIN_WORD_LENGTH;
entriesToAdd.push(entry);
}
if (hasInvalidRows) {
this._toaster.error(_('dictionary-overview.error.entries-too-short'));
throw new Error('Entries too short');
}
const deletedEntries: Array<string> = [];
const entriesSet = new Set(entries);
for (let i = 0; i < initialEntries.length; i++) {
@ -260,7 +252,15 @@ export class DictionaryService extends EntitiesService<IDictionary, Dictionary>
}
}
if (!manualTypeExists) {
dictionaries.push(new Dictionary({ hexColor: FALLBACK_COLOR, type: SuperTypes.ManualRedaction }, true));
dictionaries.push(
new Dictionary(
{
hexColor: FALLBACK_COLOR,
type: SuperTypes.ManualRedaction,
},
true,
),
);
}
return dictionaries;

View File

@ -700,7 +700,6 @@
"download": "Download current entries",
"error": {
"400": "Cannot update dictionary because at least one of the newly added words where recognized as a general term that appear too often in texts.",
"entries-too-short": "Einige Einträge im Wörterbuch unterschreiten die Mindestlänge von 2 Zeichen. Diese sind rot markiert.",
"generic": "Es ist ein Fehler aufgetreten ... Das Wörterbuch konnte nicht aktualisiert werden!"
},
"revert-changes": "Rückgängig machen",

View File

@ -700,7 +700,6 @@
"download": "Download current entries",
"error": {
"400": "Cannot update dictionary because at least one of the newly added words where recognized as a general term that appear too often in texts.",
"entries-too-short": "Some entries of the dictionary are below the minimum length of 2. These are highlighted with red!",
"generic": "Something went wrong... Dictionary update failed!"
},
"revert-changes": "Revert",

View File

@ -700,7 +700,6 @@
"download": "",
"error": {
"400": "",
"entries-too-short": "Einige Einträge im Wörterbuch unterschreiten die Mindestlänge von 2 Zeichen. Diese sind rot markiert.",
"generic": "Es ist ein Fehler aufgetreten ... Das Wörterbuch konnte nicht aktualisiert werden!"
},
"revert-changes": "Rückgängig machen",

View File

@ -700,7 +700,6 @@
"download": "Download current entries",
"error": {
"400": "Cannot update dictionary because at least one of the newly added words where recognized as a general term that appear too often in texts.",
"entries-too-short": "Some entries of the dictionary are below the minimum length of 2. These are highlighted with red!",
"generic": "Something went wrong... Dictionary update failed!"
},
"revert-changes": "Revert",