Delete thread button for threads page

This commit is contained in:
Akif9748 2022-08-31 16:25:35 +03:00
parent 3fef090992
commit c268a5bed8
5 changed files with 19 additions and 15 deletions

View file

@ -45,12 +45,10 @@ Akf-forum has got an API for AJAX, other clients etc. And, you can learn about A
- page for threads - users
- extra ratelimits
- better edits
- IP BAN fix
- IP BAN fix, user -> ips []
- message counts for API
- ZATEN SİLİNDİ BU KİŞİ & MESAJ
- delete thread for threads area
- delete admin request, moreover, add it to user patch delete 😳
- user -> ips []
### API
| To do | Is done?

View file

@ -52,7 +52,8 @@ a {
.btn-danger {
color: #e8e8e8;
background-color: #ff0000;
padding: 10px 20px 10px 20px;
padding: 0px 10px 0px 10px;
border-radius: 4px;
font-weight: 700;
margin: 10px;
@ -83,6 +84,7 @@ a {
.btn-outline-primary:hover {
border: 2px solid #4d18e6;
}
.btn-danger:hover {
background-color: #d01919;
border: 2px solid #d01919;
@ -95,6 +97,7 @@ border: 2px solid #d01919;
display: flex;
justify-content: space-around;
}
.menu-item {
padding: 10px;
font-weight: 700;

View file

@ -16,8 +16,8 @@ app.get("/:id", async (req, res) => {
if (member && (user?.admin || !member.deleted)) {
const message = await MessageModel.count({ "author.id": id });
const thread = await ThreadModel.count({ "author.id": id });
const message = await MessageModel.count({ authorID: id });
const thread = await ThreadModel.count({ authorID: id });
member.about = member.about.replaceAll("&", "&")
.replaceAll("<", "&lt;").replaceAll(">", "&gt;")
.replaceAll("\"", "&quot;").replaceAll("'", "&#39;")

View file

@ -41,7 +41,7 @@
<div class="message" id="message-<%= message.id %>">
<div class="left">
<img src="<%= message.author.avatar || '/images/guest.png' %>"/>
<div class="username"><a href="/users/<%=message.author.id %>"><%=message.author.name %></a></div>
<div class="username"><a href="/users/<%=message.authorID %>"><%=message.author.name %></a></div>
<div class="date">
<%= new Date(message.time).toLocaleDateString() %>
</div>
@ -52,7 +52,7 @@
<div class="content"><%- message.content %></div>
<% if(user){ %>
<% if(user.id === message.author.id || user.admin){ %>
<% if(user.id === message.authorID || user.admin){ %>
<div class="dots" id="dots-<%=message.id %>" onclick="dots('<%=message.id %>')">
<% if (message.deleted){ %>

View file

@ -19,8 +19,11 @@
<%= thread.title %>
</div>
<div class="box-username">
<a class="btn-danger"><i class="fa-solid fa-trash-can"></i></a>
<% if (user && !thread.deleted){ %>
<a class="btn-danger" onclick="fetch('/api/threads/<%= thread.id %>/',{method:'DELETE'})"><i class="fa-solid fa-trash-can"></i></a>
<% } %>
<%= thread.author.name %> <div class="avatar"><img src="<%=thread.author.avatar %>"> </div>
</div>
</div>