Merge branch 'lf/dm-not-hotfix' (#3919)

* origin/lf/dm-not-hotfix:
  interface: correctly handle DM notifications
  interface: do not crash on DM notifications

Signed-off-by: Matilde Park <matilde.park@gmail.com>
This commit is contained in:
Matilde Park 2020-11-12 00:02:23 -05:00
commit 4dfd1fc2fe
4 changed files with 21 additions and 7 deletions

View File

@ -46,7 +46,7 @@ export function ChatNotification(props: {
const group = props.groups[groupPath];
const desc = describeNotification(mention, contents.length);
const groupContacts = props.contacts[groupPath];
const groupContacts = props.contacts[groupPath] || {};
const onClick = useCallback(() => {
if (props.archived) {
@ -74,7 +74,8 @@ export function ChatNotification(props: {
/>
<Col pb="3" pl="5">
{_.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 (
<Link key={idx} to={to}>
<ChatMessage

View File

@ -63,7 +63,7 @@ export function Header(props: {
const time = moment(props.time).format("HH:mm");
const groupTitle =
props.associations.contacts?.[props.group]?.metadata?.title || props.group;
props.associations.contacts?.[props.group]?.metadata?.title;
const app = props.chat ? 'chat' : 'graph';
const channelTitle =
@ -87,8 +87,12 @@ export function Header(props: {
{!!moduleIcon && <Icon icon={moduleIcon as any} />}
{!!channel && <Text fontWeight="500">{channelTitle}</Text>}
<Rule vertical height="12px" />
<Text fontWeight="500">{groupTitle}</Text>
<Rule vertical height="12px"/>
{groupTitle &&
<>
<Text fontWeight="500">{groupTitle}</Text>}
<Rule vertical height="12px"/>
</>
}
<Text fontWeight="regular" color="lightGray">
{time}
</Text>

View File

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

View File

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