mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-21 14:47:46 -04:00
Revert notificatoins
This commit is contained in:
@@ -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}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user