fix(communities): allow actual import errors to come through
This commit enures we render proper errors during an import, even if we've reached the maximum of warning/error items to render.
This commit is contained in:
parent
8115fdd0d0
commit
f87f952330
|
@ -43,7 +43,7 @@ proc initDiscordImportTaskItem*(
|
||||||
# We only show the first 3 errors per task, then we add another
|
# We only show the first 3 errors per task, then we add another
|
||||||
# "#n more issues" item in the UI
|
# "#n more issues" item in the UI
|
||||||
for i, error in errors:
|
for i, error in errors:
|
||||||
if i < MAX_VISIBLE_ERROR_ITEMS:
|
if i < MAX_VISIBLE_ERROR_ITEMS or error.code > ord(DiscordImportErrorCode.Warning):
|
||||||
result.errors.addItem(initDiscordImportErrorItem(`type`, error.code, error.message))
|
result.errors.addItem(initDiscordImportErrorItem(`type`, error.code, error.message))
|
||||||
|
|
||||||
proc getType*(self: DiscordImportTaskItem): string =
|
proc getType*(self: DiscordImportTaskItem): string =
|
||||||
|
|
|
@ -102,10 +102,10 @@ QtObject:
|
||||||
|
|
||||||
let errorItemsCount = self.items[idx].errors.items.len
|
let errorItemsCount = self.items[idx].errors.items.len
|
||||||
|
|
||||||
# We only show the first 3 errors per task, then we add another
|
# We only show the first 3 warnings + any error per task,
|
||||||
# "#n more issues" item in the UI
|
# then we add another "#n more issues" item in the UI
|
||||||
for i, error in item.errors:
|
for i, error in item.errors:
|
||||||
if errorItemsCount + i < taskItem.MAX_VISIBLE_ERROR_ITEMS:
|
if (errorItemsCount + i < taskItem.MAX_VISIBLE_ERROR_ITEMS) or error.code > ord(DiscordImportErrorCode.Warning):
|
||||||
let errorItem = initDiscordImportErrorItem(item.`type`, error.code, error.message)
|
let errorItem = initDiscordImportErrorItem(item.`type`, error.code, error.message)
|
||||||
self.items[idx].errors.addItem(errorItem)
|
self.items[idx].errors.addItem(errorItem)
|
||||||
|
|
||||||
|
|
|
@ -90,9 +90,9 @@ type DiscordChannelDto* = object
|
||||||
filePath*: string
|
filePath*: string
|
||||||
|
|
||||||
type DiscordImportErrorCode* {.pure.}= enum
|
type DiscordImportErrorCode* {.pure.}= enum
|
||||||
Unknown = 0,
|
Unknown = 1,
|
||||||
Warning = 1,
|
Warning = 2,
|
||||||
Error = 2
|
Error = 3
|
||||||
|
|
||||||
type DiscordImportError* = object
|
type DiscordImportError* = object
|
||||||
code*: int
|
code*: int
|
||||||
|
|
Loading…
Reference in New Issue