Skip to content

Commit 7cca30b

Browse files
authored
chore: update dist
1 parent ae9c33c commit 7cca30b

1 file changed

Lines changed: 15 additions & 25 deletions

File tree

dist/AdvancedFlagging.user.js

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,6 @@
874874
["PostSpam" /* Spam */]: "as spam",
875875
["PostOffensive" /* Rude */]: "as R/A",
876876
["AnswerNotAnAnswer" /* NAA */]: "as NAA",
877-
["PostLowQuality" /* VLQ */]: "as VLQ",
878877
["NoFlag" /* NoFlag */]: "",
879878
["PlagiarizedContent" /* Plagiarism */]: "for plagiarism",
880879
["PostOther" /* ModFlag */]: "for moderator attention"
@@ -1608,7 +1607,7 @@
16081607
const token = input?.value;
16091608
popup.remove();
16101609
if (!token) return;
1611-
resolve(token.toString());
1610+
resolve(token);
16121611
});
16131612
});
16141613
}
@@ -1782,8 +1781,7 @@
17821781
[IconFlag, "fc-red-500"]
17831782
].map(([svg, classname]) => _Post.getIcon(svg, classname));
17841783
}
1785-
async flag(reportType, text) {
1786-
const flagName = getFlagToRaise(reportType, this.qualifiesForVlq());
1784+
async flag(flagName, text) {
17871785
const targetUrl = this.reporters.Guttenberg?.targetUrl;
17881786
const url = `/flags/posts/${this.id}/add/${flagName}`;
17891787
const data = {
@@ -1912,7 +1910,7 @@
19121910
if (this.autoflagging || status !== 200 || !regex.test(responseURL)) return;
19131911
const flagPopup = document.querySelector("#popup-flag-post");
19141912
const submit = flagPopup?.querySelector(".js-popup-submit");
1915-
if (!submit || !flagPopup || submit.textContent?.trim().startsWith("Retract")) return;
1913+
if (!submit || !flagPopup || submit.textContent.trim().startsWith("Retract")) return;
19161914
appendLabelAndBoxes(submit, this);
19171915
submit.addEventListener("click", async (event) => {
19181916
const checked = flagPopup.querySelector("input.s-radio:checked");
@@ -1973,10 +1971,6 @@
19731971
(StackExchange.options.user.isModerator || // if the delete button is visible, then the user can vote to delete
19741972
(Boolean(deleteButton) || userRep >= 2e4 && (popover ? this.score <= 0 : this.score < 0)));
19751973
}
1976-
qualifiesForVlq() {
1977-
const dayMillis2 = 1e3 * 60 * 60 * 24;
1978-
return (/* @__PURE__ */ new Date()).valueOf() - this.date.valueOf() < dayMillis2 && this.score <= 0;
1979-
}
19801974
// returns [bot name, checkbox config]
19811975
getFeedbackBoxes(isFlagOrReview = false) {
19821976
const newEntries = Object.entries(this.reporters).filter(([name, instance]) => {
@@ -2047,7 +2041,7 @@
20472041
}
20482042
getScore() {
20492043
const voteElement = this.element.querySelector(".js-vote-count");
2050-
return Number(voteElement?.textContent?.trim()) || 0;
2044+
return Number(voteElement?.textContent.trim()) || 0;
20512045
}
20522046
getOpReputation() {
20532047
const repDiv = [...this.element.querySelectorAll(
@@ -2065,7 +2059,7 @@
20652059
}
20662060
getOpName() {
20672061
const lastNameEl = [...this.element.querySelectorAll(".user-info .user-details a")].pop();
2068-
return lastNameEl?.textContent?.trim() ?? "";
2062+
return lastNameEl?.textContent.trim() ?? "";
20692063
}
20702064
getCreationDate() {
20712065
const dateElements = this.element.querySelectorAll(".user-info .relativetime");
@@ -2248,7 +2242,7 @@
22482242
{
22492243
id: 6,
22502244
displayName: "Link Only",
2251-
reportType: "PostLowQuality" /* VLQ */,
2245+
reportType: "AnswerNotAnAnswer" /* NAA */,
22522246
comments: {
22532247
// comment by Yunnosch: https://chat.stackoverflow.com/transcript/message/57442309
22542248
low: `A link to a solution is welcome, but please ensure your answer is useful without it: You need to provide at least a technical summary of *how* the problem is solved, so that it can be reproduced even without the link. It is not enough to advertise *what* it achieves. Also please [add context around the link](//meta.stackexchange.com/a/8259) so your fellow users will have some idea what it is and why it is there. [Answers that are little more than a link may be deleted.](${deletedAnswers})`
@@ -2291,7 +2285,7 @@
22912285
{
22922286
id: 10,
22932287
displayName: "Library",
2294-
reportType: "PostLowQuality" /* VLQ */,
2288+
reportType: "AnswerNotAnAnswer" /* NAA */,
22952289
comments: {
22962290
low: "Please don't just post some tool or library as an answer. At least demonstrate [how it solves the problem](//meta.stackoverflow.com/a/251605) in the answer itself."
22972291
},
@@ -2322,7 +2316,7 @@
23222316
{
23232317
id: 13,
23242318
displayName: "Non English",
2325-
reportType: "PostLowQuality" /* VLQ */,
2319+
reportType: "AnswerNotAnAnswer" /* NAA */,
23262320
comments: {
23272321
low: "Please write your answer in English, as Stack Overflow is an [English-only site](//meta.stackoverflow.com/a/297680)."
23282322
},
@@ -3337,6 +3331,10 @@
33373331
});
33383332
Store.updateConfiguration();
33393333
}
3334+
Store.flagTypes.filter(({ reportType }) => reportType === "PostLowQuality").forEach((flagType) => {
3335+
flagType.reportType = "AnswerNotAnAnswer" /* NAA */;
3336+
});
3337+
Store.updateFlagTypes();
33403338
}
33413339
function setupConfiguration() {
33423340
setupDefaults();
@@ -3498,11 +3496,7 @@
34983496
const tooltipFlagText = this.post.deleted ? "" : flagText;
34993497
const commentText = this.getCommentText(flagType);
35003498
const tooltipCommentText = (this.post.deleted ? "" : commentText) || "";
3501-
const flagName = getFlagToRaise(reportType, this.post.qualifiesForVlq());
3502-
let reportTypeHuman = reportType === "NoFlag" || !this.post.deleted ? getHumanFromDisplayName(flagName) : "";
3503-
if (reportType !== flagName) {
3504-
reportTypeHuman += " (VLQ criteria aren't met)";
3505-
}
3499+
const reportTypeHuman = reportType === "NoFlag" || !this.post.deleted ? getHumanFromDisplayName(reportType) : "";
35063500
const popoverParent = document.createElement("div");
35073501
Object.entries({
35083502
Flag: reportTypeHuman,
@@ -3656,7 +3650,8 @@
36563650
};
36573651
function increaseTooltipWidth(menu) {
36583652
[...menu.querySelectorAll("li")].filter((li) => li.firstElementChild?.classList.contains("s-block-link")).map((reportLink) => reportLink.nextElementSibling).forEach((tooltip) => {
3659-
const textLength = tooltip?.textContent?.length;
3653+
if (!tooltip) return;
3654+
const textLength = tooltip.textContent.length;
36603655
if (!textLength) return;
36613656
tooltip.classList.add(
36623657
textLength > 100 ? "wmn5" : "wmn2"
@@ -3793,11 +3788,6 @@
37933788
);
37943789
popupWrapper.id = "advanced-flagging-snackbar";
37953790
document.body.append(popupWrapper);
3796-
function getFlagToRaise(flagName, qualifiesForVlq) {
3797-
const vlqFlag = "PostLowQuality" /* VLQ */;
3798-
const naaFlag = "AnswerNotAnAnswer" /* NAA */;
3799-
return flagName === vlqFlag ? qualifiesForVlq ? vlqFlag : naaFlag : flagName;
3800-
}
38013791
function displayToaster(text, state) {
38023792
const element = document.createElement("div");
38033793
element.classList.add("p12", `bg-${state}`);

0 commit comments

Comments
 (0)