Admin page to approve deleteme request
This commit is contained in:
committed by
Aleksei Gurianov
parent
1d267f5db6
commit
9b5c784bdc
@@ -76,6 +76,11 @@ export const deleteMe = () =>
|
||||
url: `/deleteme?site=${siteId}`,
|
||||
});
|
||||
|
||||
export const approveDeleteMe = token =>
|
||||
fetcher.get({
|
||||
url: `/admin/deleteme?token=${token}`,
|
||||
});
|
||||
|
||||
/* admin */
|
||||
export const pinComment = ({ id, url }) =>
|
||||
fetcher.put({
|
||||
|
||||
+14
-31
@@ -1,24 +1,24 @@
|
||||
const BASE_URL = process.env.REMARK_URL;
|
||||
const API_BASE = '/api/v1';
|
||||
const NODE_ID = process.env.REMARK_NODE;
|
||||
const COUNTER_NODE_CLASSNAME = 'remark42__counter';
|
||||
const COMMENT_NODE_CLASSNAME_PREFIX = 'remark42__comment-';
|
||||
const LAST_COMMENTS_NODE_CLASSNAME = 'remark42__last-comments';
|
||||
const DEFAULT_LAST_COMMENTS_MAX = 15;
|
||||
const DEFAULT_MAX_COMMENT_SIZE = 1000;
|
||||
const MAX_SHOWN_ROOT_COMMENTS = 10;
|
||||
const DEFAULT_SORT = '-score';
|
||||
const PROVIDER_NAMES = {
|
||||
export const BASE_URL = process.env.REMARK_URL;
|
||||
export const API_BASE = '/api/v1';
|
||||
export const NODE_ID = process.env.REMARK_NODE;
|
||||
export const COUNTER_NODE_CLASSNAME = 'remark42__counter';
|
||||
export const COMMENT_NODE_CLASSNAME_PREFIX = 'remark42__comment-';
|
||||
export const LAST_COMMENTS_NODE_CLASSNAME = 'remark42__last-comments';
|
||||
export const DEFAULT_LAST_COMMENTS_MAX = 15;
|
||||
export const DEFAULT_MAX_COMMENT_SIZE = 1000;
|
||||
export const MAX_SHOWN_ROOT_COMMENTS = 10;
|
||||
export const DEFAULT_SORT = '-score';
|
||||
export const PROVIDER_NAMES = {
|
||||
google: 'Google',
|
||||
facebook: 'Facebook',
|
||||
github: 'GitHub',
|
||||
yandex: 'Yandex',
|
||||
dev: 'Dev',
|
||||
};
|
||||
const LS_COLLAPSE_KEY = '__remarkCollapsed';
|
||||
const LS_SORT_KEY = '__remarkSort';
|
||||
export const LS_COLLAPSE_KEY = '__remarkCollapsed';
|
||||
export const LS_SORT_KEY = '__remarkSort';
|
||||
|
||||
const BLOCKING_DURATIONS = [
|
||||
export const BLOCKING_DURATIONS = [
|
||||
{
|
||||
label: 'Permanently',
|
||||
value: 'permanently',
|
||||
@@ -36,20 +36,3 @@ const BLOCKING_DURATIONS = [
|
||||
value: `${60 * 24}m`,
|
||||
},
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
BASE_URL,
|
||||
API_BASE,
|
||||
NODE_ID,
|
||||
COUNTER_NODE_CLASSNAME,
|
||||
LAST_COMMENTS_NODE_CLASSNAME,
|
||||
COMMENT_NODE_CLASSNAME_PREFIX,
|
||||
DEFAULT_LAST_COMMENTS_MAX,
|
||||
DEFAULT_MAX_COMMENT_SIZE,
|
||||
MAX_SHOWN_ROOT_COMMENTS,
|
||||
PROVIDER_NAMES,
|
||||
DEFAULT_SORT,
|
||||
LS_COLLAPSE_KEY,
|
||||
LS_SORT_KEY,
|
||||
BLOCKING_DURATIONS,
|
||||
};
|
||||
|
||||
@@ -11,3 +11,4 @@ const querySettings =
|
||||
export const siteId = querySettings['site_id'];
|
||||
export const url = querySettings['url'];
|
||||
export const maxShownComments = querySettings['max_shown_comments'];
|
||||
export const token = querySettings['token'];
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
import { NODE_ID } from 'common/constants';
|
||||
import { approveDeleteMe } from 'common/api';
|
||||
import { token } from 'common/settings';
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
|
||||
function init() {
|
||||
const node = document.getElementById(NODE_ID);
|
||||
|
||||
if (!node) {
|
||||
console.error("Remark42: Can't find root node.");
|
||||
return;
|
||||
}
|
||||
approveDeleteMe(token).then(
|
||||
data =>
|
||||
(node.innerHTML = `
|
||||
<h3>User deleted successfully</h3>
|
||||
<pre>${JSON.stringify(data, null, 4)}</pre>`),
|
||||
err =>
|
||||
(node.innerHTML = `
|
||||
<h3>Something went wrong</h3>
|
||||
<pre>${err}</pre>`)
|
||||
);
|
||||
}
|
||||
@@ -30,6 +30,6 @@ export function requestDeletion() {
|
||||
deleteMe().then(data => {
|
||||
const email = store.get('config').admin_email;
|
||||
const { subject, message } = getDeleteInformationMessage(data.user_id, siteId, data.link);
|
||||
window.open(`mailto:${email}?subject=${subject}&body=${message}`);
|
||||
window.location = `mailto:${email}?subject=${subject}&body=${message}`;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>remark42</title>
|
||||
<base target="_blank">
|
||||
<style>
|
||||
html, body {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.preloader {
|
||||
width: 60px;
|
||||
text-align: center;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.preloader_view_iframe {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.preloader__bounce {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
margin-right: 3px;
|
||||
background-color: #333;
|
||||
border-radius: 100%;
|
||||
animation: iframePreloaderBounce 1.4s infinite ease-in-out both;
|
||||
}
|
||||
|
||||
.preloader__bounce:first-child {
|
||||
animation-delay: -.32s;
|
||||
}
|
||||
|
||||
.preloader__bounce:nth-child(2) {
|
||||
animation-delay: -.16s;
|
||||
}
|
||||
|
||||
.preloader__bounce:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
@keyframes iframePreloaderBounce {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
}
|
||||
|
||||
40% {
|
||||
transform: scale(1);
|
||||
}
|
||||
|
||||
80%, 100% {
|
||||
transform: scale(0);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="remark42">
|
||||
<div class="preloader preloader_view_iframe">
|
||||
<div class="preloader__bounce"></div>
|
||||
<div class="preloader__bounce"></div>
|
||||
<div class="preloader__bounce"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="deleteme.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -46,6 +46,7 @@ module.exports = {
|
||||
counter: './app/counter',
|
||||
'last-comments': './app/last-comments',
|
||||
remark: './app/remark',
|
||||
deleteme: './app/deleteme',
|
||||
},
|
||||
output: {
|
||||
path: publicFolder,
|
||||
@@ -129,7 +130,7 @@ module.exports = {
|
||||
openAnalyzer: false,
|
||||
}),
|
||||
]),
|
||||
new Copy(['./iframe.html']),
|
||||
new Copy(['./iframe.html', './deleteme.html']),
|
||||
],
|
||||
watchOptions: {
|
||||
ignored: /(node_modules|\.vendor\.js$)/,
|
||||
|
||||
Reference in New Issue
Block a user