Enable Markdown by default in all projects
GitOrigin-RevId: 433a80c79b6f8ab45cef7ab715d3e4e5e23816ad
diff --git a/static_src/elements/issue-detail/mr-issue-page/mr-issue-header.js b/static_src/elements/issue-detail/mr-issue-page/mr-issue-header.js
index 0d04d32..a2b2ef1 100644
--- a/static_src/elements/issue-detail/mr-issue-page/mr-issue-header.js
+++ b/static_src/elements/issue-detail/mr-issue-page/mr-issue-header.js
@@ -21,7 +21,6 @@
ISSUE_FLAGSPAM_PERMISSION} from 'shared/consts/permissions.js';
import {issueToIssueRef} from 'shared/convertersV0.js';
import {prpcClient} from 'prpc-client-instance.js';
-import {AVAILABLE_MD_PROJECTS, DEFAULT_MD_PROJECTS} from 'shared/md-helper.js';
const DELETE_ISSUE_CONFIRMATION_NOTICE = `\
Normally, you would just close issues by setting their status to a closed value.
@@ -140,8 +139,8 @@
render() {
const reporterIsMember = userIsMember(
this.issue.reporterRef, this.issue.projectName, this.usersProjects);
- const markdownEnabled = AVAILABLE_MD_PROJECTS.has(this.projectName);
- const markdownDefaultOn = DEFAULT_MD_PROJECTS.has(this.projectName);
+ const markdownEnabled = true;
+ const markdownDefaultOn = true;
return html`
<div class="main-text-outer">
<div class="main-text">
diff --git a/static_src/reducers/userV0.js b/static_src/reducers/userV0.js
index 42a93fc..33252c5 100644
--- a/static_src/reducers/userV0.js
+++ b/static_src/reducers/userV0.js
@@ -9,7 +9,6 @@
import {objectToMap} from 'shared/helpers.js';
import {userRefToId, userToUserRef} from 'shared/convertersV0.js';
import loadGapi, {fetchGapiEmail} from 'shared/gapi-loader.js';
-import {DEFAULT_MD_PROJECTS} from 'shared/md-helper.js';
import {viewedProjectName} from 'reducers/projectV0.js';
// Actions
@@ -179,7 +178,7 @@
currentUser, viewedProjectName, (user, projectName = '') => {
const prefs = {
// Make Markdown default to true for projects who have opted in.
- render_markdown: String(DEFAULT_MD_PROJECTS.has(projectName)),
+ render_markdown: 'true',
...user.prefs
};
for (let prefName of Object.keys(prefs)) {
diff --git a/static_src/shared/md-helper.js b/static_src/shared/md-helper.js
index 2a0fb46..d387ab8 100644
--- a/static_src/shared/md-helper.js
+++ b/static_src/shared/md-helper.js
@@ -1,12 +1,6 @@
import marked from 'marked';
import DOMPurify from 'dompurify';
-/** @type {Set} Projects that default Markdown rendering to true. */
-export const DEFAULT_MD_PROJECTS = new Set(['vulnz', 'vulnz-old', 'twpowertools', 'translateselectedtext', 'misc']);
-
-/** @type {Set} Projects that allow users to opt into Markdown rendering. */
-export const AVAILABLE_MD_PROJECTS = new Set([...DEFAULT_MD_PROJECTS]);
-
const EMAIL_REGEX = /^mailto:[-a-zA-Z0-9!#$%&'*+\/=?^_`{|}~]+(?:[.][-a-zA-Z0-9!#$%&'*+\/=?^_`{|}~]+)*@(?:(?:[0-9a-zA-Z](?:[-]*[0-9a-zA-Z]+)*)(?:\.[0-9a-zA-Z](?:[-]*[0-9a-zA-Z]+)*)*)\.(?:[a-zA-Z]{2,9})$/;
const MONORAIL_USER_REGEX = /\/u\/[-a-zA-Z0-9!#$%&'*+\/=?^_`{|}~]+(?:[.][-a-zA-Z0-9!#$%&'*+\/=?^_`{|}~]+)*@(?:(?:[0-9a-zA-Z](?:[-]*[0-9a-zA-Z]+)*)(?:\.[0-9a-zA-Z](?:[-]*[0-9a-zA-Z]+)*)*)\.(?:[a-zA-Z]{2,9})$/;
@@ -30,16 +24,14 @@
* @return {boolean} Whether this content should be rendered as Markdown.
*/
export const shouldRenderMarkdown = ({
- project, author, enabled = true, availableProjects = AVAILABLE_MD_PROJECTS
+ project, author, enabled = true
} = {}) => {
if (BLOCKLIST.has(author)) {
return false;
} else if (!enabled) {
return false;
- } else if (availableProjects.has(project)) {
- return true;
}
- return false;
+ return true;
};
/** @const {Object} Options for DOMPurify sanitizer */