Page MenuHomePhabricator

[web] [lib] Introduce `getMessagePreview` function
ClosedPublic

Authored by jacek on Apr 1 2022, 7:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Sep 23, 8:21 AM
Unknown Object (File)
Mon, Sep 23, 8:21 AM
Unknown Object (File)
Mon, Sep 23, 8:21 AM
Unknown Object (File)
Mon, Sep 23, 8:21 AM
Unknown Object (File)
Mon, Sep 23, 8:21 AM
Unknown Object (File)
Thu, Sep 19, 2:43 AM
Unknown Object (File)
Sat, Sep 14, 9:56 AM
Unknown Object (File)
Sat, Sep 14, 9:56 AM

Details

Summary

Moved logic for displaying message preview data into common function, to reuse it in modal with subchannels list.
No logic changes has been made.

Test Plan

In web app, message previews in chat list should display exactly as before.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested changes to this revision.Apr 4 2022, 2:05 AM
tomek added inline comments.
lib/hooks/message-preview.js
7–12 ↗(On Diff #10956)

We can probably merge these

20 ↗(On Diff #10956)

We're not using hooks inside it, so maybe this can be a plain function instead of a hook?

25–27 ↗(On Diff #10956)

We could introduce a different return type that represents no messages and use this in message-preview instead of checking if (!originalMessageInfo) {. This value can probably be just null.

This revision now requires changes to proceed.Apr 4 2022, 2:05 AM

Changed the hook into plain function

jacek retitled this revision from [web] [lib] Introduce `useMessagePreview` hook to [web] [lib] Introduce `getMessagePreview` function.Apr 4 2022, 6:18 AM
jacek edited the summary of this revision. (Show Details)
tomek added inline comments.
lib/hooks/message-preview.js
25–27 ↗(On Diff #10956)

What do you think about this idea?

This revision is now accepted and ready to land.Apr 5 2022, 7:01 AM
lib/hooks/message-preview.js
25–27 ↗(On Diff #10956)

I think the idea is no longer valid, as after changing the hook into function, I execute it conditionally and message info is always present.