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.

170 lines
5.4 KiB

Revamp post filtering system (#18058) * Add model for custom filter keywords * Use CustomFilterKeyword internally Does not change the API * Fix /filters/edit and /filters/new * Add migration tests * Remove whole_word column from custom_filters (covered by custom_filter_keywords) * Redesign /filters Instead of a list, present a card that displays more information and handles multiple keywords per filter. * Redesign /filters/new and /filters/edit to add and remove keywords This adds a new gem dependency: cocoon, as well as a npm dependency: cocoon-js-vanilla. Those are used to easily populate and remove form fields from the user interface when manipulating multiple keyword filters at once. * Add /api/v2/filters to edit filter with multiple keywords Entities: - `Filter`: `id`, `title`, `filter_action` (either `hide` or `warn`), `context` `keywords` - `FilterKeyword`: `id`, `keyword`, `whole_word` API endpoits: - `GET /api/v2/filters` to list filters (including keywords) - `POST /api/v2/filters` to create a new filter `keywords_attributes` can also be passed to create keywords in one request - `GET /api/v2/filters/:id` to read a particular filter - `PUT /api/v2/filters/:id` to update a new filter `keywords_attributes` can also be passed to edit, delete or add keywords in one request - `DELETE /api/v2/filters/:id` to delete a particular filter - `GET /api/v2/filters/:id/keywords` to list keywords for a filter - `POST /api/v2/filters/:filter_id/keywords/:id` to add a new keyword to a filter - `GET /api/v2/filter_keywords/:id` to read a particular keyword - `PUT /api/v2/filter_keywords/:id` to edit a particular keyword - `DELETE /api/v2/filter_keywords/:id` to delete a particular keyword * Change from `irreversible` boolean to `action` enum * Remove irrelevent `irreversible_must_be_within_context` check * Fix /filters/new and /filters/edit with update for filter_action * Fix Rubocop/Codeclimate complaining about task names * Refactor FeedManager#phrase_filtered? This moves regexp building and filter caching to the `CustomFilter` class. This does not change the functional behavior yet, but this changes how the cache is built, doing per-custom_filter regexps so that filters can be matched independently, while still offering caching. * Perform server-side filtering and output result in REST API * Fix numerous filters_changed events being sent when editing multiple keywords at once * Add some tests * Use the new API in the WebUI - use client-side logic for filters we have fetched rules for. This is so that filter changes can be retroactively applied without reloading the UI. - use server-side logic for filters we haven't fetched rules for yet (e.g. network error, or initial timeline loading) * Minor optimizations and refactoring * Perform server-side filtering on the streaming server * Change the wording of filter action labels * Fix issues pointed out by linter * Change design of “Show anyway” link in accordence to review comments * Drop “irreversible” filtering behavior * Move /api/v2/filter_keywords to /api/v1/filters/keywords * Rename `filter_results` attribute to `filtered` * Rename REST::LegacyFilterSerializer to REST::V1::FilterSerializer * Fix systemChannelId value in streaming server * Simplify code by removing client-side filtering code The simplifcation comes at a cost though: filters aren't retroactively applied anymore.
2 years ago
Revamp post filtering system (#18058) * Add model for custom filter keywords * Use CustomFilterKeyword internally Does not change the API * Fix /filters/edit and /filters/new * Add migration tests * Remove whole_word column from custom_filters (covered by custom_filter_keywords) * Redesign /filters Instead of a list, present a card that displays more information and handles multiple keywords per filter. * Redesign /filters/new and /filters/edit to add and remove keywords This adds a new gem dependency: cocoon, as well as a npm dependency: cocoon-js-vanilla. Those are used to easily populate and remove form fields from the user interface when manipulating multiple keyword filters at once. * Add /api/v2/filters to edit filter with multiple keywords Entities: - `Filter`: `id`, `title`, `filter_action` (either `hide` or `warn`), `context` `keywords` - `FilterKeyword`: `id`, `keyword`, `whole_word` API endpoits: - `GET /api/v2/filters` to list filters (including keywords) - `POST /api/v2/filters` to create a new filter `keywords_attributes` can also be passed to create keywords in one request - `GET /api/v2/filters/:id` to read a particular filter - `PUT /api/v2/filters/:id` to update a new filter `keywords_attributes` can also be passed to edit, delete or add keywords in one request - `DELETE /api/v2/filters/:id` to delete a particular filter - `GET /api/v2/filters/:id/keywords` to list keywords for a filter - `POST /api/v2/filters/:filter_id/keywords/:id` to add a new keyword to a filter - `GET /api/v2/filter_keywords/:id` to read a particular keyword - `PUT /api/v2/filter_keywords/:id` to edit a particular keyword - `DELETE /api/v2/filter_keywords/:id` to delete a particular keyword * Change from `irreversible` boolean to `action` enum * Remove irrelevent `irreversible_must_be_within_context` check * Fix /filters/new and /filters/edit with update for filter_action * Fix Rubocop/Codeclimate complaining about task names * Refactor FeedManager#phrase_filtered? This moves regexp building and filter caching to the `CustomFilter` class. This does not change the functional behavior yet, but this changes how the cache is built, doing per-custom_filter regexps so that filters can be matched independently, while still offering caching. * Perform server-side filtering and output result in REST API * Fix numerous filters_changed events being sent when editing multiple keywords at once * Add some tests * Use the new API in the WebUI - use client-side logic for filters we have fetched rules for. This is so that filter changes can be retroactively applied without reloading the UI. - use server-side logic for filters we haven't fetched rules for yet (e.g. network error, or initial timeline loading) * Minor optimizations and refactoring * Perform server-side filtering on the streaming server * Change the wording of filter action labels * Fix issues pointed out by linter * Change design of “Show anyway” link in accordence to review comments * Drop “irreversible” filtering behavior * Move /api/v2/filter_keywords to /api/v1/filters/keywords * Rename `filter_results` attribute to `filtered` * Rename REST::LegacyFilterSerializer to REST::V1::FilterSerializer * Fix systemChannelId value in streaming server * Simplify code by removing client-side filtering code The simplifcation comes at a cost though: filters aren't retroactively applied anymore.
2 years ago
  1. {
  2. "name": "@mastodon/mastodon",
  3. "license": "AGPL-3.0-or-later",
  4. "engines": {
  5. "node": ">=14"
  6. },
  7. "scripts": {
  8. "postversion": "git push --tags",
  9. "build:development": "cross-env RAILS_ENV=development NODE_ENV=development ./bin/webpack",
  10. "build:production": "cross-env RAILS_ENV=production NODE_ENV=production ./bin/webpack",
  11. "manage:translations": "node ./config/webpack/translationRunner.js",
  12. "start": "node ./streaming/index.js",
  13. "test": "${npm_execpath} run test:lint:js && ${npm_execpath} run test:jest",
  14. "test:lint": "${npm_execpath} run test:lint:js && ${npm_execpath} run test:lint:sass",
  15. "test:lint:js": "eslint --ext=js . --cache",
  16. "test:lint:sass": "stylelint '**/*.scss'",
  17. "test:jest": "cross-env NODE_ENV=test jest",
  18. "format": "prettier --write '**/*.{json,yml}'",
  19. "format-check": "prettier --write '**/*.{json,yml}'"
  20. },
  21. "repository": {
  22. "type": "git",
  23. "url": "https://github.com/mastodon/mastodon.git"
  24. },
  25. "private": true,
  26. "dependencies": {
  27. "@babel/core": "^7.18.10",
  28. "@babel/plugin-proposal-decorators": "^7.18.10",
  29. "@babel/plugin-transform-react-inline-elements": "^7.18.6",
  30. "@babel/plugin-transform-runtime": "^7.18.10",
  31. "@babel/preset-env": "^7.18.10",
  32. "@babel/preset-react": "^7.18.6",
  33. "@babel/runtime": "^7.18.9",
  34. "@gamestdio/websocket": "^0.3.2",
  35. "@github/webauthn-json": "^0.5.7",
  36. "@rails/ujs": "^6.1.6",
  37. "array-includes": "^3.1.5",
  38. "arrow-key-navigation": "^1.2.0",
  39. "autoprefixer": "^9.8.8",
  40. "axios": "^0.27.2",
  41. "babel-loader": "^8.2.5",
  42. "babel-plugin-lodash": "^3.3.4",
  43. "babel-plugin-preval": "^5.1.0",
  44. "babel-plugin-react-intl": "^6.2.0",
  45. "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
  46. "blurhash": "^1.1.5",
  47. "classnames": "^2.3.1",
  48. "cocoon-js-vanilla": "^1.2.0",
  49. "color-blend": "^3.0.1",
  50. "compression-webpack-plugin": "^6.1.1",
  51. "cross-env": "^7.0.3",
  52. "css-loader": "^5.2.7",
  53. "cssnano": "^4.1.11",
  54. "detect-passive-events": "^2.0.3",
  55. "dotenv": "^16.0.1",
  56. "emoji-mart": "npm:emoji-mart-lazyload",
  57. "es6-symbol": "^3.1.3",
  58. "escape-html": "^1.0.3",
  59. "exif-js": "^2.3.0",
  60. "express": "^4.18.1",
  61. "file-loader": "^6.2.0",
  62. "font-awesome": "^4.7.0",
  63. "fuzzysort": "^1.9.0",
  64. "glob": "^8.0.3",
  65. "history": "^4.10.1",
  66. "http-link-header": "^1.0.5",
  67. "immutable": "^4.1.0",
  68. "imports-loader": "^1.2.0",
  69. "intersection-observer": "^0.12.2",
  70. "intl": "^1.2.5",
  71. "intl-messageformat": "^2.2.0",
  72. "intl-relativeformat": "^6.4.3",
  73. "is-nan": "^1.3.2",
  74. "js-yaml": "^4.1.0",
  75. "jsdom": "^20.0.0",
  76. "lodash": "^4.17.21",
  77. "mark-loader": "^0.1.6",
  78. "marky": "^1.2.5",
  79. "mini-css-extract-plugin": "^1.6.2",
  80. "mkdirp": "^1.0.4",
  81. "npmlog": "^6.0.2",
  82. "object-assign": "^4.1.1",
  83. "object-fit-images": "^3.2.3",
  84. "object.values": "^1.1.5",
  85. "offline-plugin": "^5.0.7",
  86. "path-complete-extname": "^1.0.0",
  87. "pg": "^8.5.0",
  88. "postcss": "^8.4.16",
  89. "postcss-loader": "^3.0.0",
  90. "postcss-object-fit-images": "^1.1.2",
  91. "promise.prototype.finally": "^3.1.3",
  92. "prop-types": "^15.8.1",
  93. "punycode": "^2.1.0",
  94. "react": "^16.14.0",
  95. "react-dom": "^16.14.0",
  96. "react-hotkeys": "^1.1.4",
  97. "react-immutable-proptypes": "^2.2.0",
  98. "react-immutable-pure-component": "^2.2.2",
  99. "react-intl": "^2.9.0",
  100. "react-masonry-infinite": "^1.2.2",
  101. "react-motion": "^0.5.2",
  102. "react-notification": "^6.8.5",
  103. "react-overlays": "^0.9.3",
  104. "react-redux": "^7.2.8",
  105. "react-redux-loading-bar": "^5.0.4",
  106. "react-router-dom": "^4.1.1",
  107. "react-router-scroll-4": "^1.0.0-beta.1",
  108. "react-select": "^5.4.0",
  109. "react-sparklines": "^1.7.0",
  110. "react-swipeable-views": "^0.14.0",
  111. "react-textarea-autosize": "^8.3.4",
  112. "react-toggle": "^4.1.3",
  113. "redis": "^4.0.6 <4.1.0",
  114. "redux": "^4.2.0",
  115. "redux-immutable": "^4.0.0",
  116. "redux-thunk": "^2.4.1",
  117. "regenerator-runtime": "^0.13.9",
  118. "rellax": "^1.12.1",
  119. "requestidlecallback": "^0.3.0",
  120. "reselect": "^4.1.6",
  121. "rimraf": "^3.0.2",
  122. "sass": "^1.54.4",
  123. "sass-loader": "^10.2.0",
  124. "stacktrace-js": "^2.0.2",
  125. "stringz": "^2.1.0",
  126. "substring-trie": "^1.0.2",
  127. "terser-webpack-plugin": "^4.2.3",
  128. "tesseract.js": "^2.1.1",
  129. "throng": "^4.0.0",
  130. "tiny-queue": "^0.2.1",
  131. "twitter-text": "3.1.0",
  132. "uuid": "^8.3.1",
  133. "webpack": "^4.46.0",
  134. "webpack-assets-manifest": "^4.0.6",
  135. "webpack-bundle-analyzer": "^4.5.0",
  136. "webpack-cli": "^3.3.12",
  137. "webpack-merge": "^5.8.0",
  138. "wicg-inert": "^3.1.2",
  139. "ws": "^8.8.1"
  140. },
  141. "devDependencies": {
  142. "@babel/eslint-parser": "^7.18.9",
  143. "@testing-library/jest-dom": "^5.16.5",
  144. "@testing-library/react": "^12.1.5",
  145. "babel-jest": "^28.1.3",
  146. "eslint": "^7.32.0",
  147. "eslint-plugin-import": "~2.26.0",
  148. "eslint-plugin-jsx-a11y": "~6.6.1",
  149. "eslint-plugin-promise": "~6.0.0",
  150. "eslint-plugin-react": "~7.30.1",
  151. "jest": "^28.1.3",
  152. "jest-environment-jsdom": "^28.1.3",
  153. "postcss-scss": "^4.0.4",
  154. "prettier": "^2.7.1",
  155. "raf": "^3.4.1",
  156. "react-intl-translations-manager": "^5.0.3",
  157. "react-test-renderer": "^16.14.0",
  158. "stylelint": "^14.10.0",
  159. "stylelint-config-standard-scss": "^4.0.0",
  160. "webpack-dev-server": "^3.11.3",
  161. "yargs": "^17.5.1"
  162. },
  163. "resolutions": {
  164. "kind-of": "^6.0.3"
  165. },
  166. "optionalDependencies": {
  167. "bufferutil": "^4.0.6",
  168. "utf-8-validate": "^5.0.9"
  169. }
  170. }