diff --git a/.gitignore b/.gitignore index 845929f4..4804240a 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ erl_crash.dump # secrets files as long as you replace their contents by environment # variables. /config/*.secret.exs +/config/runtime.exs /setup_db.psql diff --git a/.sobelow-conf b/.sobelow-conf index fc094090..8cd2246e 100644 --- a/.sobelow-conf +++ b/.sobelow-conf @@ -8,5 +8,5 @@ out: "", threshold: "medium", ignore: ["Config.HTTPS", "Config.CSP"], - ignore_files: ["config/dev.1.secret.exs", "config/dev.2.secret.exs", "config/dev.3.secret.exs", "config/dev.secret.exs", "config/e2e.secret.exs", "config/prod.secret.exs", "config/test.secret.exs"] + ignore_files: ["config/dev.1.secret.exs", "config/dev.2.secret.exs", "config/dev.3.secret.exs", "config/dev.secret.exs", "config/e2e.secret.exs", "config/prod.secret.exs", "config/test.secret.exs", "config/runtime.1.secret.exs", "config/runtime.2.secret.exs", "config/runtime.3.secret.exs", "config/runtime.exs"] ] diff --git a/.sobelow-skips b/.sobelow-skips index bbe2ea12..2141d476 100644 --- a/.sobelow-skips +++ b/.sobelow-skips @@ -1,4 +1,5 @@ 5048AE33D6269B15E21CF28C6F545AB6 -752C0E897CA81ACD81F4BB215FA5F8E4 \ No newline at end of file +752C0E897CA81ACD81F4BB215FA5F8E4 +23412CF16549E4E88366DC9DECF39071 \ No newline at end of file diff --git a/config/config.exs b/config/config.exs index 3d0c6ac3..038cd81c 100644 --- a/config/config.exs +++ b/config/config.exs @@ -59,7 +59,8 @@ config :mobilizon, Mobilizon.Web.Endpoint, config :mime, :types, %{ "application/activity+json" => ["activity-json"], "application/ld+json" => ["activity-json"], - "application/jrd+json" => ["jrd-json"] + "application/jrd+json" => ["jrd-json"], + "application/xrd+xml" => ["xrd-xml"] } # Upload configuration diff --git a/config/dev.exs b/config/dev.exs index 3209d7e5..970788f9 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -97,20 +97,3 @@ config :mobilizon, :anonymous, reports: [ allowed: true ] - -require Logger - -cond do - System.get_env("INSTANCE_CONFIG") && - File.exists?("./config/#{System.get_env("INSTANCE_CONFIG")}") -> - import_config System.get_env("INSTANCE_CONFIG") - - System.get_env("DOCKER", "false") == "false" && File.exists?("./config/dev.secret.exs") -> - import_config "dev.secret.exs" - - System.get_env("DOCKER", "false") == "true" -> - Logger.info("Using environment configuration for Docker") - - true -> - Logger.error("No configuration file found") -end diff --git a/js/package.json b/js/package.json index 930c01f0..200e5182 100644 --- a/js/package.json +++ b/js/package.json @@ -33,7 +33,7 @@ "graphql-tag": "^2.10.3", "intersection-observer": "^0.12.0", "leaflet": "^1.4.0", - "leaflet.locatecontrol": "^0.72.0", + "leaflet.locatecontrol": "^0.73.0", "lodash": "^4.17.11", "ngeohash": "^0.6.3", "phoenix": "^1.4.11", @@ -67,14 +67,14 @@ "@types/vuedraggable": "^2.23.0", "@typescript-eslint/eslint-plugin": "^4.14.1", "@typescript-eslint/parser": "^4.14.1", - "@vue/cli-plugin-babel": "~4.5.11", - "@vue/cli-plugin-e2e-cypress": "~4.5.11", - "@vue/cli-plugin-eslint": "~4.5.11", - "@vue/cli-plugin-pwa": "~4.5.11", - "@vue/cli-plugin-router": "~4.5.11", - "@vue/cli-plugin-typescript": "~4.5.11", - "@vue/cli-plugin-unit-jest": "~4.5.11", - "@vue/cli-service": "~4.5.11", + "@vue/cli-plugin-babel": "~4.5.12", + "@vue/cli-plugin-e2e-cypress": "~4.5.12", + "@vue/cli-plugin-eslint": "~4.5.12", + "@vue/cli-plugin-pwa": "~4.5.12", + "@vue/cli-plugin-router": "~4.5.12", + "@vue/cli-plugin-typescript": "~4.5.12", + "@vue/cli-plugin-unit-jest": "~4.5.12", + "@vue/cli-service": "~4.5.12", "@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-typescript": "^7.0.0", "@vue/test-utils": "^1.1.0", diff --git a/js/src/components/Comment/CommentTree.vue b/js/src/components/Comment/CommentTree.vue index 363f517a..d845ebc5 100644 --- a/js/src/components/Comment/CommentTree.vue +++ b/js/src/components/Comment/CommentTree.vue @@ -24,6 +24,9 @@ v-model="newComment.text" />

+

+ {{ $t("Comment text can't be empty") }} +

"].includes(newComment.text); + } + } + async createCommentForEvent(comment: IComment): Promise { + this.emptyCommentError = ["", "

"].includes(comment.text); + if (this.emptyCommentError) return; try { if (!comment.actor) return; await this.$apollo.mutate({ @@ -216,10 +230,13 @@ export default class CommentTree extends Vue { // and reset the new comment field this.newComment = new CommentModel(); - } catch (error) { - console.error(error); - if (error.graphQLErrors && error.graphQLErrors.length > 0) { - this.$notifier.error(error.graphQLErrors[0].message); + } catch (errors) { + console.error(errors); + if (errors.graphQLErrors && errors.graphQLErrors.length > 0) { + const error = errors.graphQLErrors[0]; + if (error.field !== "text" && error.message[0] !== "can't be blank") { + this.$notifier.error(error.message); + } } } } diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json index 066791bc..0953e0c0 100644 --- a/js/src/i18n/en_US.json +++ b/js/src/i18n/en_US.json @@ -967,5 +967,7 @@ "You posted a comment on the event {event}.": "You posted a comment on the event {event}.", "{profile} posted a comment on the event {event}.": "{profile} posted a comment on the event {event}.", "You replied to a comment on the event {event}.": "You replied to a comment on the event {event}.", - "{profile} replied to a comment on the event {event}.": "{profile} replied to a comment on the event {event}." + "{profile} replied to a comment on the event {event}.": "{profile} replied to a comment on the event {event}.", + "New post": "New post", + "Comment text can't be empty": "Comment text can't be empty" } diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json index 7ffb0ae0..992fc10e 100644 --- a/js/src/i18n/fr_FR.json +++ b/js/src/i18n/fr_FR.json @@ -1061,5 +1061,7 @@ "You posted a comment on the event {event}.": "Vous avez posté un commentaire sur l'événement {event}.", "{profile} posted a comment on the event {event}.": "{profile} a posté un commentaire sur l'événement {event}.", "You replied to a comment on the event {event}.": "Vous avez répondu à un commentaire sur l'événement {event}.", - "{profile} replied to a comment on the event {event}.": "{profile} a répondu à un commentaire sur l'événement {event}." + "{profile} replied to a comment on the event {event}.": "{profile} a répondu à un commentaire sur l'événement {event}.", + "New post": "Nouveau billet", + "Comment text can't be empty": "Le texte du commentaire ne peut être vide" } diff --git a/js/src/mixins/group.ts b/js/src/mixins/group.ts index 4003ecf2..1ff873f9 100644 --- a/js/src/mixins/group.ts +++ b/js/src/mixins/group.ts @@ -34,7 +34,7 @@ import { Component, Vue } from "vue-property-decorator"; variables() { return { id: this.currentActor.id, - group: this.$route.params.preferredUsername, + group: this.group.preferredUsername, }; }, subscribeToMore: { @@ -42,14 +42,14 @@ import { Component, Vue } from "vue-property-decorator"; variables() { return { actorId: this.currentActor.id, - group: this.$route.params.preferredUsername, + group: this.group.preferredUsername, }; }, skip() { return ( !this.currentActor || !this.currentActor.id || - !this.$route.params.preferredUsername + !this.group.preferredUsername ); }, }, @@ -57,7 +57,7 @@ import { Component, Vue } from "vue-property-decorator"; return ( !this.currentActor || !this.currentActor.id || - !this.$route.params.preferredUsername + !this.group.preferredUsername ); }, }, diff --git a/js/src/views/Discussions/Create.vue b/js/src/views/Discussions/Create.vue index adec42d1..f7ff343e 100644 --- a/js/src/views/Discussions/Create.vue +++ b/js/src/views/Discussions/Create.vue @@ -3,7 +3,11 @@

{{ $t("Create a discussion") }}

- + @@ -64,7 +68,10 @@ export default class CreateDiscussion extends Vue { discussion = { title: "", text: "" }; + errors = { title: "" }; + async createDiscussion(): Promise { + this.errors = { title: "" }; try { if (!this.group.id || !this.currentActor.id) return; const { data } = await this.$apollo.mutate({ @@ -86,7 +93,11 @@ export default class CreateDiscussion extends Vue { } catch (error) { console.error(error); if (error.graphQLErrors && error.graphQLErrors.length > 0) { - this.$notifier.error(error.graphQLErrors[0].message); + if (error.graphQLErrors[0].field == "title") { + this.errors.title = error.graphQLErrors[0].message; + } else { + this.$notifier.error(error.graphQLErrors[0].message); + } } } } diff --git a/js/src/views/Posts/Edit.vue b/js/src/views/Posts/Edit.vue index 74703f31..b976b336 100644 --- a/js/src/views/Posts/Edit.vue +++ b/js/src/views/Posts/Edit.vue @@ -2,6 +2,43 @@
+

{{ $t("Edit post") }}

@@ -111,7 +148,6 @@ diff --git a/js/src/views/Resources/ResourceFolder.vue b/js/src/views/Resources/ResourceFolder.vue index 83873920..645b03ff 100644 --- a/js/src/views/Resources/ResourceFolder.vue +++ b/js/src/views/Resources/ResourceFolder.vue @@ -190,6 +190,9 @@