Skip to content

Commit

Permalink
Bugfix for source, alt, and tag extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmalloy committed Jul 27, 2022
1 parent 0cffaa5 commit 4673369
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/app/service/editor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export class EditorService {
const relRefPrefix = getPath(refPrefix)!;
if (url.startsWith(relRefPrefix)) {
ending = url.substring(relRefPrefix.length);
}
if (url.startsWith('/ref/')) {
} else if (url.startsWith('/ref/')) {
ending = url.substring('/ref/'.length);
}
if (!ending) return decodeURIComponent(url);
Expand All @@ -64,8 +63,7 @@ export class EditorService {
const relTagPrefix = getPath(tagPrefix)!;
if (url.startsWith(relTagPrefix)) {
ending = url.substring(relTagPrefix.length);
}
if (url.startsWith('/tag/')) {
} else if (url.startsWith('/tag/')) {
ending = url.substring('/tag/'.length);
}
if (!ending) return [url, ''];
Expand All @@ -89,17 +87,17 @@ export class EditorService {
const value = group.value.comment;
const newSources = _.uniq(_.difference(this.getSources(value), group.value.sources));
for (const s of newSources) {
(group.get('sources') as FormArray).push(fb.control(value, LinksFormComponent.validators));
(group.get('sources') as FormArray).push(fb.control(s, LinksFormComponent.validators));
}
const newAlts = _.uniq(_.difference(this.getAlts(value), group.value.alternateUrls));
for (const a of newAlts) {
(group.get('alternateUrls') as FormArray).push(fb.control(value, LinksFormComponent.validators));
(group.get('alternateUrls') as FormArray).push(fb.control(a, LinksFormComponent.validators));
}
const newTags = _.uniq(_.difference([
...getTags(value),
...getNotifications(value)], group.value.tags));
for (const t of newTags) {
(group.get('tags') as FormArray).push(fb.control(value, TagsFormComponent.validators));
(group.get('tags') as FormArray).push(fb.control(t, TagsFormComponent.validators));
}
}

Expand Down

0 comments on commit 4673369

Please sign in to comment.