Revert notificatoins

This commit is contained in:
Gregory Schier
2017-07-31 14:14:16 -07:00
parent bc4d4a044d
commit 38fe4a83dc
3 changed files with 18 additions and 40 deletions

View File

@@ -1,6 +1,7 @@
import React, {PureComponent, PropTypes} from 'react';
import SidebarRequestRow from './sidebar-request-row';
import SidebarRequestGroupRow from './sidebar-request-group-row';
import * as models from '../../../models/index';
class SidebarChildren extends PureComponent {
_renderChildren (children) {
@@ -25,7 +26,7 @@ class SidebarChildren extends PureComponent {
return null;
}
if (child.doc.type === 'Request') {
if (child.doc.type === models.request.type) {
return (
<SidebarRequestRow
key={child.doc._id}

View File

@@ -84,7 +84,6 @@ class SidebarRequestGroupRow extends PureComponent {
'sidebar__item sidebar__item--big', {'sidebar__item--active': isActive}
)}>
{button}
<div className="sidebar__actions">
<RequestGroupActionsDropdown
ref={this._setRequestGroupActionsDropdownRef}
@@ -99,7 +98,7 @@ class SidebarRequestGroupRow extends PureComponent {
</div>
<ul className={classnames('sidebar__list', {'sidebar__list--collapsed': isCollapsed})}>
{children.length > 0 ? children : (
{!isCollapsed && children.length > 0 ? children : (
<SidebarRequestRow
handleActivateRequest={misc.nullFn}
handleDuplicateRequest={misc.nullFn}

View File

@@ -45,44 +45,22 @@ class Toast extends PureComponent {
let notification;
// Try fetching user notification
if (isLoggedIn()) {
try {
const data = {
lastLaunch: stats.lastLaunch,
firstLaunch: stats.created,
launches: stats.launches,
platform: constants.getAppPlatform(),
version: constants.getAppVersion(),
requests: await db.count(models.request.type),
requestGroups: await db.count(models.requestGroup.type),
environments: await db.count(models.environment.type),
workspaces: await db.count(models.workspace.type)
};
try {
const data = {
lastLaunch: stats.lastLaunch,
firstLaunch: stats.created,
launches: stats.launches,
platform: constants.getAppPlatform(),
version: constants.getAppVersion(),
requests: await db.count(models.request.type),
requestGroups: await db.count(models.requestGroup.type),
environments: await db.count(models.environment.type),
workspaces: await db.count(models.workspace.type)
};
notification = await fetch.post(`/notification`, data);
} catch (err) {
console.warn('[toast] Failed to fetch user notifications', err);
}
}
// Try fetching guest version-specific notification
if (!notification || this._hasSeenNotification(notification)) {
try {
notification = await fetch.get(
`https://insomnia.rest/notifications/v${constants.getAppVersion()}.json`
);
} catch (err) {
console.warn('[toast] Failed to fetch version notifications', err);
}
}
// Try fetching guest generic notification
if (!notification || this._hasSeenNotification(notification)) {
try {
notification = await fetch.get('https://insomnia.rest/notifications/all.json');
} catch (err) {
console.warn('[toast] Failed to fetch generic notifications', err);
}
notification = await fetch.post(`/notification`, data);
} catch (err) {
console.warn('[toast] Failed to fetch user notifications', err);
}
// No new notifications