Skip to content

Commit a2e4517

Browse files
committedSep 27, 2020
feat: отображение репостов во вложении записи на стене
1 parent 1031bc0 commit a2e4517

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed
 

Diff for: ‎src/components/messages/chat/attachments/ForwardedMessage.vue

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
:fwdDepth="fwdDepth + 1"
4343
/>
4444
</template>
45+
46+
<slot name="afterContent" />
4547
</div>
4648
</div>
4749
</template>

Diff for: ‎src/components/messages/chat/attachments/Wall.vue

+21-9
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
<div class="attach_title">{{ l('im_attachments', 'wall', [], 1) }}</div>
44

55
<div class="attach_forwarded attach_left_border">
6-
<ForwardedMessage :msg="fakeMsg" />
6+
<ForwardedMessage :msg="fakeMsg">
7+
<template v-if="postReply" v-slot:afterContent>
8+
<div class="attach_forwarded attach_left_border">
9+
<ForwardedMessage :msg="postReply" />
10+
</div>
11+
</template>
12+
</ForwardedMessage>
713

814
<div class="outline_button" @click="openWall">
915
{{ l('im_open_wall') }}
@@ -27,23 +33,29 @@ export default {
2733
electron.shell.openItem(`https://vk.com/wall${attach.to_id}_${attach.id}`);
2834
}
2935
36+
function generateMessage(attach) {
37+
return {
38+
from: attach.from_id,
39+
date: attach.date,
40+
text: attach.text.replace(/\n/g, '<br>'),
41+
attachments: parseAttachments(attach.attachments || []),
42+
isContentDeleted: !attach.text && !attach.attachments && !attach.copy_history
43+
};
44+
}
45+
3046
if (attach.geo) {
3147
(attach.attachments || (attach.attachments = [])).push({
3248
type: 'geo',
3349
geo: attach.geo
3450
});
3551
}
3652
53+
const postReply = attach.copy_history && attach.copy_history[0];
54+
3755
return {
3856
openWall,
39-
40-
fakeMsg: {
41-
from: attach.from_id,
42-
date: attach.date,
43-
text: attach.text.replace(/\n/g, '<br>'),
44-
attachments: parseAttachments(attach.attachments || []),
45-
isContentDeleted: !attach.text && !attach.attachments
46-
}
57+
fakeMsg: generateMessage(attach),
58+
postReply: postReply && generateMessage(postReply)
4759
};
4860
}
4961
};

0 commit comments

Comments
 (0)