Skip to content

Commit 50a31fa

Browse files
committed
Adds/handles title limit on cloud patches
1 parent 422bafd commit 50a31fa

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/plus/drafts/draftsService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ export class DraftService implements Disposable {
8282
} satisfies CreateDraftRequest),
8383
});
8484

85+
if (!createDraftRsp.ok) {
86+
const json = (await createDraftRsp.json()) as { error?: { message?: string } } | undefined;
87+
throw new Error(json?.error?.message ?? createDraftRsp.statusText);
88+
}
89+
8590
const createDraft = ((await createDraftRsp.json()) as DraftResult).data;
8691
const draftId = createDraft.id;
8792

src/webviews/apps/plus/patchDetails/components/gl-patch-create.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ export class GlPatchCreate extends GlTreeBase<GlPatchCreateEvents> {
118118
</div>`,
119119
)}
120120
<div class="message-input">
121-
<input id="title" type="text" class="message-input__control" placeholder="Title (required)" .value=${
121+
<input id="title" type="text" class="message-input__control" placeholder="Title (required)" maxlength="100" .value=${
122122
this.create.title ?? ''
123123
} @input=${this.onTitleInput}></textarea>
124124
</div>
125125
<div class="message-input">
126-
<textarea id="desc" class="message-input__control" placeholder="Description (optional)" .value=${
126+
<textarea id="desc" class="message-input__control" placeholder="Description (optional)" maxlength="10000" .value=${
127127
this.create.description ?? ''
128128
} @input=${this.onDescriptionInput}></textarea>
129129
</div>

0 commit comments

Comments
 (0)