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