-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix broken duplicate link (#1233) Fix the broken link of a duplicate issue Currently, the user cannot open the link to a duplicate issue when opening an issue, as described in #1228. The links now work as expected. * Add whitespace validation (#1237) * Add whitespace validation * Update whitespace validation for new issue * Update whitespace validation for title of new issues * Update whitespace validation for title of new issues * Move validators into core * Update import order --------- Co-authored-by: Misra Aditya <e1096355@u.nus.edu> * Fix uncaught errors when attempting to access an invalid route There is an uncaught error when the users click on an invalid internal link in Markdown or enter an invalid link in browser. Internal links are unlikely to be used for bug reporting and are more likely to be invalid. Let's show an error toaster and stop the navigation when clicking on an internal link in Markdown. Also, redirect the users to the login page if the users enter invalid link in browser. * Set default branch to `main` Previously, image uploads depend on the user's default branch. Now, we set the branch for image upload to be `main`. Images will be uploaded to `main` as a result. --------- Co-authored-by: Chee Hong <c.h.wong2606@gmail.com> * Preserve linebreaks (#1241) With preserving linebreaks, subset list items are rendered as a list, and paragraph rendering is the same as Github. * Faulty list view when back navigating (#1243) Issue table settings such as page index are not saved when table is re-mounted. This behavior inconveniences users as their settings are reset everytime they navigate to a specific issue and back. Let's lift up the table settings of each mounted table to a service which the tables pull from when mounted. * Upgrade to Angular 12 (#1242) Some of our packages are old and outdated. We should actively maintain and keep these packages up-to-date so it is easier to maintain in the future. Let's upgrade to Angular 12 to keep our packages up-to-date. * Fix markdown blockquote preview difference (#1245) Due to DOMPurify, the content used for preview is different. However, given that ngx-markdown already has sufficient sanitation by default, we remove sanitation by DOMPurify. * Create release for v3.5.3 --------- Co-authored-by: Nguyen <87511888+nknguyenhc@users.noreply.github.com> Co-authored-by: AdityaMisra <114080910+MadLamprey@users.noreply.github.com> Co-authored-by: Misra Aditya <e1096355@u.nus.edu> Co-authored-by: NereusWB922 <107099783+NereusWB922@users.noreply.github.com> Co-authored-by: Chee Hong <c.h.wong2606@gmail.com> Co-authored-by: Arif Khalid <88131400+Arif-Khalid@users.noreply.github.com>
- Loading branch information
1 parent
013fbfa
commit 404f470
Showing
29 changed files
with
270 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/app/core/directives/internal-link-disable.directive.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Directive, HostListener } from '@angular/core'; | ||
import { ErrorHandlingService } from '../services/error-handling.service'; | ||
|
||
class InvalidLinkError extends Error { | ||
constructor() { | ||
super('Invalid link!'); | ||
Object.setPrototypeOf(this, InvalidLinkError.prototype); | ||
} | ||
} | ||
|
||
@Directive({ | ||
selector: '[disableInternalLink]' | ||
}) | ||
export class InternalLinkDisableDirective { | ||
constructor(private errorHandlingService: ErrorHandlingService) {} | ||
|
||
@HostListener('click', ['$event']) | ||
public onClick(e: MouseEvent): void { | ||
const srcElement = e.target; | ||
|
||
if (srcElement instanceof HTMLAnchorElement) { | ||
const baseURI = srcElement.baseURI; | ||
const href = srcElement.href; | ||
|
||
if (href.startsWith(baseURI)) { | ||
this.errorHandlingService.handleError(new InvalidLinkError()); | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export class TableSettings { | ||
public sortActiveId = ''; // The ID of the column the table is sorted by | ||
public sortDirection = ''; | ||
public pageSize = 20; | ||
public pageIndex = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { TableSettings } from '../models/table-settings.model'; | ||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
|
||
/** | ||
* Responsible for storing and retrieving the table settings for issue tables created | ||
* Map is required since there can be multiple tables within the same page | ||
*/ | ||
export class IssueTableSettingsService { | ||
private _tableSettingsMap: { [index: string]: TableSettings } = {}; | ||
|
||
public getTableSettings(tableName: string): TableSettings { | ||
return this._tableSettingsMap[tableName] || new TableSettings(); | ||
} | ||
|
||
public setTableSettings(tableName: string, tableSettings: TableSettings): void { | ||
this._tableSettingsMap[tableName] = tableSettings; | ||
} | ||
|
||
public clearTableSettings(): void { | ||
this._tableSettingsMap = {}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms'; | ||
|
||
export function noWhitespace(): ValidatorFn { | ||
return (title: AbstractControl): ValidationErrors | null => { | ||
if (title.value && title.value.trim() === '') { | ||
return { whitespace: true }; | ||
} | ||
return null; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.