|
874 | 874 | ["PostSpam" /* Spam */]: "as spam", |
875 | 875 | ["PostOffensive" /* Rude */]: "as R/A", |
876 | 876 | ["AnswerNotAnAnswer" /* NAA */]: "as NAA", |
877 | | - ["PostLowQuality" /* VLQ */]: "as VLQ", |
878 | 877 | ["NoFlag" /* NoFlag */]: "", |
879 | 878 | ["PlagiarizedContent" /* Plagiarism */]: "for plagiarism", |
880 | 879 | ["PostOther" /* ModFlag */]: "for moderator attention" |
|
1608 | 1607 | const token = input?.value; |
1609 | 1608 | popup.remove(); |
1610 | 1609 | if (!token) return; |
1611 | | - resolve(token.toString()); |
| 1610 | + resolve(token); |
1612 | 1611 | }); |
1613 | 1612 | }); |
1614 | 1613 | } |
|
1782 | 1781 | [IconFlag, "fc-red-500"] |
1783 | 1782 | ].map(([svg, classname]) => _Post.getIcon(svg, classname)); |
1784 | 1783 | } |
1785 | | - async flag(reportType, text) { |
1786 | | - const flagName = getFlagToRaise(reportType, this.qualifiesForVlq()); |
| 1784 | + async flag(flagName, text) { |
1787 | 1785 | const targetUrl = this.reporters.Guttenberg?.targetUrl; |
1788 | 1786 | const url = `/flags/posts/${this.id}/add/${flagName}`; |
1789 | 1787 | const data = { |
|
1912 | 1910 | if (this.autoflagging || status !== 200 || !regex.test(responseURL)) return; |
1913 | 1911 | const flagPopup = document.querySelector("#popup-flag-post"); |
1914 | 1912 | 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; |
1916 | 1914 | appendLabelAndBoxes(submit, this); |
1917 | 1915 | submit.addEventListener("click", async (event) => { |
1918 | 1916 | const checked = flagPopup.querySelector("input.s-radio:checked"); |
|
1973 | 1971 | (StackExchange.options.user.isModerator || // if the delete button is visible, then the user can vote to delete |
1974 | 1972 | (Boolean(deleteButton) || userRep >= 2e4 && (popover ? this.score <= 0 : this.score < 0))); |
1975 | 1973 | } |
1976 | | - qualifiesForVlq() { |
1977 | | - const dayMillis2 = 1e3 * 60 * 60 * 24; |
1978 | | - return (/* @__PURE__ */ new Date()).valueOf() - this.date.valueOf() < dayMillis2 && this.score <= 0; |
1979 | | - } |
1980 | 1974 | // returns [bot name, checkbox config] |
1981 | 1975 | getFeedbackBoxes(isFlagOrReview = false) { |
1982 | 1976 | const newEntries = Object.entries(this.reporters).filter(([name, instance]) => { |
|
2047 | 2041 | } |
2048 | 2042 | getScore() { |
2049 | 2043 | const voteElement = this.element.querySelector(".js-vote-count"); |
2050 | | - return Number(voteElement?.textContent?.trim()) || 0; |
| 2044 | + return Number(voteElement?.textContent.trim()) || 0; |
2051 | 2045 | } |
2052 | 2046 | getOpReputation() { |
2053 | 2047 | const repDiv = [...this.element.querySelectorAll( |
|
2065 | 2059 | } |
2066 | 2060 | getOpName() { |
2067 | 2061 | const lastNameEl = [...this.element.querySelectorAll(".user-info .user-details a")].pop(); |
2068 | | - return lastNameEl?.textContent?.trim() ?? ""; |
| 2062 | + return lastNameEl?.textContent.trim() ?? ""; |
2069 | 2063 | } |
2070 | 2064 | getCreationDate() { |
2071 | 2065 | const dateElements = this.element.querySelectorAll(".user-info .relativetime"); |
|
2248 | 2242 | { |
2249 | 2243 | id: 6, |
2250 | 2244 | displayName: "Link Only", |
2251 | | - reportType: "PostLowQuality" /* VLQ */, |
| 2245 | + reportType: "AnswerNotAnAnswer" /* NAA */, |
2252 | 2246 | comments: { |
2253 | 2247 | // comment by Yunnosch: https://chat.stackoverflow.com/transcript/message/57442309 |
2254 | 2248 | 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 | 2285 | { |
2292 | 2286 | id: 10, |
2293 | 2287 | displayName: "Library", |
2294 | | - reportType: "PostLowQuality" /* VLQ */, |
| 2288 | + reportType: "AnswerNotAnAnswer" /* NAA */, |
2295 | 2289 | comments: { |
2296 | 2290 | 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." |
2297 | 2291 | }, |
|
2322 | 2316 | { |
2323 | 2317 | id: 13, |
2324 | 2318 | displayName: "Non English", |
2325 | | - reportType: "PostLowQuality" /* VLQ */, |
| 2319 | + reportType: "AnswerNotAnAnswer" /* NAA */, |
2326 | 2320 | comments: { |
2327 | 2321 | low: "Please write your answer in English, as Stack Overflow is an [English-only site](//meta.stackoverflow.com/a/297680)." |
2328 | 2322 | }, |
|
3337 | 3331 | }); |
3338 | 3332 | Store.updateConfiguration(); |
3339 | 3333 | } |
| 3334 | + Store.flagTypes.filter(({ reportType }) => reportType === "PostLowQuality").forEach((flagType) => { |
| 3335 | + flagType.reportType = "AnswerNotAnAnswer" /* NAA */; |
| 3336 | + }); |
| 3337 | + Store.updateFlagTypes(); |
3340 | 3338 | } |
3341 | 3339 | function setupConfiguration() { |
3342 | 3340 | setupDefaults(); |
|
3498 | 3496 | const tooltipFlagText = this.post.deleted ? "" : flagText; |
3499 | 3497 | const commentText = this.getCommentText(flagType); |
3500 | 3498 | 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) : ""; |
3506 | 3500 | const popoverParent = document.createElement("div"); |
3507 | 3501 | Object.entries({ |
3508 | 3502 | Flag: reportTypeHuman, |
|
3656 | 3650 | }; |
3657 | 3651 | function increaseTooltipWidth(menu) { |
3658 | 3652 | [...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; |
3660 | 3655 | if (!textLength) return; |
3661 | 3656 | tooltip.classList.add( |
3662 | 3657 | textLength > 100 ? "wmn5" : "wmn2" |
|
3793 | 3788 | ); |
3794 | 3789 | popupWrapper.id = "advanced-flagging-snackbar"; |
3795 | 3790 | 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 | | - } |
3801 | 3791 | function displayToaster(text, state) { |
3802 | 3792 | const element = document.createElement("div"); |
3803 | 3793 | element.classList.add("p12", `bg-${state}`); |
|
0 commit comments