Add comment response to private messages
This commit is contained in:
parent
280bf8df70
commit
0723077d19
|
@ -252,7 +252,7 @@ section.thread-target {
|
|||
|
||||
section.thread-target.private {
|
||||
border: var(--pico) solid var(--violet);
|
||||
border-left: var(--micro) solid var(--violet);
|
||||
border-left: var(--milli) solid var(--violet);
|
||||
border-color: var(--violet);
|
||||
box-shadow: 0 0 var(--micro) var(--violet);
|
||||
}
|
||||
|
|
|
@ -748,6 +748,12 @@ const post = {
|
|||
const parentFork = lodash.get(parent, 'value.content.fork')
|
||||
const parentRoot = lodash.get(parent, 'value.content.root', parentKey)
|
||||
|
||||
const isPrivate = lodash.get(parent, 'value.meta.private', false)
|
||||
|
||||
if (isPrivate) {
|
||||
message.recps = lodash.get(parent, 'value.content.recps')
|
||||
}
|
||||
|
||||
const parentHasFork = parentFork != null
|
||||
|
||||
message.root = parentHasFork ? parentKey : parentRoot
|
||||
|
|
|
@ -34,15 +34,24 @@ module.exports = async ({ messages, myFeedId, parentMessage }) => {
|
|||
const action = `/comment/${encodeURIComponent(messages[0].key)}`
|
||||
const method = 'post'
|
||||
|
||||
console.log(parentMessage.value)
|
||||
const isPrivate = parentMessage.value.meta.private
|
||||
|
||||
const publicOrPrivate = isPrivate ? 'private' : 'public'
|
||||
const maybeReplyText = isPrivate ? null : [
|
||||
'Messages cannot be edited or deleted. To respond to an individual message, select ',
|
||||
strong('reply'),
|
||||
' instead.'
|
||||
]
|
||||
|
||||
return template(
|
||||
messageElements,
|
||||
p('Write a ',
|
||||
strong('public comment'),
|
||||
strong(`${publicOrPrivate} comment`),
|
||||
' on this thread with ',
|
||||
a({ href: 'https://commonmark.org/help/' }, 'Markdown'),
|
||||
'. Messages cannot be edited or deleted. To respond to an individual message, select ',
|
||||
strong('reply'),
|
||||
' instead.'
|
||||
'.',
|
||||
maybeReplyText
|
||||
),
|
||||
form({ action, method },
|
||||
textarea({
|
||||
|
|
|
@ -155,7 +155,7 @@ module.exports = ({ msg }) => {
|
|||
class: likeButton.class
|
||||
},
|
||||
`❤ ${likeCount}`)),
|
||||
isPrivate ? null : a({ href: url.comment }, 'comment'),
|
||||
a({ href: url.comment }, 'comment'),
|
||||
(isPrivate || isRoot || isFork) ? null : a({ href: url.reply }, 'reply'),
|
||||
a({ href: url.json }, 'json')
|
||||
))
|
||||
|
|
Loading…
Reference in New Issue