You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

389 lines
12 KiB

Use AJAX for notifications table (#10961) * Use AJAX for notifications table Signed-off-by: Andrew Thornton <art27@cantab.net> * move to separate js Signed-off-by: Andrew Thornton <art27@cantab.net> * placate golangci-lint Signed-off-by: Andrew Thornton <art27@cantab.net> * Add autoupdating notification count Signed-off-by: Andrew Thornton <art27@cantab.net> * Fix wipeall Signed-off-by: Andrew Thornton <art27@cantab.net> * placate tests Signed-off-by: Andrew Thornton <art27@cantab.net> * Try hidden Signed-off-by: Andrew Thornton <art27@cantab.net> * Try hide and hidden Signed-off-by: Andrew Thornton <art27@cantab.net> * More auto-update improvements Only run checker on pages that have a count Change starting checker to 10s with a back-off to 60s if there is no change Signed-off-by: Andrew Thornton <art27@cantab.net> * string comparison! Signed-off-by: Andrew Thornton <art27@cantab.net> * as per @silverwind Signed-off-by: Andrew Thornton <art27@cantab.net> * add configurability as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> * Add documentation as per @6543 Signed-off-by: Andrew Thornton <art27@cantab.net> * Use CSRF header not query Signed-off-by: Andrew Thornton <art27@cantab.net> * Further JS improvements Fix @etzelia update notification table request Fix @silverwind comments Co-Authored-By: silverwind <me@silverwind.io> Signed-off-by: Andrew Thornton <art27@cantab.net> * Simplify the notification count fns Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: silverwind <me@silverwind.io>
4 years ago
  1. root: true
  2. reportUnusedDisableDirectives: true
  3. ignorePatterns:
  4. - /web_src/js/vendor
  5. parserOptions:
  6. sourceType: module
  7. ecmaVersion: 2020
  8. plugins:
  9. - eslint-plugin-unicorn
  10. - eslint-plugin-import
  11. env:
  12. es2021: true
  13. node: true
  14. globals:
  15. __webpack_public_path__: true
  16. CodeMirror: false
  17. Dropzone: false
  18. SimpleMDE: false
  19. u2fApi: false
  20. overrides:
  21. - files: ["web_src/**/*.js"]
  22. env:
  23. browser: true
  24. jquery: true
  25. node: false
  26. - files: ["web_src/**/*worker.js"]
  27. env:
  28. worker: true
  29. rules:
  30. no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, status, statusbar, stop, toolbar, top]
  31. - files: ["build/generate-images.js"]
  32. rules:
  33. import/no-unresolved: [0]
  34. import/no-extraneous-dependencies: [0]
  35. rules:
  36. accessor-pairs: [2]
  37. array-bracket-newline: [0]
  38. array-bracket-spacing: [2, never]
  39. array-callback-return: [0]
  40. array-element-newline: [0]
  41. arrow-body-style: [0]
  42. arrow-parens: [2, always]
  43. arrow-spacing: [2, {before: true, after: true}]
  44. block-scoped-var: [2]
  45. brace-style: [2, 1tbs, {allowSingleLine: true}]
  46. camelcase: [0]
  47. capitalized-comments: [0]
  48. class-methods-use-this: [0]
  49. comma-dangle: [2, only-multiline]
  50. comma-spacing: [2, {before: false, after: true}]
  51. comma-style: [2, last]
  52. complexity: [0]
  53. computed-property-spacing: [2, never]
  54. consistent-return: [0]
  55. consistent-this: [0]
  56. constructor-super: [2]
  57. curly: [0]
  58. default-case-last: [2]
  59. default-case: [0]
  60. default-param-last: [0]
  61. dot-location: [2, property]
  62. dot-notation: [0]
  63. eol-last: [2]
  64. eqeqeq: [2]
  65. for-direction: [2]
  66. func-call-spacing: [2, never]
  67. func-name-matching: [2]
  68. func-names: [0]
  69. func-style: [0]
  70. function-call-argument-newline: [0]
  71. function-paren-newline: [0]
  72. generator-star-spacing: [0]
  73. getter-return: [2]
  74. grouped-accessor-pairs: [2]
  75. guard-for-in: [0]
  76. id-blacklist: [0]
  77. id-length: [0]
  78. id-match: [0]
  79. implicit-arrow-linebreak: [0]
  80. import/default: [0]
  81. import/dynamic-import-chunkname: [0]
  82. import/export: [2]
  83. import/exports-last: [0]
  84. import/extensions: [2, always, {ignorePackages: true}]
  85. import/first: [2]
  86. import/group-exports: [0]
  87. import/max-dependencies: [0]
  88. import/named: [2]
  89. import/namespace: [0]
  90. import/newline-after-import: [0]
  91. import/no-absolute-path: [0]
  92. import/no-amd: [0]
  93. import/no-anonymous-default-export: [0]
  94. import/no-commonjs: [0]
  95. import/no-cycle: [0]
  96. import/no-default-export: [0]
  97. import/no-deprecated: [0]
  98. import/no-dynamic-require: [0]
  99. import/no-extraneous-dependencies: [2]
  100. import/no-internal-modules: [0]
  101. import/no-mutable-exports: [2]
  102. import/no-named-as-default-member: [0]
  103. import/no-named-as-default: [2]
  104. import/no-named-default: [0]
  105. import/no-named-export: [0]
  106. import/no-namespace: [0]
  107. import/no-nodejs-modules: [0]
  108. import/no-relative-parent-imports: [0]
  109. import/no-restricted-paths: [0]
  110. import/no-self-import: [2]
  111. import/no-unassigned-import: [0]
  112. import/no-unresolved: [2, {commonjs: true}]
  113. import/no-unused-modules: [0]
  114. import/no-useless-path-segments: [2, {commonjs: true}]
  115. import/no-webpack-loader-syntax: [2]
  116. import/order: [0]
  117. import/prefer-default-export: [0]
  118. import/unambiguous: [0]
  119. indent: [2, 2, {SwitchCase: 1}]
  120. init-declarations: [0]
  121. key-spacing: [2]
  122. keyword-spacing: [2]
  123. line-comment-position: [0]
  124. linebreak-style: [2, unix]
  125. lines-around-comment: [0]
  126. lines-between-class-members: [0]
  127. max-classes-per-file: [0]
  128. max-depth: [0]
  129. max-len: [0]
  130. max-lines-per-function: [0]
  131. max-lines: [0]
  132. max-nested-callbacks: [0]
  133. max-params: [0]
  134. max-statements-per-line: [0]
  135. max-statements: [0]
  136. multiline-comment-style: [2, separate-lines]
  137. multiline-ternary: [0]
  138. new-cap: [0]
  139. new-parens: [2]
  140. newline-per-chained-call: [0]
  141. no-alert: [0]
  142. no-array-constructor: [2]
  143. no-async-promise-executor: [2]
  144. no-await-in-loop: [0]
  145. no-bitwise: [0]
  146. no-buffer-constructor: [0]
  147. no-caller: [2]
  148. no-case-declarations: [2]
  149. no-class-assign: [2]
  150. no-compare-neg-zero: [2]
  151. no-cond-assign: [2, except-parens]
  152. no-confusing-arrow: [0]
  153. no-console: [1, {allow: [info, warn, error]}]
  154. no-const-assign: [2]
  155. no-constant-condition: [0]
  156. no-constructor-return: [2]
  157. no-continue: [0]
  158. no-control-regex: [0]
  159. no-debugger: [1]
  160. no-delete-var: [2]
  161. no-div-regex: [0]
  162. no-dupe-args: [2]
  163. no-dupe-class-members: [2]
  164. no-dupe-else-if: [2]
  165. no-dupe-keys: [2]
  166. no-duplicate-case: [2]
  167. no-duplicate-imports: [2]
  168. no-else-return: [2]
  169. no-empty-character-class: [2]
  170. no-empty-function: [0]
  171. no-empty-pattern: [2]
  172. no-empty: [2, {allowEmptyCatch: true}]
  173. no-eq-null: [2]
  174. no-eval: [2]
  175. no-ex-assign: [2]
  176. no-extend-native: [2]
  177. no-extra-bind: [2]
  178. no-extra-boolean-cast: [2]
  179. no-extra-label: [0]
  180. no-extra-parens: [0]
  181. no-extra-semi: [2]
  182. no-fallthrough: [2]
  183. no-floating-decimal: [0]
  184. no-func-assign: [2]
  185. no-global-assign: [2]
  186. no-implicit-coercion: [0]
  187. no-implicit-globals: [0]
  188. no-implied-eval: [2]
  189. no-import-assign: [2]
  190. no-inline-comments: [0]
  191. no-inner-declarations: [2]
  192. no-invalid-regexp: [2]
  193. no-invalid-this: [0]
  194. no-irregular-whitespace: [2]
  195. no-iterator: [2]
  196. no-label-var: [2]
  197. no-labels: [2]
  198. no-lone-blocks: [2]
  199. no-lonely-if: [0]
  200. no-loop-func: [0]
  201. no-loss-of-precision: [2]
  202. no-magic-numbers: [0]
  203. no-misleading-character-class: [2]
  204. no-mixed-operators: [0]
  205. no-mixed-spaces-and-tabs: [2]
  206. no-multi-assign: [0]
  207. no-multi-spaces: [2, {ignoreEOLComments: true, exceptions: {Property: true, VariableDeclarator: true}}]
  208. no-multi-str: [2]
  209. no-negated-condition: [0]
  210. no-nested-ternary: [0]
  211. no-new-func: [2]
  212. no-new-object: [2]
  213. no-new-symbol: [2]
  214. no-new-wrappers: [2]
  215. no-new: [0]
  216. no-obj-calls: [2]
  217. no-octal-escape: [2]
  218. no-octal: [2]
  219. no-param-reassign: [0]
  220. no-plusplus: [0]
  221. no-promise-executor-return: [0]
  222. no-proto: [2]
  223. no-prototype-builtins: [2]
  224. no-redeclare: [2]
  225. no-regex-spaces: [2]
  226. no-restricted-exports: [0]
  227. no-restricted-globals: [2, addEventListener, blur, close, closed, confirm, defaultStatus, defaultstatus, error, event, external, find, focus, frameElement, frames, history, innerHeight, innerWidth, isFinite, isNaN, length, location, locationbar, menubar, moveBy, moveTo, name, onblur, onerror, onfocus, onload, onresize, onunload, open, opener, opera, outerHeight, outerWidth, pageXOffset, pageYOffset, parent, print, removeEventListener, resizeBy, resizeTo, screen, screenLeft, screenTop, screenX, screenY, scroll, scrollbars, scrollBy, scrollTo, scrollX, scrollY, self, status, statusbar, stop, toolbar, top]
  228. no-restricted-imports: [0]
  229. no-restricted-syntax: [2, WithStatement, ForInStatement, LabeledStatement]
  230. no-return-assign: [0]
  231. no-return-await: [0]
  232. no-script-url: [2]
  233. no-self-assign: [2, {props: true}]
  234. no-self-compare: [2]
  235. no-sequences: [2]
  236. no-setter-return: [2]
  237. no-shadow-restricted-names: [2]
  238. no-shadow: [0]
  239. no-sparse-arrays: [2]
  240. no-tabs: [2]
  241. no-template-curly-in-string: [2]
  242. no-ternary: [0]
  243. no-this-before-super: [2]
  244. no-throw-literal: [2]
  245. no-trailing-spaces: [2]
  246. no-undef-init: [2]
  247. no-undef: [2, {typeof: true}]
  248. no-undefined: [0]
  249. no-underscore-dangle: [0]
  250. no-unexpected-multiline: [2]
  251. no-unmodified-loop-condition: [2]
  252. no-unneeded-ternary: [0]
  253. no-unreachable-loop: [2]
  254. no-unreachable: [2]
  255. no-unsafe-finally: [2]
  256. no-unsafe-negation: [2]
  257. no-unused-expressions: [2]
  258. no-unused-labels: [2]
  259. no-unused-vars: [2, {args: all, argsIgnorePattern: ^_, varsIgnorePattern: ^_, caughtErrorsIgnorePattern: ^_, ignoreRestSiblings: false}]
  260. no-use-before-define: [2, nofunc]
  261. no-useless-backreference: [0]
  262. no-useless-call: [2]
  263. no-useless-catch: [2]
  264. no-useless-computed-key: [2]
  265. no-useless-concat: [2]
  266. no-useless-constructor: [2]
  267. no-useless-escape: [2]
  268. no-useless-rename: [2]
  269. no-useless-return: [2]
  270. no-var: [2]
  271. no-void: [2]
  272. no-warning-comments: [0]
  273. no-whitespace-before-property: [2]
  274. no-with: [2]
  275. nonblock-statement-body-position: [2]
  276. object-curly-newline: [0]
  277. object-curly-spacing: [2, never]
  278. object-shorthand: [2, always]
  279. one-var-declaration-per-line: [0]
  280. one-var: [0]
  281. operator-assignment: [2, always]
  282. operator-linebreak: [2, after]
  283. padded-blocks: [2, never]
  284. padding-line-between-statements: [0]
  285. prefer-arrow-callback: [2, {allowNamedFunctions: true, allowUnboundThis: true}]
  286. prefer-const: [2, {destructuring: all}]
  287. prefer-destructuring: [0]
  288. prefer-exponentiation-operator: [2]
  289. prefer-named-capture-group: [0]
  290. prefer-numeric-literals: [2]
  291. prefer-object-spread: [0]
  292. prefer-promise-reject-errors: [2, {allowEmptyReject: false}]
  293. prefer-regex-literals: [2]
  294. prefer-rest-params: [2]
  295. prefer-spread: [2]
  296. prefer-template: [2]
  297. quote-props: [0]
  298. quotes: [2, single, {avoidEscape: true, allowTemplateLiterals: true}]
  299. radix: [2, as-needed]
  300. require-atomic-updates: [0]
  301. require-await: [0]
  302. require-unicode-regexp: [0]
  303. require-yield: [2]
  304. rest-spread-spacing: [2, never]
  305. semi-spacing: [2, {before: false, after: true}]
  306. semi-style: [2, last]
  307. semi: [2, always, {omitLastInOneLineBlock: true}]
  308. sort-imports: [0]
  309. sort-keys: [0]
  310. sort-vars: [0]
  311. space-before-blocks: [2, always]
  312. space-in-parens: [2, never]
  313. space-infix-ops: [2]
  314. space-unary-ops: [2]
  315. spaced-comment: [2, always]
  316. strict: [0]
  317. switch-colon-spacing: [2]
  318. symbol-description: [2]
  319. template-curly-spacing: [2, never]
  320. template-tag-spacing: [2, never]
  321. unicode-bom: [2, never]
  322. unicorn/better-regex: [0]
  323. unicorn/catch-error-name: [0]
  324. unicorn/consistent-function-scoping: [2]
  325. unicorn/custom-error-definition: [0]
  326. unicorn/error-message: [0]
  327. unicorn/escape-case: [0]
  328. unicorn/expiring-todo-comments: [0]
  329. unicorn/explicit-length-check: [0]
  330. unicorn/filename-case: [0]
  331. unicorn/import-index: [0]
  332. unicorn/new-for-builtins: [2]
  333. unicorn/no-abusive-eslint-disable: [0]
  334. unicorn/no-array-instanceof: [0]
  335. unicorn/no-console-spaces: [0]
  336. unicorn/no-fn-reference-in-iterator: [0]
  337. unicorn/no-for-loop: [0]
  338. unicorn/no-hex-escape: [0]
  339. unicorn/no-keyword-prefix: [0]
  340. unicorn/no-nested-ternary: [0]
  341. unicorn/no-new-buffer: [0]
  342. unicorn/no-null: [0]
  343. unicorn/no-object-as-default-parameter: [2]
  344. unicorn/no-process-exit: [0]
  345. unicorn/no-reduce: [2]
  346. unicorn/no-unreadable-array-destructuring: [0]
  347. unicorn/no-unsafe-regex: [0]
  348. unicorn/no-unused-properties: [2]
  349. unicorn/no-useless-undefined: [0]
  350. unicorn/no-zero-fractions: [2]
  351. unicorn/number-literal-case: [0]
  352. unicorn/prefer-add-event-listener: [2]
  353. unicorn/prefer-array-find: [2]
  354. unicorn/prefer-dataset: [2]
  355. unicorn/prefer-event-key: [2]
  356. unicorn/prefer-includes: [2]
  357. unicorn/prefer-modern-dom-apis: [0]
  358. unicorn/prefer-negative-index: [2]
  359. unicorn/prefer-node-append: [0]
  360. unicorn/prefer-node-remove: [0]
  361. unicorn/prefer-number-properties: [0]
  362. unicorn/prefer-optional-catch-binding: [2]
  363. unicorn/prefer-query-selector: [0]
  364. unicorn/prefer-reflect-apply: [0]
  365. unicorn/prefer-replace-all: [0]
  366. unicorn/prefer-set-has: [0]
  367. unicorn/prefer-spread: [0]
  368. unicorn/prefer-starts-ends-with: [2]
  369. unicorn/prefer-string-slice: [0]
  370. unicorn/prefer-text-content: [2]
  371. unicorn/prefer-trim-start-end: [2]
  372. unicorn/prefer-type-error: [0]
  373. unicorn/prevent-abbreviations: [0]
  374. unicorn/string-content: [0]
  375. unicorn/throw-new-error: [2]
  376. use-isnan: [2]
  377. valid-typeof: [2, {requireStringLiterals: true}]
  378. vars-on-top: [0]
  379. wrap-iife: [2, inside]
  380. wrap-regex: [0]
  381. yield-star-spacing: [2, after]
  382. yoda: [2, never]