switch to new share spec
This commit is contained in:
parent
4fd24c0414
commit
994305ccff
3 changed files with 14 additions and 13 deletions
|
@ -243,7 +243,7 @@ button.nav > img.icon {
|
||||||
border-top: 1px solid var(--clrBorder);
|
border-top: 1px solid var(--clrBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
.timestamp, .replying-to, .boosted-by {
|
.timestamp, .replying-to, .shared-by {
|
||||||
font-size: var(--fsSmall);
|
font-size: var(--fsSmall);
|
||||||
color: var(--clrTextLight);
|
color: var(--clrTextLight);
|
||||||
}
|
}
|
||||||
|
|
|
@ -947,8 +947,7 @@ function delete_post_confirm(evid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function shouldnt_render_event(our_pk, view, ev, opts) {
|
function shouldnt_render_event(our_pk, view, ev, opts) {
|
||||||
return !opts.is_boost_event &&
|
return !opts.is_composing &&
|
||||||
!opts.is_composing &&
|
|
||||||
!view.expanded.has(ev.id) &&
|
!view.expanded.has(ev.id) &&
|
||||||
view.rendered.has(ev.id)
|
view.rendered.has(ev.id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,17 +96,19 @@ function render_unknown_event(damus, ev) {
|
||||||
return "Unknown event " + ev.kind
|
return "Unknown event " + ev.kind
|
||||||
}
|
}
|
||||||
|
|
||||||
function render_boost(damus, view, ev, opts) {
|
function render_share(damus, view, ev, opts) {
|
||||||
//todo validate content
|
//todo validate content
|
||||||
if (!ev.json_content)
|
const shared_ev = damus.all_events[ev.refs && ev.refs.root]
|
||||||
|
// share isn't resolved yet. that's ok, we can render this when we have
|
||||||
|
// the event
|
||||||
|
if (!shared_ev)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
//const profile = model.profiles[ev.pubkey]
|
opts.shared = {
|
||||||
opts.boosted = {
|
|
||||||
pubkey: ev.pubkey,
|
pubkey: ev.pubkey,
|
||||||
profile: damus.profiles[ev.pubkey]
|
profile: damus.profiles[ev.pubkey]
|
||||||
}
|
}
|
||||||
return render_event(damus, view, ev.json_content, opts)
|
return render_event(damus, view, shared_ev, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
function render_comment_body(damus, ev, opts) {
|
function render_comment_body(damus, ev, opts) {
|
||||||
|
@ -117,7 +119,7 @@ function render_comment_body(damus, ev, opts) {
|
||||||
return `
|
return `
|
||||||
<div>
|
<div>
|
||||||
${render_replying_to(damus, ev)}
|
${render_replying_to(damus, ev)}
|
||||||
${render_boosted_by(ev, opts)}
|
${render_shared_by(ev, opts)}
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
${format_content(ev, show_media)}
|
${format_content(ev, show_media)}
|
||||||
|
@ -127,13 +129,13 @@ function render_comment_body(damus, ev, opts) {
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
function render_boosted_by(ev, opts) {
|
function render_shared_by(ev, opts) {
|
||||||
const b = opts.boosted
|
const b = opts.shared
|
||||||
if (!b) {
|
if (!b) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return `
|
return `
|
||||||
<div class="boosted-by">
|
<div class="shared-by">
|
||||||
Shared by ${render_name(b.pubkey, b.profile)}
|
Shared by ${render_name(b.pubkey, b.profile)}
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
|
@ -157,7 +159,7 @@ function render_deleted_comment_body(ev, deleted) {
|
||||||
|
|
||||||
function render_event(damus, view, ev, opts={}) {
|
function render_event(damus, view, ev, opts={}) {
|
||||||
if (ev.kind === 6)
|
if (ev.kind === 6)
|
||||||
return render_boost(damus, view, ev, opts)
|
return render_share(damus, view, ev, opts)
|
||||||
if (shouldnt_render_event(damus.pubkey, view, ev, opts))
|
if (shouldnt_render_event(damus.pubkey, view, ev, opts))
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue