Display tombstone in place of deleted post, #138
This commit is contained in:
parent
19f01ba709
commit
87029e8abf
|
@ -77,7 +77,7 @@ const makeMapStateToProps = () => {
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
ancestorsIds = ancestorsIds.withMutations(mutable => {
|
ancestorsIds = ancestorsIds.withMutations(mutable => {
|
||||||
let id = status.get('in_reply_to_id');
|
let id = state.getIn(['contexts', 'inReplyTos', status.get('id')]);
|
||||||
|
|
||||||
while (id) {
|
while (id) {
|
||||||
mutable.unshift(id);
|
mutable.unshift(id);
|
||||||
|
@ -409,8 +409,16 @@ class Status extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderChildren(list) {
|
renderTombstone(id) {
|
||||||
return list.map(id => (
|
return (
|
||||||
|
<div className='tombstone'>
|
||||||
|
<p><FormattedMessage id='statuses.tombstone' defaultMessage='One or more posts is no longer available.' /></p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderStatus(id) {
|
||||||
|
return (
|
||||||
<StatusContainer
|
<StatusContainer
|
||||||
key={id}
|
key={id}
|
||||||
id={id}
|
id={id}
|
||||||
|
@ -418,7 +426,17 @@ class Status extends ImmutablePureComponent {
|
||||||
onMoveDown={this.handleMoveDown}
|
onMoveDown={this.handleMoveDown}
|
||||||
contextType='thread'
|
contextType='thread'
|
||||||
/>
|
/>
|
||||||
));
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderChildren(list) {
|
||||||
|
return list.map(id => {
|
||||||
|
if (id.startsWith('tombstone-')) {
|
||||||
|
return this.renderTombstone(id);
|
||||||
|
} else {
|
||||||
|
return this.renderStatus(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setRef = c => {
|
setRef = c => {
|
||||||
|
|
|
@ -27,6 +27,15 @@ const normalizeContext = (immutableState, id, ancestors, descendants) => immutab
|
||||||
|
|
||||||
ancestors.forEach(addReply);
|
ancestors.forEach(addReply);
|
||||||
descendants.forEach(addReply);
|
descendants.forEach(addReply);
|
||||||
|
|
||||||
|
if (ancestors.length > 0 && !inReplyTos.get(id)) {
|
||||||
|
const tombstoneId = `tombstone-${id}`;
|
||||||
|
const { id: lastId } = ancestors[ancestors.length - 1];
|
||||||
|
replies.update(tombstoneId, ImmutableOrderedSet(), siblings => siblings.add(id).sort());
|
||||||
|
replies.update(lastId, ImmutableOrderedSet(), siblings => siblings.add(tombstoneId).sort());
|
||||||
|
inReplyTos.set(id, tombstoneId);
|
||||||
|
inReplyTos.set(tombstoneId, lastId);
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
|
@ -658,3 +658,14 @@ a.status-card.compact:hover {
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tombstone {
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 14px;
|
||||||
|
border-bottom: 1px solid var(--brand-color--faint);
|
||||||
|
color: var(--primary-text-color--faint);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue