mirror of
https://github.com/PretendoNetwork/juxtaposition-ui.git
synced 2026-08-24 02:05:26 -05:00
Fixed some UI bugs related to posts. Added option to ignore report. Updated text for 3DS screenshot support. Added profanity filter for posts
This commit is contained in:
@@ -14,14 +14,16 @@ const ReportSchema = new Schema({
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
note: String,
|
||||
resolved_by: Number,
|
||||
resolved_at: Date,
|
||||
});
|
||||
|
||||
ReportSchema.methods.resolve = async function(pid) {
|
||||
ReportSchema.methods.resolve = async function(pid, note) {
|
||||
this.set('resolved', true);
|
||||
this.set('resolved_by', pid);
|
||||
this.set('resolved_at', new Date());
|
||||
this.set('note', note);
|
||||
await this.save();
|
||||
};
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ router.get('/', async function (req, res) {
|
||||
});
|
||||
|
||||
router.delete('/:reportID', async function (req, res) {
|
||||
if (!req.moderator) {
|
||||
return res.sendStatus(401);
|
||||
}
|
||||
|
||||
const report = await database.getReportById(req.params.reportID);
|
||||
if (!report) {
|
||||
return res.sendStatus(402);
|
||||
@@ -51,12 +55,23 @@ router.delete('/:reportID', async function (req, res) {
|
||||
return res.sendStatus(404);
|
||||
}
|
||||
|
||||
await post.removePost(req.query.reason ? req.query.reason : 'Removed by moderator', req.pid);
|
||||
await report.resolve(req.pid, req.query.reason ? req.query.reason : 'Removed by moderator');
|
||||
|
||||
return res.sendStatus(200);
|
||||
});
|
||||
|
||||
router.put('/:reportID', async function (req, res) {
|
||||
if (!req.moderator) {
|
||||
return res.sendStatus(401);
|
||||
}
|
||||
|
||||
await post.removePost(req.query.reason ? req.query.reason : 'Removed by moderator', req.pid);
|
||||
await report.resolve(req.pid);
|
||||
const report = await database.getReportById(req.params.reportID);
|
||||
if (!report) {
|
||||
return res.sendStatus(402);
|
||||
}
|
||||
|
||||
await report.resolve(req.pid, req.query.reason);
|
||||
|
||||
return res.sendStatus(200);
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
<div class="image-selector dropdown">
|
||||
<button id="screenshot-button" type="button" data-toggle="dropdown" class="dropdown-toggle" data-sound="SE_WAVE_BALLOON_OPEN"
|
||||
onclick="window.alert(cave.capture_getLowerImage())">
|
||||
onclick="window.alert('Screenshots are not ready yet. Check back soon!')">
|
||||
<img class="preview-image sprite" src="">
|
||||
</button>
|
||||
<input id="screenshot-value" type="hidden" name="screenshot" value="">
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<menu class="textarea-menu">
|
||||
<li class="textarea-menu-text">
|
||||
<input type="radio" name="_post_type" value="body" checked data-sound="">
|
||||
<textarea name="body" class="textarea-text" value="" maxlength="280" placeholder="Enter text here..."></textarea>
|
||||
<textarea name="body" class="textarea-text" value="" maxlength="280" placeholder="Enter text here..." onchange="if(wiiuFilter.checkWord(this.value) === -2) { this.value = ''; alert('<%= lang.user_settings.swearing %>');}"></textarea>
|
||||
</li>
|
||||
<li class="textarea-menu-memo">
|
||||
<input type="radio" name="_post_type" value="painting" data-sound="" onclick="newPainting(false)">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<% if(locals.mainPost === undefined) locals.mainPost = false; %>
|
||||
<div id="post-<%= post.id %>" class="post <%if(reply) {%>reply<%}%> <%if(post.is_spoiler) {%>spoiler<%}%>">
|
||||
<% if(post.removed) {%>
|
||||
<div class="post-body-content removed">
|
||||
@@ -53,7 +54,7 @@
|
||||
</div>
|
||||
<div class="post-buttons">
|
||||
<button type="button" class="submit yeah-button <%if(post.yeahs && post.yeahs.indexOf(userContent.pid) !== -1){ %> selected <%}%>" data-post="<%= post.id %>"></button>
|
||||
<a <%if(!yeah && !reply) {%>href="/posts/<%= post.id %>"<%}%> class="to-permalink-button" data-pjax="#body">
|
||||
<a <%if(!reply) {%>href="/posts/<%= post.id %>"<%}%> class="to-permalink-button" data-pjax="#body">
|
||||
<% if(reply && post.pid !== pid && !moderator) {%>
|
||||
<div>
|
||||
<button type="button" class="submit report" data-post="<%= post.id %>" onclick="reportPost(this)"></button>
|
||||
@@ -64,7 +65,7 @@
|
||||
<button type="button" class="submit remove" data-post="<%= post.id %>" onclick="deletePost(this)"></button>
|
||||
</div>
|
||||
<%}%>
|
||||
<%if(!yeah) {%>
|
||||
<%if(!mainPost) {%>
|
||||
<span class="feeling" id="count-<%= post.id %>"><%=post.empathy_count %></span>
|
||||
<%if(!reply) {%>
|
||||
<span class="reply"><%=post.reply_count %></span>
|
||||
@@ -74,12 +75,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%if(yeah && post.yeahs.length > 0) {%>
|
||||
<%if(locals.mainPost && post.yeahs.length > 0) {%>
|
||||
<h6 class="yeah-text"><span class="feeling" id="count-<%= post.id %>"><%=post.empathy_count %></span> people gave this post a yeah.</h6>
|
||||
<div class="yeah-list">
|
||||
<%for(var yeah of post.yeahs) {%>
|
||||
<a href="/users/<%= yeah %>" class="mii-icon-container" data-pjax="#body">
|
||||
<img src="https://mii.olv.pretendo.cc/mii/<%= yeah %>/normal_face.png" class="mii-icon">
|
||||
<% var yeahCount = post.yeahs.length > 10 ? 10 : post.yeahs.length %>
|
||||
<%for(var i = 0; i < yeahCount; i++) {%>
|
||||
<a href="/users/<%= post.yeahs[i] %>" class="mii-icon-container" data-pjax="#body">
|
||||
<img src="https://mii.olv.pretendo.cc/mii/<%= post.yeahs[i] %>/normal_face.png" class="mii-icon">
|
||||
</a>
|
||||
<%}%>
|
||||
</div>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
</header>
|
||||
<div class="body-content post-list" id="post">
|
||||
<div class="post-wrapper parent">
|
||||
<%- include('partials/post_template', { post: post, mii_image_CDN: mii_image_CDN, lang: lang, reply: false, pid: pid, yeah: true }); %>
|
||||
<%- include('partials/post_template', { post: post, mii_image_CDN: mii_image_CDN, lang: lang, reply: false, pid: pid, mainPost: true }); %>
|
||||
</div>
|
||||
<% replies.forEach(function(post) { %>
|
||||
<%- include('partials/post_template', { post: post, mii_image_CDN: mii_image_CDN, lang: lang, reply: true, pid: pid }); %>
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
<% let post = posts.find((post) => post.id === report.post_id) %>
|
||||
<%- include('partials/post_template', { post: post, mii_image_CDN: mii_image_CDN, lang: lang, reply: false }); %>
|
||||
<button onclick="remove(this)" data-id="<%=report._id%>">Remove Post</button>
|
||||
<button onclick="ignore(this)" data-id="<%=report._id%>">Ignore Report</button>
|
||||
</li>
|
||||
|
||||
<% });} %>
|
||||
@@ -85,7 +86,18 @@
|
||||
method: 'DELETE',
|
||||
})
|
||||
.then(res => res.text())
|
||||
.then(res => console.log(res))
|
||||
.then(res => location.reload())
|
||||
}
|
||||
function ignore(element) {
|
||||
const id = element.getAttribute("data-id");
|
||||
const reason = prompt("Provide explanation for ignoring this report:")
|
||||
if(!id || !reason) return;
|
||||
|
||||
fetch(`/admin/${id}?reason=${reason}`, {
|
||||
method: 'PUT',
|
||||
})
|
||||
.then(res => res.text())
|
||||
.then(res => location.reload())
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user