interface: correctly handle DM notifications

This commit is contained in:
Liam Fitzgerald 2020-11-12 14:47:24 +10:00
parent f97fe15d7a
commit e3876ccc63
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB
3 changed files with 13 additions and 3 deletions

View File

@ -74,7 +74,8 @@ export function ChatNotification(props: {
/> />
<Col pb="3" pl="5"> <Col pb="3" pl="5">
{_.map(_.take(contents, 5), (content, idx) => { {_.map(_.take(contents, 5), (content, idx) => {
const to = `/~landscape${groupPath}/resource/chat${appPath}?msg=${content.number}`; const workspace = group?.hidden ? '/home' : groupPath;
const to = `/~landscape${workspace}/resource/chat${appPath}?msg=${content.number}`;
return ( return (
<Link key={idx} to={to}> <Link key={idx} to={to}>
<ChatMessage <ChatMessage

View File

@ -3,7 +3,7 @@ import f from "lodash/fp";
import _ from "lodash"; import _ from "lodash";
import { Icon, Col, Row, Box, Text, Anchor } from "@tlon/indigo-react"; import { Icon, Col, Row, Box, Text, Anchor } from "@tlon/indigo-react";
import moment from "moment"; import moment from "moment";
import { Notifications, Rolodex, Timebox, IndexedNotification } from "~/types"; import { Notifications, Rolodex, Timebox, IndexedNotification, Groups } from "~/types";
import { MOMENT_CALENDAR_DATE, daToUnix } from "~/logic/lib/util"; import { MOMENT_CALENDAR_DATE, daToUnix } from "~/logic/lib/util";
import { BigInteger } from "big-integer"; import { BigInteger } from "big-integer";
import GlobalApi from "~/logic/api/global"; import GlobalApi from "~/logic/api/global";
@ -35,6 +35,7 @@ function filterNotification(associations: Associations, groups: string[]) {
export default function Inbox(props: { export default function Inbox(props: {
notifications: Notifications; notifications: Notifications;
archive: Notifications; archive: Notifications;
groups: Groups;
showArchive?: boolean; showArchive?: boolean;
api: GlobalApi; api: GlobalApi;
associations: Associations; associations: Associations;
@ -129,6 +130,7 @@ export default function Inbox(props: {
contacts={props.contacts} contacts={props.contacts}
archive={!!props.showArchive} archive={!!props.showArchive}
associations={props.associations} associations={props.associations}
groups={props.groups}
graphConfig={props.notificationsGraphConfig} graphConfig={props.notificationsGraphConfig}
groupConfig={props.notificationsGroupConfig} groupConfig={props.notificationsGroupConfig}
chatConfig={props.notificationsChatConfig} chatConfig={props.notificationsChatConfig}
@ -147,6 +149,7 @@ export default function Inbox(props: {
archive={!!props.showArchive} archive={!!props.showArchive}
associations={props.associations} associations={props.associations}
api={api} api={api}
groups={props.groups}
graphConfig={props.notificationsGraphConfig} graphConfig={props.notificationsGraphConfig}
groupConfig={props.notificationsGroupConfig} groupConfig={props.notificationsGroupConfig}
chatConfig={props.notificationsChatConfig} chatConfig={props.notificationsChatConfig}
@ -170,6 +173,7 @@ function sortIndexedNotification(
function DaySection({ function DaySection({
contacts, contacts,
groups,
archive, archive,
timeboxes, timeboxes,
latest = false, latest = false,
@ -210,6 +214,7 @@ function DaySection({
notification={not} notification={not}
archived={archive} archived={archive}
contacts={contacts} contacts={contacts}
groups={groups}
time={date} time={date}
/> />
</React.Fragment> </React.Fragment>

View File

@ -8,7 +8,9 @@ import {
NotificationGraphConfig, NotificationGraphConfig,
GroupNotificationsConfig, GroupNotificationsConfig,
NotifIndex, NotifIndex,
Groups,
Associations, Associations,
Contacts,
} from "~/types"; } from "~/types";
import GlobalApi from "~/logic/api/global"; import GlobalApi from "~/logic/api/global";
import { getParentIndex } from "~/logic/lib/notification"; import { getParentIndex } from "~/logic/lib/notification";
@ -24,6 +26,8 @@ interface NotificationProps {
associations: Associations; associations: Associations;
api: GlobalApi; api: GlobalApi;
archived: boolean; archived: boolean;
groups: Groups;
contacts: Contacts;
graphConfig: NotificationGraphConfig; graphConfig: NotificationGraphConfig;
groupConfig: GroupNotificationsConfig; groupConfig: GroupNotificationsConfig;
chatConfig: string[]; chatConfig: string[];
@ -172,7 +176,7 @@ export function Notification(props: NotificationProps) {
contacts={props.contacts} contacts={props.contacts}
read={read} read={read}
archived={archived} archived={archived}
groups={{}} groups={props.groups}
timebox={props.time} timebox={props.time}
time={time} time={time}
associations={associations} associations={associations}