@@ -5,7 +5,10 @@ import type {
5
5
SettingsState ,
6
6
} from '../types' ;
7
7
import { Notification } from '../typesGitHub' ;
8
- import { listNotificationsForAuthenticatedUser } from './api/client' ;
8
+ import {
9
+ listBitbucketWork ,
10
+ listNotificationsForAuthenticatedUser ,
11
+ } from './api/client' ;
9
12
import { determineFailureType } from './api/errors' ;
10
13
import { getAccountUUID } from './auth/utils' ;
11
14
import { hideWindow , showWindow , updateTrayIcon } from './comms' ;
@@ -116,7 +119,7 @@ function getNotifications(state: GitifyState) {
116
119
account,
117
120
notifications :
118
121
account . platform === 'Bitbucket Cloud'
119
- ? null
122
+ ? listBitbucketWork ( account )
120
123
: listNotificationsForAuthenticatedUser ( account , state . settings ) ,
121
124
} ;
122
125
} ) ;
@@ -132,22 +135,28 @@ export async function getAllNotifications(
132
135
. filter ( ( response ) => ! ! response )
133
136
. map ( async ( accountNotifications ) => {
134
137
try {
135
- let notifications = (
136
- await accountNotifications . notifications
137
- ) . data . map ( ( notification : Notification ) => ( {
138
- ...notification ,
139
- account : accountNotifications . account ,
140
- } ) ) ;
141
-
142
- notifications = await enrichNotifications ( notifications , state ) ;
143
-
144
- notifications = filterNotifications ( notifications , state . settings ) ;
145
-
146
- return {
147
- account : accountNotifications . account ,
148
- notifications : notifications ,
149
- error : null ,
150
- } ;
138
+ if ( accountNotifications . account . platform === 'Bitbucket Cloud' ) {
139
+ console . log (
140
+ JSON . stringify ( await accountNotifications . notifications ) ,
141
+ ) ;
142
+ } else {
143
+ let notifications = (
144
+ await accountNotifications . notifications
145
+ ) . data . map ( ( notification : Notification ) => ( {
146
+ ...notification ,
147
+ account : accountNotifications . account ,
148
+ } ) ) ;
149
+
150
+ notifications = await enrichNotifications ( notifications , state ) ;
151
+
152
+ notifications = filterNotifications ( notifications , state . settings ) ;
153
+
154
+ return {
155
+ account : accountNotifications . account ,
156
+ notifications : notifications ,
157
+ error : null ,
158
+ } ;
159
+ }
151
160
} catch ( error ) {
152
161
log . error (
153
162
'Error occurred while fetching account notifications' ,
0 commit comments