Skip to content

Commit e4864f9

Browse files
committed
increase size for snippets too
1 parent 5aff890 commit e4864f9

File tree

6 files changed

+38
-26
lines changed

6 files changed

+38
-26
lines changed

backend/src/common/constants.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ const ENV = {
66

77
const MAX_NUMBER_OF_TAGS = 8;
88

9-
const MAX_NUMBER_OF_CHARS_FOR_DESCRIPTION = 3000;
9+
const MAX_NUMBER_OF_CHARS_FOR_DESCRIPTION = 5000;
1010

11-
const MAX_NUMBER_OF_LINES_FOR_DESCRIPTION = 300;
11+
const MAX_NUMBER_OF_LINES_FOR_DESCRIPTION = 500;
1212

13-
const MAX_NUMBER_OF_CHARS_FOR_CODE_SNIPPET = 5000;
13+
const MAX_NUMBER_OF_CHARS_FOR_CODE_SNIPPET = 10000;
1414

15-
const MAX_NUMBER_OF_LINES_FOR_CODE_SNIPPET = 500;
15+
const MAX_NUMBER_OF_LINES_FOR_CODE_SNIPPET = 1000;
1616

1717
const MAX_NUMBER_RETURNED_RESULTS = 55;
1818

frontend/src/app/my-bookmarks/save-bookmark-form/save-bookmark-form.component.ts

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import { UserInfoStore } from '../../core/user/user-info.store';
2222
import { SuggestedTagsStore } from '../../core/user/suggested-tags.store';
2323
import { WebpageInfo } from '../../core/model/webpage-info';
2424
import { MyBookmarksStore } from '../../core/user/my-bookmarks.store';
25-
import { PublicBookmarkPresentDialogComponent } from './public-bookmark-present-dialog/public-bookmark-present-dialog.component';
25+
import {
26+
PublicBookmarkPresentDialogComponent
27+
} from './public-bookmark-present-dialog/public-bookmark-present-dialog.component';
2628
import { AdminService } from '../../core/admin/admin.service';
2729
import { WebpageInfoService } from '../../core/webpage-info/webpage-info.service';
2830
import { UserDataHistoryStore } from '../../core/user/userdata.history.store';
@@ -34,6 +36,7 @@ import { StackoverflowHelper } from '../../core/helper/stackoverflow.helper';
3436
import { UserDataPinnedStore } from '../../core/user/userdata.pinned.store';
3537
import { MatChipInputEvent } from '@angular/material/chips';
3638
import { MatAutocompleteActivatedEvent, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
39+
import iziToast, { IziToastSettings } from 'izitoast';
3740

3841
@Component({
3942
selector: 'app-save-bookmark-form',
@@ -192,7 +195,7 @@ export class SaveBookmarkFormComponent implements OnInit {
192195
if (isNewBookmark) {
193196
this.bookmarkForm.get('location').valueChanges.pipe(
194197
debounceTime(1000),
195-
distinctUntilChanged(), )
198+
distinctUntilChanged(),)
196199
.subscribe(location => {
197200
this.verifyExistenceInPersonalBookmarks(location);
198201
});
@@ -377,9 +380,18 @@ export class SaveBookmarkFormComponent implements OnInit {
377380
concatMap((updatedBookmark) => this.userDataStore.updateUserDataHistory$(updatedBookmark))
378381
).subscribe(
379382
() => {
380-
this.navigateToHomePageHistoryTab()
383+
this.navigateToHomePageHistoryTab();
381384
},
382-
() => this.navigateToHomePageHistoryTab() // TODO add error handling - popover
385+
(response) => {
386+
const iziToastSettings: IziToastSettings = {
387+
title: `Error when updating ${bookmark.name}`,
388+
messageLineHeight: '5',
389+
timeout: false,
390+
message: response.message + ' ' + response?.validationErrors
391+
}
392+
iziToast.error(iziToastSettings);
393+
this.navigateToHomePageHistoryTab()
394+
} // TODO add error handling - popover}
383395
);
384396
}
385397
}
@@ -439,17 +451,17 @@ export class SaveBookmarkFormComponent implements OnInit {
439451
this.publishInUserDataStores(newBookmark, readLater, pinned);
440452
this.navigateToBookmarkDetails(newBookmark);
441453

442-
/* if (this.url) {
443-
if (this.popup) {
444-
this.navigateToBookmarkDetails(newBookmark);
445-
} else if (this.popupExt) {
446-
this.navigateToHomePageHistoryTab();
447-
} else {
448-
window.location.href = this.url;
449-
}
450-
} else {
451-
this.navigateToHomePageHistoryTab();
452-
}*/
454+
/* if (this.url) {
455+
if (this.popup) {
456+
this.navigateToBookmarkDetails(newBookmark);
457+
} else if (this.popupExt) {
458+
this.navigateToHomePageHistoryTab();
459+
} else {
460+
window.location.href = this.url;
461+
}
462+
} else {
463+
this.navigateToHomePageHistoryTab();
464+
}*/
453465
});
454466
},
455467
(error: HttpResponse<any>) => {

frontend/src/app/my-snippets/create-snippet-form/create-snippet-form.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</textarea>
8080
<div
8181
class="description-chars-counter">{{codeSnippet.get('code').value ? codeSnippet.get('code').value.length : 0}}
82-
/ 5000
82+
/ 10000
8383
</div>
8484
<div class="form-group">
8585
<label for="commentAfter-{{i}}">Comment after (optional) - <i class="fab fa-markdown"></i> <a
@@ -100,7 +100,7 @@
100100
allowed.
101101
</div>
102102
<div *ngIf="codeSnippet.get('code').errors.tooManyCharacters">
103-
Your code snippet has {{codeSnippet.get('code').errors.tooManyCharacters.value}} characters. Maximum 5000
103+
Your code snippet has {{codeSnippet.get('code').errors.tooManyCharacters.value}} characters. Maximum 10000
104104
characters
105105
are
106106
allowed.

frontend/src/app/my-snippets/create-snippet-form/create-snippet-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class CreateSnippetFormComponent extends SnippetFormBaseComponent impleme
124124
}
125125

126126
return this.formBuilder.group({
127-
code: [this.code ? this.ext === 'vscode' ? this.decodeTextVsCode(this.code) : this.code : '', textSizeValidator(5000, 500)],
127+
code: [this.code ? this.ext === 'vscode' ? this.decodeTextVsCode(this.code) : this.code : '', textSizeValidator(10000, 1000)],
128128
comment: [this.comment ? this.comment : '', textSizeValidator(1000, 30)],
129129
commentAfter: [ '', textSizeValidator(1000, 30)]
130130
});

frontend/src/app/my-snippets/snippet-form-base/snippet-form.base.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,23 @@ export class SnippetFormBaseComponent implements OnInit {
126126

127127
createCodeSnippet(codeSnippet: CodeSnippet): FormGroup {
128128
return this.formBuilder.group({
129-
code: [codeSnippet.code, textSizeValidator(5000, 500)],
129+
code: [codeSnippet.code, textSizeValidator(10000, 1000)],
130130
comment: codeSnippet.comment,
131131
commentAfter: codeSnippet.commentAfter
132132
});
133133
}
134134

135135
createInitialCodeSnippet(): FormGroup {
136136
return this.formBuilder.group({
137-
code: ['', textSizeValidator(5000, 500)],
137+
code: ['', textSizeValidator(10000, 1000)],
138138
comment: ['', textSizeValidator(1000, 30)],
139139
commentAfter: ['', textSizeValidator(1000, 30)]
140140
});
141141
}
142142

143143
createEmptyCodeSnippet(): FormGroup {
144144
return this.formBuilder.group({
145-
code: ['', textSizeValidator(5000, 500)],
145+
code: ['', textSizeValidator(10000, 1000)],
146146
comment: ['', textSizeValidator(1000, 30)],
147147
commentAfter: ['', textSizeValidator(1000, 30)]
148148
});

frontend/src/app/my-snippets/update-snippet-form/update-snippet-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
</textarea>
7979
<div
8080
class="description-chars-counter">{{codeSnippet.get('code').value ? codeSnippet.get('code').value.length : 0}}
81-
/ 5000
81+
/ 10000
8282
</div>
8383
<div class="form-group">
8484
<label for="commentAfter-{{i}}">Comment after (optional) - <i class="fab fa-markdown"></i> <a

0 commit comments

Comments
 (0)