mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: fix messages sort
This commit is contained in:
1 parent
d53d0c65e0
commit
f30898ea31
3 files changed
+7
-6
No files matched your search
@@ -67,7 +67,9 @@ export default connect(mapStateToProps)(class MessagePadDialogueContentContainer
|
|||||||
|
|
||||||
renderInner() {
|
renderInner() {
|
||||||
if (this.props.activeId === null) return [];
|
if (this.props.activeId === null) return [];
|
||||||
return this.props.item.messages.map((msg) => (
|
const sorted = this.props.item.messages
|
||||||
|
.sort((msg1, msg2) => parseMongoId(msg1._id).timestamp - parseMongoId(msg2._id).timestamp);
|
||||||
|
return sorted.map((msg) => (
|
||||||
<Message
|
<Message
|
||||||
key={msg._id}
|
key={msg._id}
|
||||||
isSelf={msg.from === UserContext._id}
|
isSelf={msg.from === UserContext._id}
|
||||||
|
|||||||
@@ -39,11 +39,10 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MessagePadDial
|
|||||||
<ListItem
|
<ListItem
|
||||||
key={dialogue._id}
|
key={dialogue._id}
|
||||||
userName={dialogue.udoc.uname}
|
userName={dialogue.udoc.uname}
|
||||||
// eslint-disable-next-line no-nested-ternary
|
summary={dialogue.messages.length
|
||||||
summary={_.last(dialogue.messages)
|
? (_.maxBy(dialogue.messages, '_id').flag & 4)
|
||||||
? (_.last(dialogue.messages).flag & 4)
|
|
||||||
? i18n('[Richtext message]')
|
? i18n('[Richtext message]')
|
||||||
: _.last(dialogue.messages).content
|
: _.maxBy(dialogue.messages, '_id').content
|
||||||
: ''}
|
: ''}
|
||||||
faceUrl={dialogue.udoc.avatarUrl}
|
faceUrl={dialogue.udoc.avatarUrl}
|
||||||
active={dialogue._id === this.props.activeId}
|
active={dialogue._id === this.props.activeId}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.38.10",
|
"version": "4.38.11",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
Reference in new issue
Block a user