diff --git a/CHANGELOG.md b/CHANGELOG.md
index de2a57b88..8b5804cdc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## 2.1.0-rc.4 - 2022-05-03
+
+Changes since rc.3:
+* Use upstream dependencies for Ueberauth providers
+* Fix Ueberauth use of CSRF with session
+* Fix being an administrator when using 3rd-party auth provider
+* Include ongoing events in search
+* Send push notification into own task
+* Add Überauth CAS Strategy
+
## 2.1.0-rc.3 - 2022-04-24
Changes since rc.2:
diff --git a/js/package.json b/js/package.json
index a04e925e5..bf43d243b 100644
--- a/js/package.json
+++ b/js/package.json
@@ -1,6 +1,6 @@
{
"name": "mobilizon",
- "version": "2.1.0-rc.3",
+ "version": "2.1.0-rc.4",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
diff --git a/js/yarn.lock b/js/yarn.lock
index 610b82265..0de72b54d 100644
--- a/js/yarn.lock
+++ b/js/yarn.lock
@@ -54,9 +54,9 @@
leven "^3.1.0"
"@apollo/client@^3.0.0", "@apollo/client@^3.3.16":
- version "3.6.1"
- resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.6.1.tgz#2578aa3c06e4b8c41060936b9e508beb1abc1bab"
- integrity sha512-WGC7n2IS7GIbCCfVvu58Qncmj6qUBYbI/DxPVHGffDuY5y5l+OI2YIr5UXyR8+G9Ly1d6iYbX6l6l+Rw6F6gHA==
+ version "3.6.2"
+ resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.6.2.tgz#0418bfa6358dd117894c8af396706cfa2b186032"
+ integrity sha512-DNWyl+NNU2VsfHtXwOr4rV9hnQFPkl2/dNXeouhk9q7bXCWdEh3K8YTt/frULGVKbQjtnlPmz8C+LFI/JZ2N3w==
dependencies:
"@graphql-typed-document-node/core" "^3.1.1"
"@wry/context" "^0.6.0"
@@ -1317,9 +1317,9 @@
integrity sha512-SfJxIxNVYLTsKwzB3MoOQ1yxf4w/E6MdkvTgrgAt1bfxjSrLUoHMKrDOykwN14q65waezZIdqDneUIPh4/sKxg==
"@jridgewell/sourcemap-codec@^1.4.10":
- version "1.4.11"
- resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz#771a1d8d744eeb71b6adb35808e1a6c7b9b8c8ec"
- integrity sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg==
+ version "1.4.12"
+ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.12.tgz#7ed98f6fa525ffb7c56a2cbecb5f7bb91abd2baf"
+ integrity sha512-az/NhpIwP3K33ILr0T2bso+k2E/SLf8Yidd8mHl0n6sCQ4YdyC8qDhZA6kOPDNDBA56ZnIjngVl0U3jREA0BUA==
"@jridgewell/trace-mapping@^0.3.9":
version "0.3.9"
@@ -1922,9 +1922,9 @@
"@types/istanbul-lib-report" "*"
"@types/jest@^27.0.1", "@types/jest@^27.0.2":
- version "27.4.1"
- resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.4.1.tgz#185cbe2926eaaf9662d340cc02e548ce9e11ab6d"
- integrity sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw==
+ version "27.5.0"
+ resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.5.0.tgz#e04ed1824ca6b1dd0438997ba60f99a7405d4c7b"
+ integrity sha512-9RBFx7r4k+msyj/arpfaa0WOOEcaAZNmN+j80KFbFCoSqCJGHTz7YMAMGQW9Xmqm5w6l5c25vbSjMwlikJi5+g==
dependencies:
jest-matcher-utils "^27.0.0"
pretty-format "^27.0.0"
@@ -2054,9 +2054,9 @@
"@types/prosemirror-view" "*"
"@types/prosemirror-model@*", "@types/prosemirror-model@^1.16.0", "@types/prosemirror-model@^1.7.2":
- version "1.16.1"
- resolved "https://registry.yarnpkg.com/@types/prosemirror-model/-/prosemirror-model-1.16.1.tgz#0ce6c80cd81b398b8a11b1bf7cf695bff3160c9a"
- integrity sha512-SrrCe2cHlYrQ9o55e2i/c3wt1yRajTTpRLvzfmB+2DWjWEbBLTByVWyjrdpKtQTxAaTeU2aeDGo1iuwl/jF27w==
+ version "1.16.2"
+ resolved "https://registry.yarnpkg.com/@types/prosemirror-model/-/prosemirror-model-1.16.2.tgz#8896adac3a5d5d66f06491bb13940aa734a7b6e8"
+ integrity sha512-1XPJopkKP3oHSBP61uuSuW13DIDZPWvAzP6Pv2/6mixk8EBPUeRGIW548DjJTicMo23gEg1zvCZy9asblQdWag==
dependencies:
"@types/orderedmap" "*"
@@ -2070,25 +2070,25 @@
"@types/prosemirror-state" "*"
"@types/prosemirror-state@*", "@types/prosemirror-state@^1.2.4", "@types/prosemirror-state@^1.2.8":
- version "1.2.8"
- resolved "https://registry.yarnpkg.com/@types/prosemirror-state/-/prosemirror-state-1.2.8.tgz#65080eeec52f63c50bf7034377f07773b4f6b2ac"
- integrity sha512-mq9uyQWcpu8jeamO6Callrdvf/e1H/aRLR2kZWSpZrPHctEsxWHBbluD/wqVjXBRIOoMHLf6ZvOkrkmGLoCHVA==
+ version "1.3.0"
+ resolved "https://registry.yarnpkg.com/@types/prosemirror-state/-/prosemirror-state-1.3.0.tgz#7fd25db7244c027eef0849d79b112a8a0dfbb483"
+ integrity sha512-nMdUF6w8B++NH4V54X+4GvDty7M02UfuHQW0s1AS25Z4ZrOW4RSY2+s57doXBbeMSjzYV/QoMxCY2sT3KQ2VdQ==
dependencies:
"@types/prosemirror-model" "*"
"@types/prosemirror-transform" "*"
"@types/prosemirror-view" "*"
"@types/prosemirror-transform@*", "@types/prosemirror-transform@^1.1.5":
- version "1.1.6"
- resolved "https://registry.yarnpkg.com/@types/prosemirror-transform/-/prosemirror-transform-1.1.6.tgz#4a06979f656331c46c2725039a57360cc35853af"
- integrity sha512-7HwXOWc5vZQqIfEUUVAz13lPgBqAWJTv89qEpzAtBFB6hOszFmhsvQ02Jqe2LvKauAoJDa3Qpv/dbJAmgyiTuQ==
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/@types/prosemirror-transform/-/prosemirror-transform-1.4.0.tgz#dbbc3f94b5879bb5e2027b908447e768a963ec6f"
+ integrity sha512-ntfuTl9nJWHvFykCmqJj4YQMws6G5H9nBaxHW0xRqfTxDxUvX2bCloqRN7bQTWg9h3VSP2lx45UuET1fn/oQ9Q==
dependencies:
"@types/prosemirror-model" "*"
"@types/prosemirror-view@*", "@types/prosemirror-view@^1.11.4", "@types/prosemirror-view@^1.23.1":
- version "1.23.1"
- resolved "https://registry.yarnpkg.com/@types/prosemirror-view/-/prosemirror-view-1.23.1.tgz#a9a926bb6b6e6873e3a9d8caa61c32f3402629eb"
- integrity sha512-6e1B2oKUnhmZPUrsVvYjDqeVjE6jGezygjtoHsAK4ZENAxHzHqy5NT4jUvdPTWjCYeH0t2Y7pSfRPNrPIyQX4A==
+ version "1.23.2"
+ resolved "https://registry.yarnpkg.com/@types/prosemirror-view/-/prosemirror-view-1.23.2.tgz#1e9b90ccf7947c647b2757eb758e46af9a58138e"
+ integrity sha512-P/qlXsUAZeZVJQkIy6hzc1RBWbeQIN01jtUo686ou7O8RDXWVKpVYMa1soR8nfUfKE8QHvCjCVe+7u6V3C/1fw==
dependencies:
"@types/prosemirror-model" "*"
"@types/prosemirror-state" "*"
@@ -2197,13 +2197,13 @@
"@types/yargs-parser" "*"
"@typescript-eslint/eslint-plugin@^5.0.0", "@typescript-eslint/eslint-plugin@^5.3.0":
- version "5.21.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.21.0.tgz#bfc22e0191e6404ab1192973b3b4ea0461c1e878"
- integrity sha512-fTU85q8v5ZLpoZEyn/u1S2qrFOhi33Edo2CZ0+q1gDaWWm0JuPh3bgOyU8lM0edIEYgKLDkPFiZX2MOupgjlyg==
+ version "5.22.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.22.0.tgz#7b52a0de2e664044f28b36419210aea4ab619e2a"
+ integrity sha512-YCiy5PUzpAeOPGQ7VSGDEY2NeYUV1B0swde2e0HzokRsHBYjSdF6DZ51OuRZxVPHx0032lXGLvOMls91D8FXlg==
dependencies:
- "@typescript-eslint/scope-manager" "5.21.0"
- "@typescript-eslint/type-utils" "5.21.0"
- "@typescript-eslint/utils" "5.21.0"
+ "@typescript-eslint/scope-manager" "5.22.0"
+ "@typescript-eslint/type-utils" "5.22.0"
+ "@typescript-eslint/utils" "5.22.0"
debug "^4.3.2"
functional-red-black-tree "^1.0.1"
ignore "^5.1.8"
@@ -2212,68 +2212,68 @@
tsutils "^3.21.0"
"@typescript-eslint/parser@^5.0.0", "@typescript-eslint/parser@^5.10.0", "@typescript-eslint/parser@^5.3.0":
- version "5.21.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.21.0.tgz#6cb72673dbf3e1905b9c432175a3c86cdaf2071f"
- integrity sha512-8RUwTO77hstXUr3pZoWZbRQUxXcSXafZ8/5gpnQCfXvgmP9gpNlRGlWzvfbEQ14TLjmtU8eGnONkff8U2ui2Eg==
+ version "5.22.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.22.0.tgz#7bedf8784ef0d5d60567c5ba4ce162460e70c178"
+ integrity sha512-piwC4krUpRDqPaPbFaycN70KCP87+PC5WZmrWs+DlVOxxmF+zI6b6hETv7Quy4s9wbkV16ikMeZgXsvzwI3icQ==
dependencies:
- "@typescript-eslint/scope-manager" "5.21.0"
- "@typescript-eslint/types" "5.21.0"
- "@typescript-eslint/typescript-estree" "5.21.0"
+ "@typescript-eslint/scope-manager" "5.22.0"
+ "@typescript-eslint/types" "5.22.0"
+ "@typescript-eslint/typescript-estree" "5.22.0"
debug "^4.3.2"
-"@typescript-eslint/scope-manager@5.21.0":
- version "5.21.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.21.0.tgz#a4b7ed1618f09f95e3d17d1c0ff7a341dac7862e"
- integrity sha512-XTX0g0IhvzcH/e3393SvjRCfYQxgxtYzL3UREteUneo72EFlt7UNoiYnikUtmGVobTbhUDByhJ4xRBNe+34kOQ==
+"@typescript-eslint/scope-manager@5.22.0":
+ version "5.22.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.22.0.tgz#590865f244ebe6e46dc3e9cab7976fc2afa8af24"
+ integrity sha512-yA9G5NJgV5esANJCO0oF15MkBO20mIskbZ8ijfmlKIvQKg0ynVKfHZ15/nhAJN5m8Jn3X5qkwriQCiUntC9AbA==
dependencies:
- "@typescript-eslint/types" "5.21.0"
- "@typescript-eslint/visitor-keys" "5.21.0"
+ "@typescript-eslint/types" "5.22.0"
+ "@typescript-eslint/visitor-keys" "5.22.0"
-"@typescript-eslint/type-utils@5.21.0":
- version "5.21.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.21.0.tgz#ff89668786ad596d904c21b215e5285da1b6262e"
- integrity sha512-MxmLZj0tkGlkcZCSE17ORaHl8Th3JQwBzyXL/uvC6sNmu128LsgjTX0NIzy+wdH2J7Pd02GN8FaoudJntFvSOw==
+"@typescript-eslint/type-utils@5.22.0":
+ version "5.22.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.22.0.tgz#0c0e93b34210e334fbe1bcb7250c470f4a537c19"
+ integrity sha512-iqfLZIsZhK2OEJ4cQ01xOq3NaCuG5FQRKyHicA3xhZxMgaxQazLUHbH/B2k9y5i7l3+o+B5ND9Mf1AWETeMISA==
dependencies:
- "@typescript-eslint/utils" "5.21.0"
+ "@typescript-eslint/utils" "5.22.0"
debug "^4.3.2"
tsutils "^3.21.0"
-"@typescript-eslint/types@5.21.0":
- version "5.21.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.21.0.tgz#8cdb9253c0dfce3f2ab655b9d36c03f72e684017"
- integrity sha512-XnOOo5Wc2cBlq8Lh5WNvAgHzpjnEzxn4CJBwGkcau7b/tZ556qrWXQz4DJyChYg8JZAD06kczrdgFPpEQZfDsA==
+"@typescript-eslint/types@5.22.0":
+ version "5.22.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.22.0.tgz#50a4266e457a5d4c4b87ac31903b28b06b2c3ed0"
+ integrity sha512-T7owcXW4l0v7NTijmjGWwWf/1JqdlWiBzPqzAWhobxft0SiEvMJB56QXmeCQjrPuM8zEfGUKyPQr/L8+cFUBLw==
-"@typescript-eslint/typescript-estree@5.21.0":
- version "5.21.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.21.0.tgz#9f0c233e28be2540eaed3df050f0d54fb5aa52de"
- integrity sha512-Y8Y2T2FNvm08qlcoSMoNchh9y2Uj3QmjtwNMdRQkcFG7Muz//wfJBGBxh8R7HAGQFpgYpdHqUpEoPQk+q9Kjfg==
+"@typescript-eslint/typescript-estree@5.22.0":
+ version "5.22.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.22.0.tgz#e2116fd644c3e2fda7f4395158cddd38c0c6df97"
+ integrity sha512-EyBEQxvNjg80yinGE2xdhpDYm41so/1kOItl0qrjIiJ1kX/L/L8WWGmJg8ni6eG3DwqmOzDqOhe6763bF92nOw==
dependencies:
- "@typescript-eslint/types" "5.21.0"
- "@typescript-eslint/visitor-keys" "5.21.0"
+ "@typescript-eslint/types" "5.22.0"
+ "@typescript-eslint/visitor-keys" "5.22.0"
debug "^4.3.2"
globby "^11.0.4"
is-glob "^4.0.3"
semver "^7.3.5"
tsutils "^3.21.0"
-"@typescript-eslint/utils@5.21.0":
- version "5.21.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.21.0.tgz#51d7886a6f0575e23706e5548c7e87bce42d7c18"
- integrity sha512-q/emogbND9wry7zxy7VYri+7ydawo2HDZhRZ5k6yggIvXa7PvBbAAZ4PFH/oZLem72ezC4Pr63rJvDK/sTlL8Q==
+"@typescript-eslint/utils@5.22.0":
+ version "5.22.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.22.0.tgz#1f2c4897e2cf7e44443c848a13c60407861babd8"
+ integrity sha512-HodsGb037iobrWSUMS7QH6Hl1kppikjA1ELiJlNSTYf/UdMEwzgj0WIp+lBNb6WZ3zTwb0tEz51j0Wee3iJ3wQ==
dependencies:
"@types/json-schema" "^7.0.9"
- "@typescript-eslint/scope-manager" "5.21.0"
- "@typescript-eslint/types" "5.21.0"
- "@typescript-eslint/typescript-estree" "5.21.0"
+ "@typescript-eslint/scope-manager" "5.22.0"
+ "@typescript-eslint/types" "5.22.0"
+ "@typescript-eslint/typescript-estree" "5.22.0"
eslint-scope "^5.1.1"
eslint-utils "^3.0.0"
-"@typescript-eslint/visitor-keys@5.21.0":
- version "5.21.0"
- resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.21.0.tgz#453fb3662409abaf2f8b1f65d515699c888dd8ae"
- integrity sha512-SX8jNN+iHqAF0riZQMkm7e8+POXa/fXw5cxL+gjpyP+FI+JVNhii53EmQgDAfDcBpFekYSlO0fGytMQwRiMQCA==
+"@typescript-eslint/visitor-keys@5.22.0":
+ version "5.22.0"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.22.0.tgz#f49c0ce406944ffa331a1cfabeed451ea4d0909c"
+ integrity sha512-DbgTqn2Dv5RFWluG88tn0pP6Ex0ROF+dpDO1TNNZdRtLjUr6bdznjA6f/qNqJLjd2PgguAES2Zgxh/JzwzETDg==
dependencies:
- "@typescript-eslint/types" "5.21.0"
+ "@typescript-eslint/types" "5.22.0"
eslint-visitor-keys "^3.0.0"
"@vue-a11y/announcer@^2.1.0":
@@ -3123,12 +3123,12 @@ at-least-node@^1.0.0:
integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==
autoprefixer@^10, autoprefixer@^10.2.4:
- version "10.4.6"
- resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.6.tgz#ce6eba3aea7c03adf0f6a907bd594fd170b3f0b6"
- integrity sha512-Rvzel0AZO9tJNm3ydySK80PpkWoEZTGC5bHUh/xbrP8qJCy08NFBwNGPcozy3d3SDIM0b2kNxw2K7jAIYFF01A==
+ version "10.4.7"
+ resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.7.tgz#1db8d195f41a52ca5069b7593be167618edbbedf"
+ integrity sha512-ypHju4Y2Oav95SipEcCcI5J7CGPuvz8oat7sUtYj3ClK44bldfvtvcxK6IEK++7rqB7YchDGzweZIBG+SD0ZAA==
dependencies:
browserslist "^4.20.3"
- caniuse-lite "^1.0.30001334"
+ caniuse-lite "^1.0.30001335"
fraction.js "^4.2.0"
normalize-range "^0.1.2"
picocolors "^1.0.0"
@@ -3483,7 +3483,7 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"
-caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001334:
+caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001332, caniuse-lite@^1.0.30001335:
version "1.0.30001335"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001335.tgz#899254a0b70579e5a957c32dced79f0727c61f2a"
integrity sha512-ddP1Tgm7z2iIxu6QTtbZUv6HJxSaV/PZeSrWFZtbY4JZ69tOeNhBCl3HyRQgeNZKE5AOn1kpV7fhljigy0Ty3w==
@@ -3826,9 +3826,9 @@ copy-webpack-plugin@^9.0.1:
serialize-javascript "^6.0.0"
core-js-compat@^3.21.0, core-js-compat@^3.22.1, core-js-compat@^3.8.3:
- version "3.22.3"
- resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.22.3.tgz#9b10d786052d042bc97ee8df9c0d1fb6a49c2005"
- integrity sha512-wliMbvPI2idgFWpFe7UEyHMvu6HWgW8WA+HnDRtgzoSDYvXFMpoGX1H3tPDDXrcfUSyXafCLDd7hOeMQHEZxGw==
+ version "3.22.4"
+ resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.22.4.tgz#d700f451e50f1d7672dcad0ac85d910e6691e579"
+ integrity sha512-dIWcsszDezkFZrfm1cnB4f/J85gyhiCpxbgBdohWCDtSVuAaChTSpPV7ldOQf/Xds2U5xCIJZOK82G4ZPAIswA==
dependencies:
browserslist "^4.20.3"
semver "7.0.0"
@@ -3844,9 +3844,9 @@ core-js@^2.4.0, core-js@^2.5.0:
integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==
core-js@^3.6.4, core-js@^3.8.3:
- version "3.22.3"
- resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.22.3.tgz#498c41d997654cb00e81c7a54b44f0ab21ab01d5"
- integrity sha512-1t+2a/d2lppW1gkLXx3pKPVGbBdxXAkqztvWb1EJ8oF8O2gIGiytzflNiFEehYwVK/t2ryUsGBoOFFvNx95mbg==
+ version "3.22.4"
+ resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.22.4.tgz#f4b3f108d45736935aa028444a69397e40d8c531"
+ integrity sha512-1uLykR+iOfYja+6Jn/57743gc9n73EWiOnSJJ4ba3B4fOEYDBv25MagmEZBxTp5cWq4b/KPx/l77zgsp28ju4w==
core-util-is@~1.0.0:
version "1.0.3"
@@ -4139,7 +4139,7 @@ define-lazy-prop@^2.0.0:
resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f"
integrity sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==
-define-properties@^1.1.3:
+define-properties@^1.1.3, define-properties@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1"
integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==
@@ -4347,9 +4347,9 @@ ejs@^3.1.6:
jake "^10.8.5"
electron-to-chromium@^1.4.118:
- version "1.4.129"
- resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.129.tgz#c675793885721beefff99da50f57c6525c2cd238"
- integrity sha512-GgtN6bsDtHdtXJtlMYZWGB/uOyjZWjmRDumXTas7dGBaB9zUyCjzHet1DY2KhyHN8R0GLbzZWqm4efeddqqyRQ==
+ version "1.4.131"
+ resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.131.tgz#ca42d22eac0fe545860fbc636a6f4a7190ba70a9"
+ integrity sha512-oi3YPmaP87hiHn0c4ePB67tXaF+ldGhxvZnT19tW9zX6/Ej+pLN0Afja5rQ6S+TND7I9EuwQTT8JYn1k7R7rrw==
emittery@^0.10.2:
version "0.10.2"
@@ -4415,7 +4415,7 @@ error-stack-parser@^2.0.6:
dependencies:
stackframe "^1.1.1"
-es-abstract@^1.19.1, es-abstract@^1.19.2:
+es-abstract@^1.19.1, es-abstract@^1.19.2, es-abstract@^1.19.5:
version "1.19.5"
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.5.tgz#a2cb01eb87f724e815b278b0dd0d00f36ca9a7f1"
integrity sha512-Aa2G2+Rd3b6kxEUKTF4TaW67czBLyAv3z7VOhYRU50YBx+bbsYZ9xQP4lMNazePuFlybXI0V4MruPos7qUo5fA==
@@ -6939,9 +6939,9 @@ mz@^2.4.0:
thenify-all "^1.0.0"
nanoid@^3.3.3:
- version "3.3.3"
- resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25"
- integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==
+ version "3.3.4"
+ resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
+ integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==
natural-compare@^1.4.0:
version "1.4.0"
@@ -8725,20 +8725,22 @@ string.prototype.matchall@^4.0.6:
side-channel "^1.0.4"
string.prototype.trimend@^1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80"
- integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz#914a65baaab25fbdd4ee291ca7dde57e869cb8d0"
+ integrity sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==
dependencies:
call-bind "^1.0.2"
- define-properties "^1.1.3"
+ define-properties "^1.1.4"
+ es-abstract "^1.19.5"
string.prototype.trimstart@^1.0.4:
- version "1.0.4"
- resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed"
- integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==
+ version "1.0.5"
+ resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz#5466d93ba58cfa2134839f81d7f42437e8c01fef"
+ integrity sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==
dependencies:
call-bind "^1.0.2"
- define-properties "^1.1.3"
+ define-properties "^1.1.4"
+ es-abstract "^1.19.5"
string_decoder@^1.1.1:
version "1.3.0"
diff --git a/lib/federation/activity_pub/audience.ex b/lib/federation/activity_pub/audience.ex
index 19502dfaa..fd1a97f6e 100644
--- a/lib/federation/activity_pub/audience.ex
+++ b/lib/federation/activity_pub/audience.ex
@@ -228,13 +228,13 @@ defmodule Mobilizon.Federation.ActivityPub.Audience do
|> Enum.uniq()
end
- defp add_event_contacts(%Event{contacts: contacts}) do
+ defp add_event_contacts(%Event{contacts: contacts}) when is_list(contacts) do
contacts
|> Enum.map(& &1.url)
|> Enum.uniq()
end
- defp add_event_contacts(%Event{}), do: []
+ defp add_event_contacts(_), do: []
defp process_mention({_, mentioned_actor}), do: mentioned_actor.url
diff --git a/lib/federation/activity_pub/refresher.ex b/lib/federation/activity_pub/refresher.ex
index c85549a10..beec5b4b4 100644
--- a/lib/federation/activity_pub/refresher.ex
+++ b/lib/federation/activity_pub/refresher.ex
@@ -191,8 +191,8 @@ defmodule Mobilizon.Federation.ActivityPub.Refresher do
defp process_collection(_, _), do: :error
# If we're handling an activity
- @spec handling_element(map()) :: {:ok, any, struct} | :error
- @spec handling_element(String.t()) :: {:ok, struct} | {:ok, atom, struct} | {:error, any()}
+ @spec handling_element(map() | String.t()) ::
+ {:ok, any, struct} | {:ok, struct} | {:ok, atom, struct} | {:error, any()} | :error
defp handling_element(%{"type" => activity_type} = data)
when activity_type in ["Create", "Update", "Delete"] do
object = get_in(data, ["object"])
diff --git a/lib/federation/activity_stream/converter/actor.ex b/lib/federation/activity_stream/converter/actor.ex
index 6991bc256..9c5cf9472 100644
--- a/lib/federation/activity_stream/converter/actor.ex
+++ b/lib/federation/activity_stream/converter/actor.ex
@@ -192,5 +192,5 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Actor do
Map.put(res, "location", AddressConverter.model_to_as(physical_address))
end
- defp maybe_add_physical_address(res, %ActorModel{physical_address: _}), do: res
+ defp maybe_add_physical_address(res, _), do: res
end
diff --git a/lib/federation/activity_stream/converter/discussion.ex b/lib/federation/activity_stream/converter/discussion.ex
index 4989871a2..35519f87c 100644
--- a/lib/federation/activity_stream/converter/discussion.ex
+++ b/lib/federation/activity_stream/converter/discussion.ex
@@ -48,12 +48,8 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Discussion do
@impl Converter
@spec as_to_model_data(map) :: map() | {:error, atom()}
def as_to_model_data(%{"type" => "Note", "name" => name} = object) when is_valid_string(name) do
- case extract_actors(object) do
- %{actor_id: actor_id, creator_id: creator_id} ->
- %{actor_id: actor_id, creator_id: creator_id, title: name, url: object["id"]}
-
- {:error, error} ->
- {:error, error}
+ with %{actor_id: actor_id, creator_id: creator_id} <- extract_actors(object) do
+ %{actor_id: actor_id, creator_id: creator_id, title: name, url: object["id"]}
end
end
diff --git a/lib/federation/activity_stream/converter/media.ex b/lib/federation/activity_stream/converter/media.ex
index 42ff958fd..a00d9ab1c 100644
--- a/lib/federation/activity_stream/converter/media.ex
+++ b/lib/federation/activity_stream/converter/media.ex
@@ -46,22 +46,18 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Media do
actor_id
)
when is_binary(media_url) do
- case upload_media(media_url, name) do
- {:error, err} ->
- {:error, err}
+ with {:ok, %{url: url} = uploaded} <- upload_media(media_url, name) do
+ case Medias.get_media_by_url(url) do
+ %MediaModel{file: _file} = media ->
+ {:ok, media}
- {:ok, %{url: url} = uploaded} ->
- case Medias.get_media_by_url(url) do
- %MediaModel{file: _file} = media ->
- {:ok, media}
-
- nil ->
- Medias.create_media(%{
- file: Map.take(uploaded, [:url, :name, :content_type, :size]),
- metadata: Map.take(uploaded, [:width, :height, :blurhash]),
- actor_id: actor_id
- })
- end
+ nil ->
+ Medias.create_media(%{
+ file: Map.take(uploaded, [:url, :name, :content_type, :size]),
+ metadata: Map.take(uploaded, [:width, :height, :blurhash]),
+ actor_id: actor_id
+ })
+ end
end
end
diff --git a/lib/graphql/resolvers/event/utils.ex b/lib/graphql/resolvers/event/utils.ex
index a120f8e7d..c4d014ae3 100644
--- a/lib/graphql/resolvers/event/utils.ex
+++ b/lib/graphql/resolvers/event/utils.ex
@@ -4,9 +4,9 @@ defmodule Mobilizon.GraphQL.Resolvers.Event.Utils do
"""
alias Mobilizon.Actors.Actor
- alias Mobilizon.{Config, Events}
+ alias Mobilizon.Events
alias Mobilizon.Events.Event
- alias Mobilizon.Federation.ActivityPub.Permission
+ alias Mobilizon.Federation.ActivityPub.{Permission, Relay}
import Mobilizon.Service.Guards, only: [is_valid_string: 1]
@spec can_event_be_updated_by?(Event.t(), Actor.t()) ::
@@ -43,7 +43,7 @@ defmodule Mobilizon.GraphQL.Resolvers.Event.Utils do
def check_event_access?(%Event{local: true}), do: true
def check_event_access?(%Event{url: url}) do
- relay_actor_id = Config.relay_actor_id()
- Events.check_if_event_has_instance_follow(url, relay_actor_id)
+ relay_actor = Relay.get_actor()
+ Events.check_if_event_has_instance_follow(url, relay_actor.id)
end
end
diff --git a/lib/mobilizon/actors/actors.ex b/lib/mobilizon/actors/actors.ex
index 5fa587254..14d6cb372 100644
--- a/lib/mobilizon/actors/actors.ex
+++ b/lib/mobilizon/actors/actors.ex
@@ -848,7 +848,13 @@ defmodule Mobilizon.Actors do
@doc """
Returns a paginated list of members for a group.
"""
- @spec list_members_for_group(Actor.t(), list(atom()), integer | nil, integer | nil) ::
+ @spec list_members_for_group(
+ Actor.t(),
+ String.t() | nil,
+ list(atom()),
+ integer | nil,
+ integer | nil
+ ) ::
Page.t(Member.t())
def list_members_for_group(
%Actor{id: group_id, type: :Group},
diff --git a/lib/mobilizon/config.ex b/lib/mobilizon/config.ex
index cf07051ba..abafe9ece 100644
--- a/lib/mobilizon/config.ex
+++ b/lib/mobilizon/config.ex
@@ -322,8 +322,6 @@ defmodule Mobilizon.Config do
@spec anonymous_actor_id :: integer
def anonymous_actor_id, do: get_cached_value(:anonymous_actor_id)
- @spec relay_actor_id :: integer
- def relay_actor_id, do: get_cached_value(:relay_actor_id)
@spec admin_settings :: map
def admin_settings, do: get_cached_value(:admin_config)
@@ -401,16 +399,6 @@ defmodule Mobilizon.Config do
end
end
- defp create_cache(:relay_actor_id) do
- case Actors.get_or_create_internal_actor("relay") do
- {:ok, %{id: actor_id}} ->
- {:ok, actor_id}
-
- {:error, err} ->
- {:error, err}
- end
- end
-
defp create_cache(:admin_config) do
data = %{
instance_description: instance_description(),
diff --git a/lib/mobilizon/events/events.ex b/lib/mobilizon/events/events.ex
index c894d0280..8287b4e9d 100644
--- a/lib/mobilizon/events/events.ex
+++ b/lib/mobilizon/events/events.ex
@@ -28,6 +28,7 @@ defmodule Mobilizon.Events do
Track
}
+ alias Mobilizon.Federation.ActivityPub.Relay
alias Mobilizon.Service.Export.Cachable
alias Mobilizon.Service.Workers.BuildSearch
alias Mobilizon.Service.Workers.EventDelayedNotificationWorker
@@ -1676,7 +1677,7 @@ defmodule Mobilizon.Events do
@spec filter_local_or_from_followed_instances_events(Ecto.Queryable.t()) ::
Ecto.Query.t()
defp filter_local_or_from_followed_instances_events(query) do
- follower_actor_id = Mobilizon.Config.relay_actor_id()
+ %Actor{id: follower_actor_id} = Relay.get_actor()
query
|> join(:left, [q], s in Share, on: s.uri == q.url)
diff --git a/lib/service/activity/renderer/renderer.ex b/lib/service/activity/renderer/renderer.ex
index 14eb6693f..7af3e5680 100644
--- a/lib/service/activity/renderer/renderer.ex
+++ b/lib/service/activity/renderer/renderer.ex
@@ -29,7 +29,7 @@ defmodule Mobilizon.Service.Activity.Renderer do
@type common_render :: %{body: String.t(), url: String.t()}
- @callback render(entity :: Activity.t(), Keyword.t()) :: common_render()
+ @callback render(activity :: Activity.t(), Keyword.t()) :: common_render()
@spec render(Activity.t()) :: render()
def render(%Activity{} = activity, options \\ []) do
diff --git a/lib/service/geospatial/google_maps.ex b/lib/service/geospatial/google_maps.ex
index 47dc91797..f4e3f185a 100644
--- a/lib/service/geospatial/google_maps.ex
+++ b/lib/service/geospatial/google_maps.ex
@@ -72,7 +72,7 @@ defmodule Mobilizon.Service.Geospatial.GoogleMaps do
end
end
- @spec build_url(:search | :geocode, map(), list()) :: String.t() | no_return
+ @spec build_url(:search | :geocode | :place_details, map(), list()) :: String.t() | no_return
defp build_url(method, args, options) do
limit = Keyword.get(options, :limit, 10)
lang = Keyword.get(options, :lang, "en")
diff --git a/lib/service/notifications/scheduler.ex b/lib/service/notifications/scheduler.ex
index 94d670ed0..792734e98 100644
--- a/lib/service/notifications/scheduler.ex
+++ b/lib/service/notifications/scheduler.ex
@@ -289,7 +289,7 @@ defmodule Mobilizon.Service.Notifications.Scheduler do
{:ok, nil}
# Sending to calculated time
- true ->
+ match?(%DateTime{}, send_at) ->
Notification.enqueue(:pending_membership_notification, params, scheduled_at: send_at)
end
end
diff --git a/lib/service/notifier/push.ex b/lib/service/notifier/push.ex
index ecf13a239..c6d9102f3 100644
--- a/lib/service/notifier/push.ex
+++ b/lib/service/notifier/push.ex
@@ -73,7 +73,7 @@ defmodule Mobilizon.Service.Notifier.Push do
Map.get(@default_behavior, activity_setting, false)
end
- @spec send_subscription(Activity.t(), any, Keyword.t()) :: no_return
+ @spec send_subscription(Activity.t(), any, Keyword.t()) :: any()
defp send_subscription(activity, subscription, options) do
activity
|> payload(options)
diff --git a/lib/service/workers/helper.ex b/lib/service/workers/helper.ex
index 8cb14f399..002ff2cca 100644
--- a/lib/service/workers/helper.ex
+++ b/lib/service/workers/helper.ex
@@ -41,7 +41,7 @@ defmodule Mobilizon.Service.Workers.Helper do
alias Oban.Job
- @spec enqueue(String.t() | :atom, map(), Keyword.t()) ::
+ @spec enqueue(String.t() | atom(), map(), Keyword.t()) ::
{:ok, Job.t()} | {:error, Ecto.Changeset.t()}
def enqueue(operation, params, worker_args \\ []) do
params = Map.merge(%{"op" => operation}, params)
diff --git a/lib/web/email/follow.ex b/lib/web/email/follow.ex
index 622b1ddc8..5da1c80f7 100644
--- a/lib/web/email/follow.ex
+++ b/lib/web/email/follow.ex
@@ -13,12 +13,12 @@ defmodule Mobilizon.Web.Email.Follow do
alias Mobilizon.Web.Email
@doc """
- Send follow notification to admins if the followed actor
+ Send follow notification to admins if the followed actor is the relay and the actor follower is an instance
"""
@spec send_notification_to_admins(Follower.t()) :: :ok
def send_notification_to_admins(
%Follower{
- # approved: false,
+ approved: false,
actor: %Actor{type: :Application} = follower,
target_actor: %Actor{id: target_actor_id}
} = _follow
diff --git a/mix.exs b/mix.exs
index b84fad460..7d3e270ae 100644
--- a/mix.exs
+++ b/mix.exs
@@ -1,7 +1,7 @@
defmodule Mobilizon.Mixfile do
use Mix.Project
- @version "2.1.0-rc.3"
+ @version "2.1.0-rc.4"
def project do
[
diff --git a/mix.lock b/mix.lock
index 72c9d89ef..1f65da4d8 100644
--- a/mix.lock
+++ b/mix.lock
@@ -68,7 +68,6 @@
"html_entities": {:hex, :html_entities, "0.5.2", "9e47e70598da7de2a9ff6af8758399251db6dbb7eebe2b013f2bbd2515895c3c", [:mix], [], "hexpm", "c53ba390403485615623b9531e97696f076ed415e8d8058b1dbaa28181f4fdcc"},
"http_signatures": {:hex, :http_signatures, "0.1.1", "ca7ebc1b61542b163644c8c3b1f0e0f41037d35f2395940d3c6c7deceab41fd8", [:mix], [], "hexpm", "cc3b8a007322cc7b624c0c15eec49ee58ac977254ff529a3c482f681465942a3"},
"httpoison": {:hex, :httpoison, "1.8.1", "df030d96de89dad2e9983f92b0c506a642d4b1f4a819c96ff77d12796189c63e", [:mix], [{:hackney, "~> 1.17", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "35156a6d678d6d516b9229e208942c405cf21232edd632327ecfaf4fd03e79e0"},
- "hut": {:hex, :hut, "1.3.0", "71f2f054e657c03f959cf1acc43f436ea87580696528ca2a55c8afb1b06c85e7", [:"erlang.mk", :rebar, :rebar3], [], "hexpm", "7e15d28555d8a1f2b5a3a931ec120af0753e4853a4c66053db354f35bf9ab563"},
"icalendar": {:git, "https://github.com/tcitworld/icalendar.git", "1033d922c82a7223db0ec138e2316557b70ff49f", []},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"inet_cidr": {:hex, :inet_cidr, "1.0.4", "a05744ab7c221ca8e395c926c3919a821eb512e8f36547c062f62c4ca0cf3d6e", [:mix], [], "hexpm", "64a2d30189704ae41ca7dbdd587f5291db5d1dda1414e0774c29ffc81088c1bc"},
diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po
index 441e5e809..f4ac09e64 100644
--- a/priv/gettext/en/LC_MESSAGES/default.po
+++ b/priv/gettext/en/LC_MESSAGES/default.po
@@ -1243,7 +1243,7 @@ msgstr "Your participation to event %{title} has been approved"
#, elixir-autogen, elixir-format
#: lib/web/templates/email/report.html.heex:41
msgid "%{reporter} reported the following content."
-msgstr "%{reporter_name} (%{reporter_username}) reported the following content."
+msgstr "%{reporter} reported the following content."
#, elixir-autogen, elixir-format
#: lib/web/templates/email/report.text.eex:5
diff --git a/test/federation/activity_pub/transmogrifier/follow_test.exs b/test/federation/activity_pub/transmogrifier/follow_test.exs
index 925bdd82c..ed464820d 100644
--- a/test/federation/activity_pub/transmogrifier/follow_test.exs
+++ b/test/federation/activity_pub/transmogrifier/follow_test.exs
@@ -5,8 +5,11 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.FollowTest do
import Mobilizon.Factory
alias Mobilizon.Actors
alias Mobilizon.Actors.Follower
- alias Mobilizon.Federation.ActivityPub.{Actions, Activity, Transmogrifier}
+ alias Mobilizon.Federation.ActivityPub.{Actions, Activity, Relay, Transmogrifier}
alias Mobilizon.Service.HTTP.ActivityPub.Mock
+ alias Mobilizon.Users.User
+
+ import Swoosh.TestAssertions
describe "handle incoming follow requests" do
test "it works only for groups" do
@@ -99,6 +102,83 @@ defmodule Mobilizon.Federation.ActivityPub.Transmogrifier.FollowTest do
# assert data["id"] == "https://hubzilla.example.org/channel/kaniini#follows/2"
# assert User.check_follow(User.get_by_ap_id(data["actor"]), user)
# end
+
+ test "it works for accepting instance follow from user" do
+ %User{} = insert(:user, email: "loulou@example.com", role: :administrator)
+ relay = Relay.get_actor()
+
+ actor_data =
+ File.read!("test/fixtures/mastodon-actor.json")
+ |> Jason.decode!()
+
+ Mock
+ |> expect(:call, fn
+ %{method: :get, url: "https://social.tcit.fr/users/tcit"}, _opts ->
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: Map.put(actor_data, "id", "https://social.tcit.fr/users/tcit")
+ }}
+ end)
+
+ data =
+ File.read!("test/fixtures/mastodon-follow-activity.json")
+ |> Jason.decode!()
+ |> Map.put("object", relay.url)
+
+ {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data)
+
+ assert data["actor"] == "https://social.tcit.fr/users/tcit"
+ assert data["type"] == "Follow"
+ assert data["id"] == "https://social.tcit.fr/users/tcit#follows/2"
+
+ follow = Actors.check_follow(Actors.get_actor_by_url!(data["actor"], true), relay)
+ assert follow
+ refute follow.approved
+
+ refute_email_sent()
+ end
+
+ test "it works for accepting instance follow from other instance" do
+ %User{email: admin_email} = insert(:user, email: "loulou@example.com", role: :administrator)
+ relay = Relay.get_actor()
+
+ actor_data =
+ File.read!("test/fixtures/mastodon-actor.json")
+ |> Jason.decode!()
+
+ Mock
+ |> expect(:call, fn
+ %{method: :get, url: "https://mobilizon.fr/relay"}, _opts ->
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body:
+ actor_data
+ |> Map.put("id", "https://mobilizon.fr/relay")
+ |> Map.put("type", "Application")
+ }}
+ end)
+
+ data =
+ File.read!("test/fixtures/mastodon-follow-activity.json")
+ |> Jason.decode!()
+ |> Map.put("actor", "https://mobilizon.fr/relay")
+ |> Map.put("id", "https://mobilizon.fr/relay#follows/2")
+ |> Map.put("object", relay.url)
+
+ {:ok, %Activity{data: data, local: false}, _} = Transmogrifier.handle_incoming(data)
+
+ assert data["actor"] == "https://mobilizon.fr/relay"
+ assert data["type"] == "Follow"
+ assert data["id"] == "https://mobilizon.fr/relay#follows/2"
+
+ follow = Actors.check_follow(Actors.get_actor_by_url!(data["actor"], true), relay)
+ assert follow
+ refute follow.approved
+
+ assert_email_sent(to: admin_email)
+ end
end
describe "handle incoming follow accept activities" do
diff --git a/test/graphql/resolvers/report_test.exs b/test/graphql/resolvers/report_test.exs
index 370cb4770..62e17b94d 100644
--- a/test/graphql/resolvers/report_test.exs
+++ b/test/graphql/resolvers/report_test.exs
@@ -7,10 +7,11 @@ defmodule Mobilizon.GraphQL.Resolvers.ReportTest do
alias Mobilizon.Actors.Actor
alias Mobilizon.Config
alias Mobilizon.Events.Event
+ alias Mobilizon.GraphQL.AbsintheHelpers
alias Mobilizon.Reports.{Note, Report}
alias Mobilizon.Users.User
- alias Mobilizon.GraphQL.AbsintheHelpers
+ import Swoosh.TestAssertions
describe "Resolver: Report a content" do
@create_report_mutation """
@@ -41,6 +42,7 @@ defmodule Mobilizon.GraphQL.Resolvers.ReportTest do
end
test "create_report/3 creates a report", %{conn: conn} do
+ %User{email: admin_email} = insert(:user, email: "loulou@example.com", role: :administrator)
%User{} = user_reporter = insert(:user)
%Actor{} = reporter = insert(:actor, user: user_reporter)
%Actor{} = reported = insert(:actor)
@@ -65,6 +67,8 @@ defmodule Mobilizon.GraphQL.Resolvers.ReportTest do
assert res["data"]["createReport"]["reporter"]["id"] ==
to_string(reporter.id)
+
+ assert_email_sent(to: admin_email)
end
test "create_report/3 without being connected doesn't create any report", %{conn: conn} do