diff --git a/package.json b/package.json index 3ca3f371c6..fd73ff01d7 100644 --- a/package.json +++ b/package.json @@ -67,9 +67,9 @@ "nodebb-plugin-spam-be-gone": "0.5.1", "nodebb-rewards-essentials": "0.0.9", "nodebb-theme-lavender": "4.1.1", - "nodebb-theme-persona": "6.1.6", + "nodebb-theme-persona": "6.1.7", "nodebb-theme-slick": "1.1.1", - "nodebb-theme-vanilla": "7.1.4", + "nodebb-theme-vanilla": "7.1.5", "nodebb-widget-essentials": "3.0.7", "nodemailer": "4.3.0", "passport": "^0.4.0", diff --git a/public/language/en-GB/flags.json b/public/language/en-GB/flags.json index c4bfed6f23..d05a5b25a8 100644 --- a/public/language/en-GB/flags.json +++ b/public/language/en-GB/flags.json @@ -54,7 +54,11 @@ "modal-body": "Please specify your reason for flagging %1 %2 for review. Alternatively, use one of the quick report buttons if applicable.", "modal-reason-spam": "Spam", "modal-reason-offensive": "Offensive", + "modal-reason-other": "Other (specify below)", "modal-reason-custom": "Reason for reporting this content...", "modal-submit": "Submit Report", - "modal-submit-success": "Content has been flagged for moderation." + "modal-submit-success": "Content has been flagged for moderation.", + "modal-submit-confirm": "Confirm Submission", + "modal-submit-confirm-text": "You have a custom reason specified already. Are you sure you wish to submit via quick-report?", + "modal-submit-confirm-text-help": "Submitting a quick report will overwrite any custom reasons defined." } \ No newline at end of file diff --git a/public/src/modules/flags.js b/public/src/modules/flags.js index afd63c6ab2..2531bd33d7 100644 --- a/public/src/modules/flags.js +++ b/public/src/modules/flags.js @@ -5,6 +5,7 @@ define('flags', ['benchpress'], function (Benchpress) { var Flag = {}; var flagModal; var flagCommit; + var flagReason; Flag.showFlagModal = function (data) { parseModal(data, function (html) { @@ -15,15 +16,38 @@ define('flags', ['benchpress'], function (Benchpress) { }); flagCommit = flagModal.find('#flag-post-commit'); + flagReason = flagModal.find('#flag-reason-custom'); + // Quick-report buttons flagModal.on('click', '.flag-reason', function () { - createFlag(data.type, data.id, $(this).text()); + var reportText = $(this).text(); + + if (flagReason.length === 0) { + return createFlag(data.type, data.id, reportText); + } + + // Custom reason has text, confirm submission + bootbox.confirm({ + title: '[[flags:modal-submit-confirm]]', + message: '

[[flags:modal-submit-confirm-text]]

[[flags:modal-submit-confirm-text-help]]

', + callback: function (result) { + if (result) { + createFlag(data.type, data.id, reportText); + } + }, + }); }); + // Custom reason report submission flagCommit.on('click', function () { createFlag(data.type, data.id, flagModal.find('#flag-reason-custom').val()); }); + flagModal.on('click', '.toggle-custom', function () { + flagReason.prop('disabled', false); + flagReason.focus(); + }); + flagModal.modal('show'); flagModal.find('#flag-reason-custom').on('keyup blur change', checkFlagButtonEnable);