This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

bug: fix no hackatime account issues

+56 -33
+43 -33
src/features/takes/handlers/settings.ts
··· 59 59 } 60 60 } 61 61 62 + const hackatimeKeys = await fetchRecentProjectKeys( 63 + user, 64 + 10, 65 + initialValues.hackatime_version as HackatimeVersion, 66 + ); 67 + 62 68 await slackClient.views.open({ 63 69 trigger_id: triggerID, 64 70 view: { ··· 185 191 })), 186 192 }, 187 193 }, 188 - { 189 - type: "input", 190 - block_id: "project_keys", 191 - label: { 192 - type: "plain_text", 193 - text: "Project Keys", 194 - }, 195 - element: { 196 - type: "multi_static_select", 197 - action_id: "project_keys_input", 198 - initial_options: 199 - initialValues.hackatime_keys.length === 0 200 - ? undefined 201 - : initialValues.hackatime_keys.map((key) => ({ 202 - text: { 203 - type: "plain_text", 204 - text: key, 205 - }, 206 - value: key, 207 - })), 208 - options: ( 209 - await fetchRecentProjectKeys( 210 - user, 211 - 10, 212 - initialValues.hackatime_version as HackatimeVersion, 213 - ) 214 - ).map((key) => ({ 215 - text: { 194 + hackatimeKeys.length > 0 195 + ? { 196 + type: "input", 197 + block_id: "project_keys", 198 + label: { 216 199 type: "plain_text", 217 - text: key, 200 + text: "Project Keys", 218 201 }, 219 - value: key, 220 - })), 221 - }, 222 - }, 202 + element: { 203 + type: "multi_static_select", 204 + action_id: "project_keys_input", 205 + initial_options: 206 + initialValues.hackatime_keys.length === 0 207 + ? undefined 208 + : initialValues.hackatime_keys.map( 209 + (key) => ({ 210 + text: { 211 + type: "plain_text", 212 + text: key, 213 + }, 214 + value: key, 215 + }), 216 + ), 217 + options: hackatimeKeys.map((key) => ({ 218 + text: { 219 + type: "plain_text", 220 + text: key, 221 + }, 222 + value: key, 223 + })), 224 + }, 225 + } 226 + : { 227 + type: "section", 228 + text: { 229 + text: "You don't have any hackatime projects. Go setup hackatime with `/hackatime`", 230 + type: "mrkdwn", 231 + }, 232 + }, 223 233 ], 224 234 }, 225 235 });
+13
src/libs/hackatime.ts
··· 124 124 }); 125 125 126 126 if (!response.ok) { 127 + if (response.status === 401) { 128 + // Return blank info for 401 Unauthorized errors 129 + return { 130 + categories: [], 131 + projects: [], 132 + languages: [], 133 + editors: [], 134 + operating_systems: [], 135 + total_categories_sum: 0, 136 + total_categories_human_readable: "0h 0m 0s", 137 + projectsKeys: [], 138 + }; 139 + } 127 140 throw new Error( 128 141 `Failed to fetch Hackatime summary: ${response.status} ${response.statusText}: ${await response.text()}`, 129 142 );