Skip to content

Commit

Permalink
Bug reports on submission
Browse files Browse the repository at this point in the history
  • Loading branch information
Sominemo committed Jan 9, 2025
1 parent 21258e7 commit caedcf0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ blank_issues_enabled: true
contact_links:
- name: Suggest edits
url: https://limits.tginfo.me/editor.html
about: Edit Telegram Limits website and send your suggestion to @tginfo
about: Use our editor to submit suggestions
28 changes: 27 additions & 1 deletion editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,18 @@ <h1>Telegram Limits Editor</h1>
}

static async suggestEdit() {
let error;
try {
this.editor.validate();
} catch (e) {
console.error(e);
const answer = confirm("Errors found in the generated files. Do you want to submit a bug report?\n\nError: " + e.message);
if (!answer) {
return;
}
error = e;
}

try {
const dialog = document.createElement('dialog');
dialog.innerHTML = `
Expand Down Expand Up @@ -896,6 +908,11 @@ <h1>Telegram Limits Editor</h1>
</form>
`;

if (error) {
dialog.querySelector('#description').maxLength = 600;
dialog.querySelector('#description').value = '<Please tell us what did you change that could have caused the files to break!';
}

dialog.querySelector('#cancelButton').addEventListener('click', () => {
dialog.close();
dialog.remove();
Expand All @@ -904,10 +921,19 @@ <h1>Telegram Limits Editor</h1>
try {
const url = 'https://limits.tginfo.me/prop/suggest.php';

let desc = dialog.querySelector('#description').value;

if (error) {
desc += '\n\nError: ' + error.message;
if (desc.length > 800) {
desc = desc.slice(0, 800);
}
}

const data = {
structure: this.structure,
localization: this.localization,
description: dialog.querySelector('#description').value,
description: desc,
contact: dialog.querySelector('#contact').value,
};

Expand Down

0 comments on commit caedcf0

Please sign in to comment.