edit thread fixes
parent
6531e692f7
commit
579ed14344
|
@ -254,11 +254,11 @@ document.body.append(html.node`
|
||||||
<hr class='separator' color='#505050'>
|
<hr class='separator' color='#505050'>
|
||||||
<div id='thread' class='column'>
|
<div id='thread' class='column'>
|
||||||
<div id='content'>
|
<div id='content'>
|
||||||
<div id='title'>
|
<div id='titlebar'>
|
||||||
<span>thread: <strong id='threadname'>meow</strong></span>
|
<span id='title'>thread: <strong id='threadname'>meow</strong></span>
|
||||||
<button id='edit' class='hidden' onclick=${editThread}>edit</button>
|
<button id='edit' class='hidden' onclick=${editThread}>edit</button>
|
||||||
</div>
|
</div>
|
||||||
<div id='buttons'>
|
<div id='buttonbar'>
|
||||||
<div id='tabs'>
|
<div id='tabs'>
|
||||||
<button id='messagetab' class='tab active' onclick=${clickedTab}>messages
|
<button id='messagetab' class='tab active' onclick=${clickedTab}>messages
|
||||||
</button><button id='spacetab' class='tab' onclick=${clickedTab}>space</button>
|
</button><button id='spacetab' class='tab' onclick=${clickedTab}>space</button>
|
||||||
|
|
|
@ -61,6 +61,10 @@
|
||||||
&::placeholder {
|
&::placeholder {
|
||||||
color: #aaa;
|
color: #aaa;
|
||||||
}
|
}
|
||||||
|
&[type='radio'] {
|
||||||
|
position: relative;
|
||||||
|
top: 2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#register {
|
#register {
|
||||||
margin-inline: 14px;
|
margin-inline: 14px;
|
||||||
|
@ -155,11 +159,14 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
#title, #buttons {
|
#titlebar, #buttonbar {
|
||||||
margin: 4px 2px;
|
margin: 2px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
#title {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
.tab {
|
.tab {
|
||||||
padding: 5px 7px;
|
padding: 5px 7px;
|
||||||
background-color: #1f1f1f;
|
background-color: #1f1f1f;
|
||||||
|
|
|
@ -97,6 +97,15 @@ const edit_thread = async (msg, respond) => {
|
||||||
if (!await setPermission('everyone', 'post', 'false'))
|
if (!await setPermission('everyone', 'post', 'false'))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
permissions.everyone.view.value = permissions.everyone.view.value === 'true';
|
||||||
|
permissions.everyone.post.value = permissions.everyone.post.value === 'true';
|
||||||
|
if (!permissions.members) permissions.members = {};
|
||||||
|
if (!permissions.members.view)
|
||||||
|
permissions.members.view = { value: 'true', mutable: true };
|
||||||
|
if (!permissions.members.post)
|
||||||
|
permissions.members.post = { value: 'true', mutable: true };
|
||||||
|
permissions.members.view.value = permissions.members.view.value === 'true';
|
||||||
|
permissions.members.post.value = permissions.members.post.value === 'true';
|
||||||
if (!msg.permissions || !msg.permissions.view_limited) {
|
if (!msg.permissions || !msg.permissions.view_limited) {
|
||||||
for (let username in vybe.users) {
|
for (let username in vybe.users) {
|
||||||
for (let socket of vybe.users[username].sockets) {
|
for (let socket of vybe.users[username].sockets) {
|
||||||
|
@ -115,7 +124,7 @@ const edit_thread = async (msg, respond) => {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (let member of (await db.query(
|
for (let member of (await db.query(
|
||||||
`select user.name from thread
|
`select user.name, user.id from thread
|
||||||
join member on thread.id = member.thread
|
join member on thread.id = member.thread
|
||||||
join user on user.id = member.user
|
join user on user.id = member.user
|
||||||
where thread.id = ?`,
|
where thread.id = ?`,
|
||||||
|
@ -131,6 +140,7 @@ const edit_thread = async (msg, respond) => {
|
||||||
is_member: true,
|
is_member: true,
|
||||||
view: true,
|
view: true,
|
||||||
post: true,
|
post: true,
|
||||||
|
admin: member.id === msg.auth_user.id && perms.admin,
|
||||||
...permissions
|
...permissions
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,7 +49,7 @@ const get_thread = async (msg, respond) => {
|
||||||
function makeBool(type, permission) {
|
function makeBool(type, permission) {
|
||||||
if (perms[type]) {
|
if (perms[type]) {
|
||||||
if (perms[type][permission])
|
if (perms[type][permission])
|
||||||
perms[type][permission].value = perms[type][permission].value === 'true' ? true : false;
|
perms[type][permission].value = perms[type][permission].value === 'true';
|
||||||
else
|
else
|
||||||
perms[type][permission] = { value: false, mutable: true };
|
perms[type][permission] = { value: false, mutable: true };
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue