Added support for hiding spoilers. Added new notification when a user responds to your post

This commit is contained in:
CaramelKat
2021-09-15 00:14:42 -05:00
committed by jay.poff@outlook.com
parent bebd6a1b7d
commit 949e66493c
8 changed files with 49 additions and 21 deletions

View File

@@ -77,11 +77,6 @@ router.get('/:post_id', function (req, res) {
lang: lang,
mii_image_CDN: config.mii_image_CDN
});
user.notification_list.filter(noti => noti.read === false).forEach(function(notification) {
notification.read = true;
});
user.markModified('notification_list');
user.save();
}).catch(error => {
console.log(error);
res.set("Content-Type", "application/xml");
@@ -145,7 +140,7 @@ router.post('/:post_id/new', upload.none(), async function (req, res, next) {
feeling_id: req.body.emotion,
id: snowflake.nextId(),
is_autopost: req.body.is_autopost,
is_spoiler: req.body.is_spoiler,
is_spoiler: (req.body.spoiler) ? 1 : 0,
is_app_jumpable: req.body.is_app_jumpable,
language_id: req.body.language_id,
mii: usrObj.mii,
@@ -158,6 +153,7 @@ router.post('/:post_id/new', upload.none(), async function (req, res, next) {
};
const newPost = new POST(document);
newPost.save();
await database.pushNewNotificationByPID(parentPost.pid, usrObj.user_id + ' replied to your post!', '/posts/' + parentPost.id)
res.redirect('/posts/' + req.params.post_id.toString());
}
}
@@ -223,7 +219,7 @@ router.post('/new', upload.none(), async function (req, res, next) {
feeling_id: req.body.emotion,
id: snowflake.nextId(),
is_autopost: req.body.is_autopost,
is_spoiler: req.body.is_spoiler,
is_spoiler: (req.body.spoiler) ? 1 : 0,
is_app_jumpable: req.body.is_app_jumpable,
language_id: req.body.language_id,
mii: usrObj.mii,

View File

@@ -126,7 +126,7 @@
</div>
<div class="community-page-header" style="background-image: url('<%= cdnURL %>/banner/<%= community.community_id %>.png')"></div>
<div class="community-page-header-overlay"></div>
<div class="community-page-back-button" onclick="window.history.back()">
<div class="community-page-back-button" onclick="back()">
<p class="user-page-back-button-text">Go back</p>
</div>
<div id="community-new-post-wrapper" <%if(user.pid === 1000000000 || user.account_status !== 0) {%> style="display: none" <%}%>>

View File

@@ -1035,6 +1035,7 @@ h4 {
.community-page-info-icon {
width: 100px;
height: 100px;
border-radius: 10px;
margin: 20px;
float: left;
@@ -1050,9 +1051,12 @@ h4 {
.community-page-description {
margin-top: 5px;
position: absolute;
margin-left: 140px;
margin-left: 150px;
width: 550px;
max-width: 500px;
line-break: anywhere;
line-height: 20px;
overflow: hidden;
}
.community-page-posts-wrapper {
@@ -1094,7 +1098,6 @@ h4 {
}
.community-page-post-screenshot {
margin-top: 20px;
width: 760px;
border-radius: 10px;
margin-bottom: 20px;
@@ -1218,6 +1221,8 @@ h4 {
.community-page-post-username {
padding-top: 20px;
margin-bottom: 0;
min-width: 140px;
max-width: 340px;
}
.community-page-post-text-overlay {
@@ -1425,8 +1430,8 @@ iframe {
font-size: large;
border-width: 0;
border-radius: 15px;
bottom: 15px;
left: 430px
bottom: -70px;
left: 430px;
}
#user-new-post-wrapper {
@@ -1808,6 +1813,7 @@ iframe {
border: 1.5px solid #ffffff00;
border-radius: 10px;
margin-top: 40px;
margin-bottom: 55px;
width: 1060px;
min-height: 190px;
}
@@ -1862,4 +1868,26 @@ iframe {
.replies-line:last-child {
display:none;
}
.spoiler-overlay {
display: grid;
height: 100px;
width: 793px;
margin-left: 10px;
margin-bottom: -10px;
z-index: 10;
}
.spoiler-overlay > button {
width: 775px;
height: 70px;
margin: auto;
background: #673DB6;
color: white;
font-size: large;
border-width: 0;
border-radius: 15px;
box-shadow: 0 3px 20px 2px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 0 3px 20px 2px rgba(0, 0, 0, 0.5);
}

View File

@@ -119,6 +119,11 @@ function exit() {
wiiuBrowser.closeApplication();
}
}
function back() {
wiiuSound.playSoundByName('SE_WAVE_MENU', 1);
wiiuBrowser.showLoadingIcon(!0);
window.history.back();
}
function showOverlay() {
wiiuSound.playSoundByName('SE_OLV_OK', 1)
wiiuSound.playSoundByName('BGM_OLV_SETTING', 3)

View File

@@ -84,7 +84,7 @@
</div>
</div>
<div class="community-page-header" style="background: #673DB6; margin-left: -75px; width: 1165px !important;"></div>
<div class="user-page-back-button" onclick="window.history.back()">
<div class="user-page-back-button" onclick="back()">
<p class="user-page-back-button-text"><%= lang.global.go_back %></p>
</div>
<div class="community-page-info-container">

View File

@@ -27,7 +27,7 @@
<% if(user.notification_list.length === 0) {%>
<p class="no-posts-text"><%= lang.notifications.none %></p>
<%} else { %>
<% let i = 0; user.notification_list.reverse().forEach(function(notification) { %>
<% let i = 0; user.notification_list.forEach(function(notification) { %>
<% if(i === 0) { %>
<tr class="message-wrapper" data-pjax="<%=notification.link%>">
<td class="messages-unread-badge-wrapper top">
@@ -49,10 +49,6 @@
</tr>
<%}%>
<%});%>
</tr>
<td></td>
<td class="messages-list-wrapper end"></td>
</tr>
<%}%>
</tbody>
</table>

View File

@@ -8,7 +8,7 @@
<span class="community-page-verified-user-badge community-page-verified" style="display: none;" data-pjax="/users/show?pid=<%= post.pid %>"></span>
<%}%>
<h2 class="community-page-post-username" data-pjax="/users/show?pid=<%= post.pid %>"><%= post.screen_name %></h2>
<h4 class="community-page-post-time-stamp"><%= moment(post.created_at).fromNow() %> - <p onclick="pjax.loadUrl('/communities/<%= post.community_id %>/new')"><%= communityMap.get(post.community_id) %></p></h4>
<h4 class="community-page-post-time-stamp"><%= moment(post.created_at).fromNow() %> - <p onclick="wiiuSound.playSoundByName('SE_WAVE_MENU', 1);pjax.loadUrl('/communities/<%= post.community_id %>/new')"><%= communityMap.get(post.community_id) %></p></h4>
<div class="community-page-post-yeah-button-wrapper <%if(user.likes.indexOf(post.id) !== -1){ %> selected <%}%>">
<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 33 30">
@@ -26,7 +26,10 @@
</div>
<div id="yeah-<%= post.id %>" class="community-page-post-yeah-count"><%= post.empathy_count %> <%= lang.global.yeahs %></div>
</div>
<div class="community-page-post-wrapper" <%if(!reply){%>onclick="pjax.loadUrl('/posts/<%= post.id%>')"<%}%>>
<div class="spoiler-overlay" <% if(post.is_spoiler === 0) {%>style="display: none"<%}%>>
<button onclick="wiiuSound.playSoundByName('SE_WAVE_MENU', 1); this.parentElement.style.display = 'none'; document.getElementById('post-content-<%= post.id%>').style.display = 'block'">Click to Show Spoiler</button>
</div>
<div class="community-page-post-wrapper" id="post-content-<%= post.id%>" <%if(!reply){%>onclick="wiiuSound.playSoundByName('SE_WAVE_MENU', 1); pjax.loadUrl('/posts/<%= post.id%>')"<%}%> <% if(post.is_spoiler === 1) {%>style="display: none"<%}%>>
<% if(post.body !== '' && post.painting === '' && post.screenshot === '' && !post.url) { %>
<h3><%= post.body %></h3>
<%} else { %>

View File

@@ -25,7 +25,7 @@
<%- include('nav_bar', { selection: -1 }); %>
<div id="main">
<div class="community-page-header" style="background: #673DB6;margin-left: -150px;"></div>
<div class="user-page-back-button" onclick="window.history.back()">
<div class="user-page-back-button" onclick="back()">
<p class="user-page-back-button-text"><%= lang.global.go_back %></p>
</div>
<div class="community-page-info-container">