From 0088cead8cf9ca1090edac4a69a02dfda5977a58 Mon Sep 17 00:00:00 2001 From: Discourse Translator Bot Date: Thu, 10 Mar 2022 10:51:37 -0500 Subject: [PATCH 001/333] Update translations (#243) --- config/locales/client.fa_IR.yml | 3 +++ config/locales/client.he.yml | 3 +++ config/locales/client.hu.yml | 3 +++ config/locales/server.hu.yml | 15 +++++++++++++++ 4 files changed, 24 insertions(+) diff --git a/config/locales/client.fa_IR.yml b/config/locales/client.fa_IR.yml index 3b55ea69f..74d9c93cb 100644 --- a/config/locales/client.fa_IR.yml +++ b/config/locales/client.fa_IR.yml @@ -305,6 +305,9 @@ fa_IR: create: "ایجاد" update: "ذخیره" attach: "ایجاد رویداد" + timezone: + label: منطقه زمانی + remove_timezone: بدون منطقه زمانی (UTC) status: label: "وضعیت" invite_user_or_group: diff --git a/config/locales/client.he.yml b/config/locales/client.he.yml index 64f9948bc..99b19485f 100644 --- a/config/locales/client.he.yml +++ b/config/locales/client.he.yml @@ -360,6 +360,9 @@ he: update: "שמירה" attach: "יצירת אירוע" add_reminder: "הוספת תזכורת" + timezone: + label: אזור זמן + remove_timezone: אין אזור זמן (UTC) reminders: label: "תזכורות" recurrence: diff --git a/config/locales/client.hu.yml b/config/locales/client.hu.yml index 773d67e41..0b0f56c7c 100644 --- a/config/locales/client.hu.yml +++ b/config/locales/client.hu.yml @@ -364,6 +364,9 @@ hu: update: "Mentés" attach: "Esemény létrehozása" add_reminder: "Emlékeztető hozzáadása" + timezone: + label: Időzóna + remove_timezone: Nincs időzóna (UTC) reminders: label: "Emlékeztetők" recurrence: diff --git a/config/locales/server.hu.yml b/config/locales/server.hu.yml index a39be5be2..691453f3c 100644 --- a/config/locales/server.hu.yml +++ b/config/locales/server.hu.yml @@ -7,6 +7,7 @@ hu: reports: currently_away: + title: Jelenleg távol lévő felhasználók labels: username: Felhasználónév discourse_automation: @@ -18,6 +19,17 @@ hu: title: "Esemény – A csoportos meghívás sikeres" subject_template: "A csoportos meghívás feldolgozása sikeres" text_body_template: "A csoportos meghívás feldolgozása sikeres, %{processed} meghívott létrehozva." + discourse_post_event_bulk_invite_failed: + title: "Esemény – A csoportos meghívás sikertelen" + subject_template: "Hiba a csoportos meghívás feldolgozása során" + text_body_template: | + A csoportos meghívási fájl feldolgozása megtörtént, %{processed} meghívott jött létre %{failed} hibával. + + Ez a napló: + + ```text + %{logs} + ``` site_settings: working_day_start_hour: "A munkanapok kezdési időpontja." working_day_end_hour: "A munkanapok befejezési időpontja." @@ -33,6 +45,9 @@ hu: after_event_reminder: "A(z) %{title} véget ért." ongoing_event_reminder: "A(z) %{title} folyamatban van." errors: + bulk_invite: + max_invitees: "Az első %{max_invittes} meghívott lett létrehozva. Próbálja meg a fájlt kisebb részekre osztani." + error: "Hiba történt a fájl feltöltése során. Próbálja újra később." models: event: only_one_event: "Egy bejegyzésnek csak egy eseménye lehet." From c44d348c7739f08fe026f1d67dbd902cb2f4d590 Mon Sep 17 00:00:00 2001 From: discoursebot Date: Tue, 22 Mar 2022 09:02:35 -0400 Subject: [PATCH 002/333] DEV: Update CI workflows (#244) Co-authored-by: discoursebuild --- .github/workflows/plugin-linting.yml | 4 ++-- .github/workflows/plugin-tests.yml | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/plugin-linting.yml b/.github/workflows/plugin-linting.yml index 64b47d538..d0e6e6047 100644 --- a/.github/workflows/plugin-linting.yml +++ b/.github/workflows/plugin-linting.yml @@ -15,10 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: yarn diff --git a/.github/workflows/plugin-tests.yml b/.github/workflows/plugin-tests.yml index c4fdfd219..5832d383a 100644 --- a/.github/workflows/plugin-tests.yml +++ b/.github/workflows/plugin-tests.yml @@ -31,13 +31,13 @@ jobs: build_type: ["backend", "frontend-legacy", "frontend"] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: repository: discourse/discourse fetch-depth: 1 - name: Install plugin - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: plugins/${{ github.event.repository.name }} fetch-depth: 1 @@ -58,7 +58,7 @@ jobs: sudo -u postgres psql -c "CREATE ROLE $PGUSER LOGIN SUPERUSER PASSWORD '$PGPASSWORD';" - name: Bundler cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: vendor/bundle key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} @@ -83,7 +83,7 @@ jobs: run: echo "::set-output name=dir::$(yarn cache dir)" - name: Yarn cache - uses: actions/cache@v2 + uses: actions/cache@v3 id: yarn-cache with: path: ${{ steps.yarn-cache-dir.outputs.dir }} @@ -95,7 +95,7 @@ jobs: run: yarn install - name: Fetch app state cache - uses: actions/cache@v2 + uses: actions/cache@v3 id: app-cache with: path: tmp/app-cache From 986399e9483ba04e9572b5d9b04155ace7e4d656 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Thu, 24 Mar 2022 20:14:53 -0400 Subject: [PATCH 003/333] FEATURE: Include full date label as tooltip in topic list (#245) * FEATURE: Include full date label as tooltip in topic list * Small change to test --- assets/javascripts/lib/event-relative-date.js | 8 ++++ .../common/discourse-post-event-core-ext.scss | 1 + .../acceptance/topic-title-decorator-test.js | 46 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 test/javascripts/acceptance/topic-title-decorator-test.js diff --git a/assets/javascripts/lib/event-relative-date.js b/assets/javascripts/lib/event-relative-date.js index b4f138d5e..0c437c8ff 100644 --- a/assets/javascripts/lib/event-relative-date.js +++ b/assets/javascripts/lib/event-relative-date.js @@ -1,4 +1,5 @@ import I18n from "I18n"; +import guessDateFormat from "discourse/plugins/discourse-calendar/lib/guess-best-date-format"; function _computeCurrentEvent(container, endsAt) { const indicator = document.createElement("div"); @@ -30,6 +31,13 @@ export default function eventRelativeDate(container) { .tz(moment.tz.guess()); const endsAt = moment.utc(container.dataset.ends_at).tz(moment.tz.guess()); + const format = guessDateFormat(startsAt); + let title = startsAt.format(format); + if (endsAt) { + title += ` → ${endsAt.format(format)}`; + } + container.setAttribute("title", title); + if (startsAt.isAfter(moment()) && endsAt.isAfter(moment())) { container.classList.add("future"); _computeFutureEvent(container, startsAt); diff --git a/assets/stylesheets/common/discourse-post-event-core-ext.scss b/assets/stylesheets/common/discourse-post-event-core-ext.scss index 18feaf7a4..409d01997 100644 --- a/assets/stylesheets/common/discourse-post-event-core-ext.scss +++ b/assets/stylesheets/common/discourse-post-event-core-ext.scss @@ -15,6 +15,7 @@ border-radius: 3px; vertical-align: middle; margin-left: 0.25em; + pointer-events: auto; // needed to show title attribute on hover .indicator { display: flex; diff --git a/test/javascripts/acceptance/topic-title-decorator-test.js b/test/javascripts/acceptance/topic-title-decorator-test.js new file mode 100644 index 000000000..aac9b33ab --- /dev/null +++ b/test/javascripts/acceptance/topic-title-decorator-test.js @@ -0,0 +1,46 @@ +import { acceptance, query } from "discourse/tests/helpers/qunit-helpers"; +import { test } from "qunit"; +import { visit } from "@ember/test-helpers"; +import discoveryFixtures from "discourse/tests/fixtures/discovery-fixtures"; +import { cloneJSON } from "discourse-common/lib/object"; + +const topicList = cloneJSON(discoveryFixtures["/latest.json"]); + +function latestResponse() { + topicList.topic_list.topics[0].event_starts_at = "2022-01-10 19:00:00"; + topicList.topic_list.topics[0].event_ends_at = "2022-01-10 20:00:00"; + return topicList; +} + +acceptance("Discourse Calendar - Event Title Decorator", function (needs) { + needs.user(); + needs.settings({ + calendar_enabled: true, + discourse_post_event_enabled: true, + }); + + needs.pretender((server, helper) => { + server.get("/latest.json", () => { + return helper.response(latestResponse()); + }); + }); + + test("shows event date with attributes in topic list", async (assert) => { + await visit("/latest"); + + const firstTopic = query(".topic-list-item:first-child .raw-topic-link"); + assert.ok(firstTopic.querySelector(".event-date.past")); + assert.ok( + firstTopic.querySelector(".event-date").getAttribute("data-starts_at") + ); + assert.ok( + firstTopic.querySelector(".event-date").getAttribute("data-ends_at") + ); + assert.ok( + firstTopic + .querySelector(".event-date") + .getAttribute("title") + .startsWith("January 10, 2022") + ); + }); +}); From 2d52a11424dae7eff5c6ea4023441cc19c45bad9 Mon Sep 17 00:00:00 2001 From: Discourse Translator Bot Date: Wed, 30 Mar 2022 08:52:44 -0400 Subject: [PATCH 004/333] Update translations (#246) --- config/locales/client.sv.yml | 3 +++ config/locales/server.sv.yml | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/config/locales/client.sv.yml b/config/locales/client.sv.yml index cbec7b778..1166d7b22 100644 --- a/config/locales/client.sv.yml +++ b/config/locales/client.sv.yml @@ -365,6 +365,9 @@ sv: update: "Spara" attach: "Skapa händelse" add_reminder: "Lägg till påminnelse" + timezone: + label: Tidszon + remove_timezone: Ingen tidszon (UTC) reminders: label: "Påminnelser" recurrence: diff --git a/config/locales/server.sv.yml b/config/locales/server.sv.yml index 8040929f1..77d045a28 100644 --- a/config/locales/server.sv.yml +++ b/config/locales/server.sv.yml @@ -5,6 +5,11 @@ # https://translate.discourse.org/ sv: + reports: + currently_away: + title: Användare som för närvarande är borta + labels: + username: Användarnamn discourse_automation: triggerables: event_started: From aaa5fafc01fe756dea3cc15414c64df8dd169db9 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Thu, 31 Mar 2022 11:02:01 -0400 Subject: [PATCH 005/333] DEV: Use `applyLocalDates` helper (instead of jQuery) (#247) --- .discourse-compatibility | 1 + .../initializers/discourse-post-event-decorator.js | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.discourse-compatibility b/.discourse-compatibility index 31e06a387..078f8d902 100644 --- a/.discourse-compatibility +++ b/.discourse-compatibility @@ -1 +1,2 @@ +2.9.0.beta3: 2d52a11424dae7eff5c6ea4023441cc19c45bad9 2.7.0.beta3: 52e22b9972dc79c67f6a2f7c4c9f918307222030 diff --git a/assets/javascripts/initializers/discourse-post-event-decorator.js b/assets/javascripts/initializers/discourse-post-event-decorator.js index 7613c3e77..fde3b1a41 100644 --- a/assets/javascripts/initializers/discourse-post-event-decorator.js +++ b/assets/javascripts/initializers/discourse-post-event-decorator.js @@ -5,6 +5,7 @@ import WidgetGlue from "discourse/widgets/glue"; import { getRegister } from "discourse-common/lib/get-owner"; import { withPluginApi } from "discourse/lib/plugin-api"; import { schedule } from "@ember/runloop"; +import { applyLocalDates } from "discourse/lib/local-dates"; function _decorateEvent(api, cooked, post) { _attachWidget(api, cooked, post); @@ -155,12 +156,13 @@ function _attachWidget(api, cooked, eventModel) { glue.appendTo(glueContainer); _glued.push(glue); - schedule("afterRender", () => - $( - ".discourse-local-date", - $(`[data-post-id="${eventModel.id}"]`) - ).applyLocalDates() + applyLocalDates( + document.querySelectorAll( + `[data-post-id="${eventModel.id}"] .discourse-local-date` + ), + siteSettings + ) ); }); } else { From 39cd923d5f36e39b659e68aaa640d4410438a8f3 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Mon, 11 Apr 2022 15:41:11 -0400 Subject: [PATCH 006/333] UX: Adjust calendar event display (#249) Co-authored-by: Jarek Radosz --- .../initializers/discourse-calendar.js | 74 +++++++++++++------ .../common/discourse-calendar.scss | 28 +++++++ 2 files changed, 78 insertions(+), 24 deletions(-) diff --git a/assets/javascripts/initializers/discourse-calendar.js b/assets/javascripts/initializers/discourse-calendar.js index cecef2ef1..4cd9a5021 100644 --- a/assets/javascripts/initializers/discourse-calendar.js +++ b/assets/javascripts/initializers/discourse-calendar.js @@ -6,7 +6,6 @@ import { escapeExpression } from "discourse/lib/utilities"; import loadScript from "discourse/lib/load-script"; import { withPluginApi } from "discourse/lib/plugin-api"; import { ajax } from "discourse/lib/ajax"; -import { hidePopover, showPopover } from "discourse/lib/d-popover"; import Category from "discourse/models/category"; import I18n from "I18n"; import { @@ -14,6 +13,7 @@ import { contrastColor, stringToColor, } from "discourse/plugins/discourse-calendar/lib/colors"; +import { createPopper } from "@popperjs/core"; function loadFullCalendar() { return loadScript( @@ -21,6 +21,9 @@ function loadFullCalendar() { ); } +let eventPopper; +const EVENT_POPOVER_ID = "event-popover"; + function initializeDiscourseCalendar(api) { let _topicController; const siteSettings = api.container.lookup("site-settings:main"); @@ -103,8 +106,6 @@ function initializeDiscourseCalendar(api) { id: "discourse-calendar", }); - api.cleanupStream(cleanUp); - api.registerCustomPostMessageCallback( "calendar_change", (topicController) => { @@ -141,13 +142,7 @@ function initializeDiscourseCalendar(api) { _setupTimezonePicker(calendar, timezone); } - function cleanUp() { - window.removeEventListener("scroll", hidePopover); - } - function attachCalendar($elem, helper) { - window.addEventListener("scroll", hidePopover); - const $calendar = $(".calendar", $elem); if ($calendar.length === 0) { @@ -280,6 +275,41 @@ function initializeDiscourseCalendar(api) { }); } + function _buildPopover(jsEvent, htmlContent) { + const node = document.createElement("div"); + node.setAttribute("id", EVENT_POPOVER_ID); + node.innerHTML = htmlContent; + + const arrow = document.createElement("span"); + arrow.dataset.popperArrow = true; + node.appendChild(arrow); + document.body.appendChild(node); + + eventPopper = createPopper( + jsEvent.target, + document.getElementById(EVENT_POPOVER_ID), + { + placement: "bottom", + modifiers: [ + { + name: "arrow", + }, + { + name: "offset", + options: { + offset: [20, 10], + }, + }, + ], + } + ); + } + + function _destroyPopover() { + eventPopper?.destroy(); + document.getElementById(EVENT_POPOVER_ID)?.remove(); + } + function _setDynamicCalendarOptions(calendar, $calendar) { const skipWeekends = $calendar.attr("data-weekends") === "false"; const hiddenDays = $calendar.attr("data-hidden-days"); @@ -296,7 +326,7 @@ function initializeDiscourseCalendar(api) { } calendar.setOption("eventClick", ({ event, jsEvent }) => { - hidePopover(jsEvent); + _destroyPopover(); const { htmlContent, postNumber, postUrl } = event.extendedProps; if (postUrl) { @@ -306,20 +336,18 @@ function initializeDiscourseCalendar(api) { _topicController || api.container.lookup("controller:topic"); _topicController.send("jumpToPost", postNumber); } else if (isMobileView && htmlContent) { - showPopover(jsEvent, { htmlContent }); + _buildPopover(jsEvent, htmlContent); } }); calendar.setOption("eventMouseEnter", ({ event, jsEvent }) => { + _destroyPopover(); const { htmlContent } = event.extendedProps; - if (!htmlContent) { - return; - } - showPopover(jsEvent, { htmlContent }); + _buildPopover(jsEvent, htmlContent); }); - calendar.setOption("eventMouseLeave", ({ jsEvent }) => { - hidePopover(jsEvent); + calendar.setOption("eventMouseLeave", () => { + _destroyPopover(); }); } @@ -375,9 +403,9 @@ function initializeDiscourseCalendar(api) { event.textColor = colorToHex(contrastColor(color)); } - let popupText = detail.message.substr(0, 50); - if (detail.message.length > 50) { - popupText = popupText + "..."; + let popupText = detail.message.slice(0, 100); + if (detail.message.length > 100) { + popupText += "…"; } event.extendedProps.htmlContent = popupText; event.title = event.title.replace(/]*>/g, ""); @@ -404,14 +432,12 @@ function initializeDiscourseCalendar(api) { event.classNames = ["grouped-event"]; if (usernames.length > 3) { - event.title = isMobileView - ? usernames.length - : `(${usernames.length}) ` + I18n.t("discourse_calendar.holiday"); + event.title = `(${usernames.length}) ${localEventNames[0]}`; } else if (usernames.length === 1) { event.title = usernames[0]; } else { event.title = isMobileView - ? usernames.length + ? `(${usernames.length}) ${localEventNames[0]}` : `(${usernames.length}) ` + usernames.slice(0, 3).join(", "); } diff --git a/assets/stylesheets/common/discourse-calendar.scss b/assets/stylesheets/common/discourse-calendar.scss index 114770014..268af3954 100644 --- a/assets/stylesheets/common/discourse-calendar.scss +++ b/assets/stylesheets/common/discourse-calendar.scss @@ -399,3 +399,31 @@ a.holiday { width: 15px; height: 15px; } + +#event-popover { + background-color: var(--tertiary-very-low); + z-index: z("modal", "tooltip"); + box-shadow: shadow("dropdown"); + border-radius: 4px; + padding: 0.5em; + max-width: unquote("min(75vw, 400px)"); + + [data-popper-arrow], + [data-popper-arrow]::before { + position: absolute; + width: 10px; + height: 10px; + background: inherit; + top: -2px; + } + + [data-popper-arrow] { + visibility: hidden; + } + + [data-popper-arrow]::before { + visibility: visible; + content: ""; + transform: rotate(45deg); + } +} From 52c6e2119719d178197e0078578d4c28d5c59784 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Apr 2022 12:12:38 +0200 Subject: [PATCH 007/333] Build(deps): Bump minimist from 1.2.5 to 1.2.6 (#250) Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index ecffee08d..7d04472d3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -990,9 +990,9 @@ minimatch@^3.0.4: brace-expansion "^1.1.7" minimist@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" - integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + version "1.2.6" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" + integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== mkdirp@^0.5.1: version "0.5.5" From eb8bc3e864c6f735fa5a005e854f8c37411b6288 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Apr 2022 12:26:24 +0200 Subject: [PATCH 008/333] Build(deps): Bump ansi-regex from 4.1.0 to 4.1.1 (#251) Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 4.1.0 to 4.1.1. - [Release notes](https://github.com/chalk/ansi-regex/releases) - [Commits](https://github.com/chalk/ansi-regex/compare/v4.1.0...v4.1.1) --- updated-dependencies: - dependency-name: ansi-regex dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 7d04472d3..c959f7e94 100644 --- a/yarn.lock +++ b/yarn.lock @@ -188,9 +188,9 @@ ansi-escapes@^4.2.1: type-fest "^0.11.0" ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" - integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== + version "4.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed" + integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g== ansi-regex@^5.0.0: version "5.0.0" From 00a34bcb0dd062ab8dd79ab6d4bb9fae16d7ff26 Mon Sep 17 00:00:00 2001 From: Discourse Translator Bot Date: Tue, 19 Apr 2022 09:44:52 -0400 Subject: [PATCH 009/333] Update translations (#252) --- config/locales/client.tr_TR.yml | 391 ++++++++++++++++++++++++++++++++ config/locales/server.tr_TR.yml | 74 ++++++ 2 files changed, 465 insertions(+) diff --git a/config/locales/client.tr_TR.yml b/config/locales/client.tr_TR.yml index 3e1142a83..4ba257c10 100644 --- a/config/locales/client.tr_TR.yml +++ b/config/locales/client.tr_TR.yml @@ -5,3 +5,394 @@ # https://translate.discourse.org/ tr_TR: + admin_js: + admin: + site_settings: + categories: + discourse_post_event: "Discourse Etkinliği" + discourse_calendar: "Discourse Takvimi" + js: + notifications: + popup: + event_reminder: Etkinlik hatırlatıcısı + discourse_automation: + triggerables: + event_started: + title: Etkinlik Başladı + fields: + topic_id: + label: Konu ID'si + discourse_calendar: + invite_user_notification: "%{username} sizi %{description} etkinliğine katılmaya davet etti" + on_holiday: "Tatilde" + holiday: "Tatil" + add_to_calendar: "Google Takvim'e Ekle" + region: + title: "Bölge" + none: "Hiçbiri" + use_current_region: "Geçerli Bölgeyi Kullan" + names: + ar: "Arjantin" + at: "Avusturya" + au_act: "Avustralya (au_act)" + au_nsw: "Avustralya (au_nsw)" + au_nt: "Avustralya (au_nt)" + au_qld_brisbane: "Avustralya (au_qld_brisbane)" + au_qld_cairns: "Avustralya (au_qld_cairns)" + au_qld: "Avustralya (au_qld)" + au_sa: "Avustralya (au_sa)" + au_tas_north: "Avustralya (au_tas_north)" + au_tas_south: "Avustralya (au_tas_south)" + au_tas: "Avustralya (au_tas)" + au_vic_melbourne: "Avustralya (au_vic_melbourne)" + au_vic: "Avustralya (au_vic)" + au_wa: "Avustralya (au_wa)" + au: "Avustralya" + be_fr: "Belçika (be_fr)" + be_nl: "Belçika (be_nl)" + bg_bg: "Bulgaristan (bg_bg)" + bg_en: "Bulgaristan (bg_bg)" + br: "Brezilya" + ca_ab: "Kanada (ca_ab)" + ca_bc: "Kanada (ca_ab)" + ca_mb: "Kanada (ca_mb)" + ca_nb: "Kanada (ca_nb)" + ca_nl: "Kanada (ca_nl)" + ca_ns: "Kanada (ca_ns)" + ca_nt: "Kanada (ca_nt)" + ca_nu: "Kanada (ca_nu)" + ca_on: "Kanada (ca_on)" + ca_pe: "Kanada (ca_pe)" + ca_qc: "Kanada (ca_qc)" + ca_sk: "Kanada (ca_sk)" + ca_yt: "Kanada (ca_yt)" + ca: "Kanada" + ch_ag: "İsviçre (ch_ag)" + ch_ai: "İsviçre (ch_ai)" + ch_ar: "İsviçre (ch_ar)" + ch_be: "İsviçre (ch_be)" + ch_bl: "İsviçre (ch_bl)" + ch_bs: "İsviçre (ch_bs)" + ch_fr: "İsviçre (ch_fr)" + ch_ge: "İsviçre (ch_ge)" + ch_gl: "İsviçre (ch_gl)" + ch_gr: "İsviçre (ch_gr)" + ch_ju: "İsviçre (ch_ju)" + ch_lu: "İsviçre (ch_lu)" + ch_ne: "İsviçre (ch_ne)" + ch_nw: "İsviçre (ch_nw)" + ch_ow: "İsviçre (ch_ow)" + ch_sg: "İsviçre (ch_sg)" + ch_sh: "İsviçre (ch_sh)" + ch_so: "İsviçre (ch_so)" + ch_sz: "İsviçre (ch_sz)" + ch_tg: "İsviçre (ch_tg)" + ch_ti: "İsviçre (ch_ti)" + ch_ur: "İsviçre (ch_ur)" + ch_vd: "İsviçre (ch_vd)" + ch_vs: "İsviçre (ch_vs)" + ch_zg: "İsviçre (ch_zg)" + ch_zh: "İsviçre (ch_zh)" + ch: "İsviçre" + cl: "Şili" + co: "Kolombiya" + cr: "Kosta Rika" + cz: "Çek Cumhuriyeti" + de_bb: "Almanya (de_bb)" + de_be: "Almanya (de_be)" + de_bw: "Almanya (de_bw)" + de_by_augsburg: "Almanya (de_by_augsburg)" + de_by_cath: "Almanya (de_by_cath)" + de_by: "Almanya (de_by)" + de_hb: "Almanya (de_hb)" + de_he: "Almanya (de_he)" + de_hh: "Almanya (de_hh)" + de_mv: "Almanya (de_mv)" + de_ni: "Almanya (de_ni)" + de_nw: "Almanya (de_nw)" + de_rp: "Almanya (de_rp)" + de_sh: "Almanya (de_sh)" + de_sl: "Almanya (de_sl)" + de_sn_sorbian: "Almanya (de_sn_sorbian)" + de_sn: "Almanya (de_sn)" + de_st: "Almanya (de_st)" + de_th_cath: "Almanya (de_th_cath)" + de_th: "Almanya (de_th)" + de: "Almanya" + dk: "Danimarka" + ee: "Estonya" + el: "Yunanistan" + es_an: "İspanya (es_an)" + es_ar: "İspanya (es_ar)" + es_ce: "İspanya (es_ce)" + es_cl: "İspanya (es_cl)" + es_cm: "İspanya (es_cm)" + es_cn: "İspanya (es_cn)" + es_ct: "İspanya (es_ct)" + es_ex: "İspanya (es_ex)" + es_ga: "İspanya (es_ga)" + es_ib: "İspanya (es_ib)" + es_lo: "İspanya (es_lo)" + es_m: "İspanya (es_m)" + es_mu: "İspanya (es_mu)" + es_na: "İspanya (es_na)" + es_o: "İspanya (es_o)" + es_pv: "İspanya (es_pv)" + es_v: "İspanya (es_v)" + es_vc: "İspanya (es_vc)" + es: "ispanya" + fi: "Finlandiya" + fr_a: "Fransa (fr_a)" + fr_m: "Fransa (fr_m)" + fr: "Fransa" + gb_con: "Birleşik Krallık (gb_con)" + gb_eaw: "Birleşik Krallık (gb_eaw)" + gb_eng: "Birleşik Krallık (gb_eng)" + gb_gsy: "Birleşik Krallık (gb_gsy)" + gb_iom: "Birleşik Krallık (gb_iom)" + gb_jsy: "Birleşik Krallık (gb_jsy)" + gb_nir: "Birleşik Krallık (gb_nir)" + gb_sct: "Birleşik Krallık (gb_sct)" + gb_wls: "Birleşik Krallık (gb_wls)" + gb: "Birleşik Krallık" + ge: "Gürcistan" + gg: "Guernsey" + hk: "Hong Kong" + hr: "Hırvatistan" + hu: "Macaristan" + ie: "İrlanda" + im: "Man Adası" + in: "Hindistan" + is: "İzlanda" + it_bl: "İtalya (it_bl)" + it_fi: "İtalya (it_fi)" + it_ge: "İtalya (it_ge)" + it_pd: "İtalya (it_pd)" + it_rm: "İtalya (it_rm)" + it_ro: "İtalya (it_ro)" + it_to: "İtalya (it_to)" + it_tv: "İtalya (it_tv)" + it_ve: "İtalya (it_ve)" + it_vi: "İtalya (it_vi)" + it_vr: "İtalya (it_vr)" + it: "İtalya" + je: "Jersey" + jp: "Japonya" + kr: "Kore Cumhuriyeti" + li: "Lihtenştayn" + lt: "Litvanya" + lu: "Lüksemburg" + lv: "Letonya" + ma: "Fas" + mt_en: "Malta (mt_en)" + mt_mt: "Malta (mt_mt)" + mx_pue: "Meksika (mx_pue)" + mx: "Meksika" + my: "Malezya" + ng: "Nijerya" + nl: "Hollanda" + "no": "Norveç" + nz_ak: "Yeni Zelanda (nz_ak)" + nz_ca: "Yeni Zelanda (nz_ca)" + nz_ch: "Yeni Zelanda (nz_ch)" + nz_hb: "Yeni Zelanda (nz_hb)" + nz_mb: "Yeni Zelanda (nz_mb)" + nz_ne: "Yeni Zelanda (nz_ne)" + nz_nl: "Yeni Zelanda (nz_nl)" + nz_ot: "Yeni Zelanda (nz_ot)" + nz_sc: "Yeni Zelanda (nz_sc)" + nz_sl: "Yeni Zelanda (nz_sl)" + nz_ta: "Yeni Zelanda (nz_ta)" + nz_we: "Yeni Zelanda (nz_we)" + nz_wl: "Yeni Zelanda (nz_wl)" + nz: "Yeni Zelanda" + pe: "Peru" + ph: "Filipinler" + pl: "Polonya" + pt_li: "Portekiz (pt_li)" + pt_po: "Portekiz (pt_po)" + pt: "Portekiz" + ro: "Romanya" + rs_cyrl: "Sırbistan (rs_cyrl)" + rs_la: "Sırbistan (rs_la)" + ru: "Rusya Federasyonu" + se: "İsveç" + sa: "Suudi Arabistan" + sg: "Singapur" + si: "Slovenya" + sk: "Slovakya" + th: "Tayland" + tn: "Tunus" + tr: "Türkiye" + ua: "Ukrayna" + us_ak: "Amerika Birleşik Devletleri (us_ak)" + us_al: "Amerika Birleşik Devletleri (us_al)" + us_ar: "Amerika Birleşik Devletleri (us_ar)" + us_az: "Amerika Birleşik Devletleri (us_az)" + us_ca: "Amerika Birleşik Devletleri (us_ca)" + us_co: "Amerika Birleşik Devletleri (us_co)" + us_ct: "Amerika Birleşik Devletleri (us_ct)" + us_dc: "Amerika Birleşik Devletleri (us_dc)" + us_de: "Amerika Birleşik Devletleri (us_de)" + us_fl: "Amerika Birleşik Devletleri (us_fl)" + us_ga: "Amerika Birleşik Devletleri (us_ga)" + us_gu: "Amerika Birleşik Devletleri (us_gu)" + us_hi: "Amerika Birleşik Devletleri (us_hi)" + us_ia: "Amerika Birleşik Devletleri (us_ia)" + us_id: "Amerika Birleşik Devletleri (us_id)" + us_il: "Amerika Birleşik Devletleri (us_il)" + us_in: "Amerika Birleşik Devletleri (us_in)" + us_ks: "Amerika Birleşik Devletleri (us_ks)" + us_ky: "Amerika Birleşik Devletleri (us_ky)" + us_la: "Amerika Birleşik Devletleri (us_la)" + us_ma: "Amerika Birleşik Devletleri (us_ma)" + us_md: "Amerika Birleşik Devletleri (us_md)" + us_me: "Amerika Birleşik Devletleri (us_me)" + us_mi: "Amerika Birleşik Devletleri (us_mi)" + us_mn: "Amerika Birleşik Devletleri (us_mn)" + us_mo: "Amerika Birleşik Devletleri (us_mo)" + us_ms: "Amerika Birleşik Devletleri (us_ms)" + us_mt: "Amerika Birleşik Devletleri (us_mt)" + us_nc: "Amerika Birleşik Devletleri (us_nc)" + us_nd: "Amerika Birleşik Devletleri (us_nd)" + us_ne: "Amerika Birleşik Devletleri (us_ne)" + us_nh: "Amerika Birleşik Devletleri (us_nh)" + us_nj: "Amerika Birleşik Devletleri (us_nj)" + us_nm: "Amerika Birleşik Devletleri (us_nm)" + us_nv: "Amerika Birleşik Devletleri (us_nv)" + us_ny: "Amerika Birleşik Devletleri (us_ny)" + us_oh: "Amerika Birleşik Devletleri (us_oh)" + us_ok: "Amerika Birleşik Devletleri (us_ok)" + us_or: "Amerika Birleşik Devletleri (us_or)" + us_pa: "Amerika Birleşik Devletleri (us_pa)" + us_pr: "Amerika Birleşik Devletleri (us_pr)" + us_ri: "Amerika Birleşik Devletleri (us_ri)" + us_sc: "Amerika Birleşik Devletleri (us_sc)" + us_sd: "Amerika Birleşik Devletleri (us_sd)" + us_tn: "Amerika Birleşik Devletleri (us_tn)" + us_tx: "Amerika Birleşik Devletleri (us_tx)" + us_ut: "Amerika Birleşik Devletleri (us_ut)" + us_va: "Amerika Birleşik Devletleri (us_va)" + us_vi: "Amerika Birleşik Devletleri (us_vi)" + us_vt: "Amerika Birleşik Devletleri (us_vt)" + us_wa: "Amerika Birleşik Devletleri (us_wa)" + us_wi: "Amerika Birleşik Devletleri (us_wi)" + us_wv: "Amerika Birleşik Devletleri (us_wv)" + us_wy: "Amerika Birleşik Devletleri (us_wy)" + us: "Amerika Birleşik Devletleri" + ve: "Venezuela" + vi: "Virgin Adaları (ABD)" + za: "Güney Afrika" + group_timezones: + search: "Arama..." + group_availability: "%{group} uygunluğu" + discourse_post_event: + notifications: + invite_user_notification: "%{username} %{description}" + invite_user_predefined_attendance_notification: "%{username} , katılımınızı otomatik olarak belirledi ve sizi %{description} davet etti" + before_event_reminder: "Bir etkinlik başlamak üzere %{description}" + after_event_reminder: "Bir etkinlik sona erdi %{description}" + ongoing_event_reminder: "Bir etkinlik devam ediyor %{description}" + preview: + more_than_one_event: "Birden fazla etkinliğiniz olamaz." + edit_reason: "Etkinlik güncellendi" + topic_title: + starts_at: "Etkinlik başlayacak: %{date}" + ended_at: "Etkinlik sona erdi: %{date}" + ends_in_duration: "%{duration} biter" + models: + invitee: + no_users: "Bu türde kullanıcı yok." + status: + unknown: "İlgilenmiyorum" + going: "Gidiyor" + not_going: "Gitmiyor" + interested: "Ilgilenen" + event: + expired: "Süresi doldu" + status: + standalone: + title: "Bağımsız" + description: "Bağımsız bir olay birleştirilemez." + public: + title: "Herkese Açık" + description: "Herkese açık bir etkinliğe herkes katılabilir." + private: + title: "Özel" + description: "Özel bir etkinliğe yalnızca davet edilen kullanıcılar katılabilir." + event_ui: + show_all: "Hepsini Göster ↓" + participants: + one: "%{count} kullanıcı katıldı." + other: "%{count} kullanıcı katıldı." + invite: "Kullanıcıları bilgilendir" + add_to_calendar: "Takvime ekle" + send_pm_to_creator: "%{username} kullanıcısına PM gönder" + edit_event: "Etkinliği düzenle" + export_event: "Etkinliği dışarı aktar" + created_by: "Oluşturan" + bulk_invite: "Toplu Davet" + close_event: "Etkinliği kapat" + invitees_modal: + title_invited: "LCV'lenen kullanıcıların listesi" + title_participated: "Katılan kullanıcıların listesi" + filter_placeholder: "Kullanıcıları filtrele" + bulk_invite_modal: + confirm: "onayla" + text: "CSV dosyası yükle" + title: "Toplu Davet" + success: "Dosya başarıyla yüklendi, işlem tamamlandığında mesaj yoluyla bilgilendirileceksiniz." + error: "Üzgünüz, dosya CSV biçiminde olmalıdır." + confirmation_message: "Yüklenen dosyadaki herkesi bilgilendirmek üzeresiniz." + description_public: "Herkese açık etkinlikler yalnızca toplu davetler için kullanıcı adlarını kabul eder." + description_private: "Özel etkinlikler yalnızca toplu davetler için grup adlarını kabul eder." + download_sample_csv: "Örnek bir CSV dosyası indirin" + send_bulk_invites: "Davet gönder" + group_selector_placeholder: "Bir grup seçin..." + user_selector_placeholder: "Kullanıcı seçin..." + inline_title: "Satır içi toplu davet" + csv_title: "CSV toplu daveti" + builder_modal: + custom_fields: + label: "Özel Alanlar" + placeholder: "İsteğe bağlı" + description: "İzin verilen özel alanlar site ayarlarında tanımlanır. Özel alanlar, verileri diğer eklentilere iletmek için kullanılır." + create_event_title: "Etkinlik Oluştur" + update_event_title: "Etkinliği Düzenle" + confirm_delete: "Bu etkinliği silmek istediğinizden emin misiniz?" + confirm_close: "Bu etkinliği kapatmak istediğinizden emin misiniz?" + create: "Oluştur" + update: "Kaydet" + attach: "Etkinlik oluştur" + add_reminder: "Hatırlatıcı ekle" + timezone: + label: Saat dilimi + remove_timezone: Saat dilimi yok (UTC) + reminders: + label: "Hatırlatıcılar" + recurrence: + label: "Yineleme" + none: "Yineleme yok" + every_day: "Her gün" + every_month: "Her ay bu hafta içi" + every_weekday: "Hafta içi her gün" + every_week: "Her hafta bugün" + every_two_weeks: "İki haftada bir bugün" + url: + label: "URL" + placeholder: "İsteğe bağlı" + name: + label: "Etkinlik adı" + placeholder: "İsteğe bağlı, varsayılan olarak konu başlığı" + invitees: + label: "Davet edilen gruplar" + status: + label: "Durum" + invite_user_or_group: + title: "Kullanıcıları veya grupları bilgilendir" + invite: "Gönder" + upcoming_events: + title: "Yaklaşan Etkinlikler" + creator: "Yaratıcı" + status: "Durum" + starts_at: "Şu adrese başlar" diff --git a/config/locales/server.tr_TR.yml b/config/locales/server.tr_TR.yml index 3e1142a83..43e7b44a9 100644 --- a/config/locales/server.tr_TR.yml +++ b/config/locales/server.tr_TR.yml @@ -5,3 +5,77 @@ # https://translate.discourse.org/ tr_TR: + reports: + currently_away: + title: Şu anda uzaktaki kullanıcılar + labels: + username: Kullanıcı Adı + discourse_automation: + triggerables: + event_started: + title: Etkinlik Başladı + system_messages: + discourse_post_event_bulk_invite_succeeded: + title: "Etkinlik - Toplu Davet Başarılı Oldu" + subject_template: "Toplu davet başarıyla işlendi" + text_body_template: "Toplu davet dosyanız işlendi, %{processed} davetli oluşturuldu." + discourse_post_event_bulk_invite_failed: + title: "Etkinlik - Toplu Davet Başarısız Oldu" + subject_template: "Toplu davet, hatalarla işlendi" + text_body_template: | + Toplu davet dosyanız işlendi, %{failed} hatayla %{processed} davetli oluşturuldu. + + Günlük: + + ```metin + %{logs} + ``` + site_settings: + calendar_enabled: "discourse-calendar eklentisini etkinleştirin. Bu, bir konunun ilk gönderisine [calendar][/calendar] etiketi için destek ekleyecektir." + discourse_post_event_enabled: "[experimental] Bir gönderiye bir olay eklemeyi etkinleştirir. Not: ayrıca etkinleştirilmesi için \"takvim etkin\" olmalıdır." + displayed_invitees_limit: "Bir etkinlikte görüntülenen davetlilerin sayısını sınırlar." + display_post_event_date_on_topic_title: "Konu başlığından sonra olayın tarihini görüntüler." + discourse_post_event_allowed_on_groups: "Etkinlik oluşturmasına izin verilen gruplar." + discourse_post_event_allowed_custom_fields: "Her olayın özel alanların değerini ayarlamasına izin verir." + discourse_post_event_edit_notifications_time_extension: "Bir etkinliğin bitiminden sonraki süreyi (dakika olarak) uzatır, \"gidiyor\" davetliler orijinal gönderideki düzenlemeden hala haberdar edilir." + holiday_calendar_topic_id: "Personelin tatil / devamsızlık takviminin konu kimliği." + delete_expired_event_posts_after: "Süresi dolmuş etkinlikleri olan gönderiler (n) saat sonra otomatik olarak silinecektir. Silmeyi devre dışı bırakmak için -1'e ayarlayın." + all_day_event_start_time: "Başlangıç zamanı belirtilmeyen etkinlikler bu saatte başlayacaktır. Biçim SS:dd'dir. 06:00 için 06:00 girin" + all_day_event_end_time: "Bitiş saati belirtilmeyen etkinlikler bu saatte sona erecektir. Biçim SS:dd'dir. 18:00 için 18:00 girin" + all_day_event_time_error: "Geçersiz zaman. Biçim SS:dd (ör: 08:00) olmalıdır." + calendar_categories: "Bir kategorinin en üstünde bir takvim görüntüleyin. Zorunlu ayarlar, CategoryId ve postId'dir. ör.: CategoryId=6;postId=453\n Diğer geçerli ayarlar: tzPicker, hafta sonları ve defaultView." + calendar_categories_outlet: "Kategori takvimini hangi çıkışın göstereceğini değiştirmeye izin verir." + working_days: "Çalışma günlerini ayarlayın. Bir gönderide \"zaman dilimleri\" etiketini kullanarak bir grubun uygunluğunu görüntüleyebilirsiniz, örneğin: `[timezones group=admins][timezones]`" + working_day_start_hour: "Çalışma günü saatlerinin başlama saati." + working_day_end_hour: "Çalışma günü saatlerinin bitiş saati." + close_to_working_day_hours_extension: "Saat dilimlerini vurgulamak için çalışma günü saatlerinde uzatma süresini ayarlayın." + discourse_calendar: + invite_user_notification: "%{username} sizi şuraya davet etti: %{description}" + calendar_must_be_in_first_post: "Takvim etiketi, bir konunun yalnızca ilk gönderisinde kullanılabilir." + more_than_one_calendar: "Bir gönderide birden fazla takviminiz olamaz." + more_than_two_dates: "Bir takvim konusunun gönderisi ikiden fazla tarih içeremez." + event_expired: "Etkinliğin süresi doldu" + discourse_post_event: + notifications: + before_event_reminder: "%{title} başlamak üzere." + after_event_reminder: "%{title} sona erdi." + ongoing_event_reminder: "%{title} devam ediyor." + errors: + bulk_invite: + max_invitees: "İlk %{max_invittes} davetli oluşturuldu. Dosyayı daha küçük parçalara bölmeyi deneyin." + error: "Bu dosya yüklenirken bir hata oluştu. Lütfen daha sonra tekrar deneyiniz." + models: + event: + only_one_event: "Bir gönderide yalnızca bir etkinlik olabilir." + only_group: "Bir etkinlik yalnızca grup adlarını kabul eder." + must_be_in_first_post: "Bir etkinlik yalnızca bir konunun ilk gönderisinde olabilir." + raw_invitees_length: "Bir etkinlik %{count} kullanıcı/grupla sınırlıdır." + ends_at_before_starts_at: "Bir etkinlik başlamadan bitemez." + start_must_be_present_and_a_valid_date: "Bir etkinlik için geçerli bir başlangıç tarihi gerekir." + end_must_be_a_valid_date: "Bitiş tarihi geçerli bir tarih olmalıdır." + invalid_recurrence: "Yinelenme şunlardan biri olmalıdır: her_ay, her_hafta, her_iki_hafta, her_gün, her_hafta içi." + acting_user_not_allowed_to_create_event: "Mevcut kullanıcının etkinlik oluşturmasına izin verilmiyor." + acting_user_not_allowed_to_act_on_this_event: "Mevcut kullanıcının bu etkinlik üzerinde işlem yapmasına izin verilmiyor." + custom_field_is_invalid: "`%{field}` özel alanına izin verilmiyor." + name: + length: "Etkinlik adı uzunluğu %{minimum} ile %{maximum} karakter arasında olmalıdır." From 85e73037e69a599c3b39f9e6260a07809f005c2a Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Wed, 20 Apr 2022 15:13:50 +0530 Subject: [PATCH 010/333] UX: do not show scrollbar when there's no scrolling required (#253) --- assets/stylesheets/common/discourse-calendar.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/stylesheets/common/discourse-calendar.scss b/assets/stylesheets/common/discourse-calendar.scss index 268af3954..125cafb65 100644 --- a/assets/stylesheets/common/discourse-calendar.scss +++ b/assets/stylesheets/common/discourse-calendar.scss @@ -34,7 +34,7 @@ overflow: hidden; .fc-scroller { - height: 570px !important; + height: 575px !important; padding-bottom: 5px; } From b900276fb1cf81d6ed2baeb0755d4b6fe540ca85 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Fri, 22 Apr 2022 22:11:54 +0530 Subject: [PATCH 011/333] FEATURE: add events calendar on the category page (#248) * FEATURE: add events calendar on the category page This commit adds a new site setting `events calendar category` for events calendar that is separate and independent from `calendar categories`. If a category is present in both `events calendar category` and `calendar categories` then priority is given to `calendar categories`. * remove some jQuery usage * rename `events_calendar_category` to `events_calendar_categories` * add tests --- .../discourse_post_event/events_controller.rb | 2 +- .../initializers/discourse-calendar.js | 140 ++++++++++++------ .../category-events.hbs | 1 + config/locales/server.en.yml | 1 + config/settings.yml | 4 + spec/requests/events_controller_spec.rb | 15 ++ .../category-events-calendar-test.js | 87 +++++++++++ 7 files changed, 202 insertions(+), 48 deletions(-) create mode 100644 assets/javascripts/templates/connectors/discovery-list-container-top/category-events.hbs create mode 100644 test/javascripts/acceptance/category-events-calendar-test.js diff --git a/app/controllers/discourse_post_event/events_controller.rb b/app/controllers/discourse_post_event/events_controller.rb index cfdce0c6a..3bfd67eab 100644 --- a/app/controllers/discourse_post_event/events_controller.rb +++ b/app/controllers/discourse_post_event/events_controller.rb @@ -101,7 +101,7 @@ def bulk_invite private def filtered_events_params - params.permit(:post_id) + params.permit(:post_id, :category_id) end end end diff --git a/assets/javascripts/initializers/discourse-calendar.js b/assets/javascripts/initializers/discourse-calendar.js index 4cd9a5021..f9bf5b257 100644 --- a/assets/javascripts/initializers/discourse-calendar.js +++ b/assets/javascripts/initializers/discourse-calendar.js @@ -14,6 +14,9 @@ import { stringToColor, } from "discourse/plugins/discourse-calendar/lib/colors"; import { createPopper } from "@popperjs/core"; +import { isNotFullDayEvent } from "discourse/plugins/discourse-calendar/lib/guess-best-date-format"; +import { formatEventName } from "discourse/plugins/discourse-calendar/helpers/format-event-name"; +import getURL from "discourse-common/lib/get-url"; function loadFullCalendar() { return loadScript( @@ -38,63 +41,106 @@ function initializeDiscourseCalendar(api) { } api.onPageChange((url) => { - const $calendarContainer = $(`${selector}.category-calendar`); - if (!$calendarContainer.length) { - return; + const categoryCalendarNode = document.querySelector( + `${selector}.category-calendar` + ); + if (categoryCalendarNode) { + categoryCalendarNode.innerHTML = ""; } - $calendarContainer.hide(); + const categoryEventNode = document.getElementById( + "upcoming-events-calendar" + ); + if (categoryEventNode) { + categoryEventNode.innerHTML = ""; + } const browsedCategory = Category.findBySlugPathWithID(url); - if (browsedCategory) { - const settings = siteSettings.calendar_categories - .split("|") - .filter(Boolean) - .map((stringSetting) => { - const data = {}; - stringSetting - .split(";") - .filter(Boolean) - .forEach((s) => { - const parts = s.split("="); - data[parts[0]] = parts[1]; - }); - return data; + if (!browsedCategory) { + return; + } + + const settings = siteSettings.calendar_categories + .split("|") + .filter(Boolean) + .map((stringSetting) => { + const data = {}; + stringSetting + .split(";") + .filter(Boolean) + .forEach((s) => { + const parts = s.split("="); + data[parts[0]] = parts[1]; + }); + return data; + }); + const categorySetting = settings.findBy( + "categoryId", + browsedCategory.id.toString() + ); + + if (categoryCalendarNode && categorySetting && categorySetting.postId) { + const postId = categorySetting.postId; + categoryCalendarNode.innerHTML = + '
'; + + loadFullCalendar().then(() => { + const options = [`postId=${postId}`]; + + const optionals = ["weekends", "tzPicker", "defaultView"]; + optionals.forEach((optional) => { + if (isPresent(categorySetting[optional])) { + options.push( + `${optional}=${escapeExpression(categorySetting[optional])}` + ); + } }); - const categorySetting = settings.findBy( - "categoryId", - browsedCategory.id.toString() + const rawCalendar = `[calendar ${options.join(" ")}]\n[/calendar]`; + const cookRaw = cookAsync(rawCalendar); + const loadPost = ajax(`/posts/${postId}.json`); + Promise.all([cookRaw, loadPost]).then((results) => { + const cooked = results[0]; + const post = results[1]; + categoryCalendarNode.innerHTML = cooked.string; + render($(".calendar"), post); + }); + }); + } else { + if (!categoryEventNode) { + return; + } + + const eventSettings = siteSettings.events_calendar_categories.split("|"); + const foundCategory = eventSettings.find( + (k) => k === browsedCategory.id.toString() ); - if (categorySetting && categorySetting.postId) { - $calendarContainer.show(); - const postId = categorySetting.postId; - const $spinner = $( - '
' - ); - $calendarContainer.html($spinner); + if (foundCategory) { loadFullCalendar().then(() => { - const options = [`postId=${postId}`]; - - const optionals = ["weekends", "tzPicker", "defaultView"]; - optionals.forEach((optional) => { - if (isPresent(categorySetting[optional])) { - options.push( - `${optional}=${escapeExpression(categorySetting[optional])}` - ); - } - }); + let calendar = new window.FullCalendar.Calendar( + categoryEventNode, + {} + ); + const loadEvents = ajax( + `/discourse-post-event/events.json?category_id=${browsedCategory.id}` + ); + + Promise.all([loadEvents]).then((results) => { + const events = results[0]; + + events[Object.keys(events)[0]].forEach((event) => { + const { starts_at, ends_at, post } = event; + calendar.addEvent({ + title: formatEventName(event), + start: starts_at, + end: ends_at || starts_at, + allDay: !isNotFullDayEvent(moment(starts_at), moment(ends_at)), + url: getURL(`/t/-/${post.topic.id}/${post.post_number}`), + }); + }); - const rawCalendar = `[calendar ${options.join(" ")}]\n[/calendar]`; - const cookRaw = cookAsync(rawCalendar); - const loadPost = ajax(`/posts/${postId}.json`); - Promise.all([cookRaw, loadPost]).then((results) => { - const cooked = results[0]; - const post = results[1]; - const $cooked = $(cooked.string); - $calendarContainer.html($cooked); - render($(".calendar", $cooked), post); + calendar.render(); }); }); } diff --git a/assets/javascripts/templates/connectors/discovery-list-container-top/category-events.hbs b/assets/javascripts/templates/connectors/discovery-list-container-top/category-events.hbs new file mode 100644 index 000000000..7ae9ae1ae --- /dev/null +++ b/assets/javascripts/templates/connectors/discovery-list-container-top/category-events.hbs @@ -0,0 +1 @@ +
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 42d455c45..871d158ed 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -45,6 +45,7 @@ en: working_day_start_hour: "Start time of the working day hours." working_day_end_hour: "End time of the working day hours." close_to_working_day_hours_extension: "Set extension time in working day hours to highlight the timezones." + events_calendar_categories: "Display an events calendar at the top of a category." discourse_calendar: invite_user_notification: "%{username} invited you to: %{description}" calendar_must_be_in_first_post: "Calendar tag can only be used in first post of a topic." diff --git a/config/settings.yml b/config/settings.yml index 9ccecc51b..b51ad18ae 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -72,3 +72,7 @@ discourse_post_event: list_type: simple client: true default: "" + events_calendar_categories: + type: category_list + client: true + default: "" diff --git a/spec/requests/events_controller_spec.rb b/spec/requests/events_controller_spec.rb index f635d17e6..056142102 100644 --- a/spec/requests/events_controller_spec.rb +++ b/spec/requests/events_controller_spec.rb @@ -207,6 +207,21 @@ module DiscoursePostEvent end end end + + context 'when filtering by category' do + it 'can filter the event by category' do + category = Fabricate(:category) + topic = Fabricate(:topic, category: category) + event_2 = Fabricate(:event, post: Fabricate(:post, post_number: 1, topic: topic)) + + get "/discourse-post-event/events.json?category_id=#{category.id}" + + expect(response.status).to eq(200) + events = response.parsed_body["events"] + expect(events.length).to eq(1) + expect(events[0]["id"]).to eq(event_2.id) + end + end end end end diff --git a/test/javascripts/acceptance/category-events-calendar-test.js b/test/javascripts/acceptance/category-events-calendar-test.js new file mode 100644 index 000000000..5aaec0b26 --- /dev/null +++ b/test/javascripts/acceptance/category-events-calendar-test.js @@ -0,0 +1,87 @@ +import { + acceptance, + exists, + query, +} from "discourse/tests/helpers/qunit-helpers"; +import { test } from "qunit"; +import { visit } from "@ember/test-helpers"; + +acceptance("Discourse Calendar - Category Events Calendar", function (needs) { + needs.user(); + needs.settings({ + calendar_enabled: true, + discourse_post_event_enabled: true, + events_calendar_categories: "1", + calendar_categories: "", + }); + + needs.pretender((server, helper) => { + server.get("/discourse-post-event/events.json", () => { + return helper.response({ + events: [ + { + id: 67501, + creator: { + id: 1500588, + username: "foobar", + name: null, + avatar_template: + "/user_avatar/localhost/foobar/{size}/1913_2.png", + assign_icon: "user-plus", + assign_path: "/u/foobar/activity/assigned", + }, + sample_invitees: [], + watching_invitee: null, + starts_at: "2022-04-25T15:14:00.000Z", + ends_at: "2022-04-30T16:14:00.000Z", + timezone: "Asia/Calcutta", + stats: { + going: 0, + interested: 0, + not_going: 0, + invited: 0, + }, + status: "public", + raw_invitees: ["trust_level_0"], + post: { + id: 67501, + post_number: 1, + url: "/t/this-is-an-event/18449/1", + topic: { + id: 18449, + title: "This is an event", + }, + }, + name: "Awesome Event", + can_act_on_discourse_post_event: true, + can_update_attendance: true, + is_expired: false, + is_ongoing: false, + should_display_invitees: false, + url: null, + custom_fields: {}, + is_public: true, + is_private: false, + is_standalone: false, + reminders: [], + recurrence: null, + }, + ], + }); + }); + }); + + test("shows event calendar on category page", async (assert) => { + await visit("/c/bug/1"); + + assert.ok( + exists("#upcoming-events-calendar"), + "Events calendar div exists." + ); + assert.strictEqual( + query(".fc-event-container .fc-content .fc-title").innerText, + "Awesome Event", + "Calendar has event name." + ); + }); +}); From 21234778b08d46a4009ab19d359a45301b5cc732 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Tue, 26 Apr 2022 07:25:49 +0530 Subject: [PATCH 012/333] FIX: do not hide upcoming events calendar when navigating away from page Previously the ID for standard upcoming events calendar and category events calendar was same and on every page change we were hiding the category events calendar. Due to this the upcoming events calendar were getting hidden when navigating away from page but was not reloading on visiting again. This commit changes the ID for category events calendar so that we can have finer control over it. Internal ticket t61598. --- assets/javascripts/initializers/discourse-calendar.js | 2 +- .../discovery-list-container-top/category-events.hbs | 2 +- assets/stylesheets/common/upcoming-events-calendar.scss | 3 ++- test/javascripts/acceptance/category-events-calendar-test.js | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/initializers/discourse-calendar.js b/assets/javascripts/initializers/discourse-calendar.js index f9bf5b257..7d2b946d7 100644 --- a/assets/javascripts/initializers/discourse-calendar.js +++ b/assets/javascripts/initializers/discourse-calendar.js @@ -49,7 +49,7 @@ function initializeDiscourseCalendar(api) { } const categoryEventNode = document.getElementById( - "upcoming-events-calendar" + "category-events-calendar" ); if (categoryEventNode) { categoryEventNode.innerHTML = ""; diff --git a/assets/javascripts/templates/connectors/discovery-list-container-top/category-events.hbs b/assets/javascripts/templates/connectors/discovery-list-container-top/category-events.hbs index 7ae9ae1ae..22d15ccab 100644 --- a/assets/javascripts/templates/connectors/discovery-list-container-top/category-events.hbs +++ b/assets/javascripts/templates/connectors/discovery-list-container-top/category-events.hbs @@ -1 +1 @@ -
+
diff --git a/assets/stylesheets/common/upcoming-events-calendar.scss b/assets/stylesheets/common/upcoming-events-calendar.scss index 0b017fa3d..499727217 100644 --- a/assets/stylesheets/common/upcoming-events-calendar.scss +++ b/assets/stylesheets/common/upcoming-events-calendar.scss @@ -1,4 +1,5 @@ -#upcoming-events-calendar { +#upcoming-events-calendar, +#category-events-calendar { &.fc-unthemed { tbody, thead, diff --git a/test/javascripts/acceptance/category-events-calendar-test.js b/test/javascripts/acceptance/category-events-calendar-test.js index 5aaec0b26..1fc032be7 100644 --- a/test/javascripts/acceptance/category-events-calendar-test.js +++ b/test/javascripts/acceptance/category-events-calendar-test.js @@ -75,7 +75,7 @@ acceptance("Discourse Calendar - Category Events Calendar", function (needs) { await visit("/c/bug/1"); assert.ok( - exists("#upcoming-events-calendar"), + exists("#category-events-calendar"), "Events calendar div exists." ); assert.strictEqual( From cb4f35f952db7888ab72d4ca7503bc0b3b20a6b1 Mon Sep 17 00:00:00 2001 From: Discourse Translator Bot Date: Tue, 26 Apr 2022 09:32:08 -0400 Subject: [PATCH 013/333] Update translations (#257) --- config/locales/server.fa_IR.yml | 2 ++ config/locales/server.he.yml | 1 + config/locales/server.ru.yml | 1 + 3 files changed, 4 insertions(+) diff --git a/config/locales/server.fa_IR.yml b/config/locales/server.fa_IR.yml index a63687d54..1e8bd36c8 100644 --- a/config/locales/server.fa_IR.yml +++ b/config/locales/server.fa_IR.yml @@ -13,3 +13,5 @@ fa_IR: triggerables: event_started: title: رویداد شروع شد + site_settings: + events_calendar_categories: "نمایش رویدادهای تقویم در بالای دسته‌بندی" diff --git a/config/locales/server.he.yml b/config/locales/server.he.yml index 9453f0b53..1f3e69faf 100644 --- a/config/locales/server.he.yml +++ b/config/locales/server.he.yml @@ -40,6 +40,7 @@ he: working_day_start_hour: "שעת תחילת יום העבודה." working_day_end_hour: "שעת סיום יום העבודה." close_to_working_day_hours_extension: "הגדרת זמן הארכה בשעות כדי להדגיש את אזורי הזמן." + events_calendar_categories: "הצגת לוח אירועים בראש קטגוריה." discourse_calendar: invite_user_notification: "קיבלת הזמנה מאת %{username} אל: %{description}" more_than_one_calendar: "לא יכול להיות יותר מלוח שנה אחד בפוסט." diff --git a/config/locales/server.ru.yml b/config/locales/server.ru.yml index e5e3a9849..a22efcc55 100644 --- a/config/locales/server.ru.yml +++ b/config/locales/server.ru.yml @@ -48,6 +48,7 @@ ru: working_day_start_hour: "Время начала рабочего дня." working_day_end_hour: "Время окончания рабочего дня." close_to_working_day_hours_extension: "Продлевать время рабочего дня с учётом часовых поясов." + events_calendar_categories: "Отображать события календаря в верхней части раздела." discourse_calendar: invite_user_notification: "Пользователь %{username} приглашает вас: %{description}" calendar_must_be_in_first_post: "Тег календаря может быть использован только в первом сообщении темы." From 736d299b39d459a1ca8748d9a759a71a626ce31d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 29 Apr 2022 18:01:28 +0200 Subject: [PATCH 014/333] Build(deps): Bump async from 2.6.3 to 2.6.4 (#258) Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4. - [Release notes](https://github.com/caolan/async/releases) - [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md) - [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4) --- updated-dependencies: - dependency-name: async dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index c959f7e94..987f554b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -237,9 +237,9 @@ async-promise-queue@^1.0.5: debug "^2.6.8" async@^2.4.1: - version "2.6.3" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.3.tgz#d72625e2344a3656e3a3ad4fa749fa83299d82ff" - integrity sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg== + version "2.6.4" + resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" + integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== dependencies: lodash "^4.17.14" From e5e1f04f3105ee270c55311e9742ecd602b0e657 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Fri, 29 Apr 2022 15:34:01 -0400 Subject: [PATCH 015/333] UX: Fix timezone picker and multi-person logic (#259) - timezone picker now defaults to user's timezone (and works) - for more than 2 people (instead of 3), show holiday name - remove some jQuery --- .../initializers/discourse-calendar.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/assets/javascripts/initializers/discourse-calendar.js b/assets/javascripts/initializers/discourse-calendar.js index 7d2b946d7..ea0f6d344 100644 --- a/assets/javascripts/initializers/discourse-calendar.js +++ b/assets/javascripts/initializers/discourse-calendar.js @@ -477,14 +477,14 @@ function initializeDiscourseCalendar(api) { const event = _buildEvent(detail); event.classNames = ["grouped-event"]; - if (usernames.length > 3) { + if (usernames.length > 2) { event.title = `(${usernames.length}) ${localEventNames[0]}`; } else if (usernames.length === 1) { event.title = usernames[0]; } else { event.title = isMobileView ? `(${usernames.length}) ${localEventNames[0]}` - : `(${usernames.length}) ` + usernames.slice(0, 3).join(", "); + : `(${usernames.length}) ` + usernames.join(", "); } if (localEventNames.length > 1) { @@ -575,21 +575,24 @@ function initializeDiscourseCalendar(api) { } function _setupTimezonePicker(calendar, timezone) { - let $timezonePicker = $(".discourse-calendar-timezone-picker"); - - if ($timezonePicker.length) { - $timezonePicker.on("change", function (event) { + const tzPicker = document.querySelector( + ".discourse-calendar-timezone-picker" + ); + if (tzPicker) { + tzPicker.addEventListener("change", function (event) { calendar.setOption("timeZone", event.target.value); _insertAddToCalendarLinks(calendar); }); moment.tz.names().forEach((tz) => { - $timezonePicker.append(new Option(tz, timezone)); + tzPicker.appendChild(new Option(tz, tz)); }); - $timezonePicker.val(timezone); + tzPicker.value = timezone; } else { - $(".discourse-calendar-timezone-wrap").text(timezone); + document.querySelector( + ".discourse-calendar-timezone-wrap" + ).innerText = timezone; } } From f39403ae484ac17c202286c781b53b1784cbf14f Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Sun, 1 May 2022 00:00:47 +0300 Subject: [PATCH 016/333] Add upcoming Saudi holidays (Eid Al Fitr) (#260) The 2nd of May to the 4th of May of 2022 is a public holiday in Saudi Arabia as per https://holidayapi.com/countries/sa/2022. --- vendor/holidays/definitions/sa.yaml | 16 ++++++++++++++++ vendor/holidays/lib/generated_definitions/sa.rb | 5 ++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/vendor/holidays/definitions/sa.yaml b/vendor/holidays/definitions/sa.yaml index 1db609f3c..7c223bc15 100644 --- a/vendor/holidays/definitions/sa.yaml +++ b/vendor/holidays/definitions/sa.yaml @@ -2,6 +2,22 @@ --- months: + 5: + - name: Festival of Breaking the Fast + regions: [sa] + mday: 2 + year_ranges: + limited: [2022] + - name: Second Day of the Festival of Breaking the Fast + regions: [sa] + mday: 3 + year_ranges: + limited: [2022] + - name: Third Day of the Festival of Breaking the Fast + regions: [sa] + mday: 4 + year_ranges: + limited: [2022] 7: - name: Day of Arafah regions: [sa] diff --git a/vendor/holidays/lib/generated_definitions/sa.rb b/vendor/holidays/lib/generated_definitions/sa.rb index 400ad21a6..22019761b 100644 --- a/vendor/holidays/lib/generated_definitions/sa.rb +++ b/vendor/holidays/lib/generated_definitions/sa.rb @@ -12,7 +12,10 @@ def self.defined_regions def self.holidays_by_month { - 7 => [{:mday => 19, :year_ranges => { :limited => [2021] },:name => "Day of Arafah", :regions => [:sa]}, + 5 => [{:mday => 2, :year_ranges => { :limited => [2022] },:name => "Festival of Breaking the Fast", :regions => [:sa]}, + {:mday => 3, :year_ranges => { :limited => [2022] },:name => "Second Day of the Festival of Breaking the Fast", :regions => [:sa]}, + {:mday => 4, :year_ranges => { :limited => [2022] },:name => "Third Day of the Festival of Breaking the Fast", :regions => [:sa]}], + 7 => [{:mday => 19, :year_ranges => { :limited => [2021] },:name => "Day of Arafah", :regions => [:sa]}, {:mday => 20, :year_ranges => { :limited => [2021] },:name => "Day 1 of Eid Al Adha", :regions => [:sa]}, {:mday => 21, :year_ranges => { :limited => [2021] },:name => "Day 2 of Eid Al Adha", :regions => [:sa]}, {:mday => 22, :year_ranges => { :limited => [2021] },:name => "Day 3 of Eid Al Adha", :regions => [:sa]}], From 4f0f4a4a6d3df42c54b1ffeecda3e37acd599862 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 2 May 2022 11:24:01 +0200 Subject: [PATCH 017/333] DEV: Temporarily disable test (#261) To be debugged. --- test/javascripts/acceptance/category-events-calendar-test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/javascripts/acceptance/category-events-calendar-test.js b/test/javascripts/acceptance/category-events-calendar-test.js index 1fc032be7..56a9b219c 100644 --- a/test/javascripts/acceptance/category-events-calendar-test.js +++ b/test/javascripts/acceptance/category-events-calendar-test.js @@ -3,7 +3,7 @@ import { exists, query, } from "discourse/tests/helpers/qunit-helpers"; -import { test } from "qunit"; +import { skip } from "qunit"; import { visit } from "@ember/test-helpers"; acceptance("Discourse Calendar - Category Events Calendar", function (needs) { @@ -71,7 +71,8 @@ acceptance("Discourse Calendar - Category Events Calendar", function (needs) { }); }); - test("shows event calendar on category page", async (assert) => { + // TODO: This test just started failing. Needs to be investigated. + skip("shows event calendar on category page", async (assert) => { await visit("/c/bug/1"); assert.ok( From e7c9b073e210470647053507da50c62a0bb7499f Mon Sep 17 00:00:00 2001 From: Discourse Translator Bot Date: Tue, 3 May 2022 09:30:50 -0400 Subject: [PATCH 018/333] Update translations (#262) --- config/locales/server.sv.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/locales/server.sv.yml b/config/locales/server.sv.yml index 77d045a28..8f38774a0 100644 --- a/config/locales/server.sv.yml +++ b/config/locales/server.sv.yml @@ -49,6 +49,7 @@ sv: working_day_start_hour: "Starttid för arbetsdagens timmar." working_day_end_hour: "Sluttid för arbetsdagens timmar." close_to_working_day_hours_extension: "Ställ in förlängningstid i arbetsdagstimmar för att markera tidszonerna." + events_calendar_categories: "Visa en evenemangskalender högst upp i en kategori." discourse_calendar: invite_user_notification: "%{username} har bjudit in dig till: %{description}" calendar_must_be_in_first_post: "Kalendertaggen kan endast användas i första inlägget i ett ämne." @@ -73,7 +74,7 @@ sv: ends_at_before_starts_at: "Ett evenemang kan inte avslutas innan det börjar." start_must_be_present_and_a_valid_date: "Ett evenemang kräver ett giltigt startdatum." end_must_be_a_valid_date: "Slutdatumet måste vara ett giltigt datum." - invalid_recurrence: "Återkommande måste vara en utav: varje månad, varje vecka, varannan vecka, varje dag, varje veckodag." + invalid_recurrence: "Återkommande måste vara en av följande: varje månad, varje vecka, varannan vecka, varje dag, varje veckodag." acting_user_not_allowed_to_create_event: "Nuvarande användare får inte skapa evenemang." acting_user_not_allowed_to_act_on_this_event: "Nuvarande användare får inte agera på detta evenemang." custom_field_is_invalid: "Det anpassade fältet `%{field}` är inte tillåtet." From d371a8e010587208ceb5694b7ffdf5cc8e843916 Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Tue, 3 May 2022 19:34:39 +0530 Subject: [PATCH 019/333] DEV: fix failing test (#263) The test started failing recently because the event in test ended on 30th April. The test will now check for presence of FullCalendar div. --- .../acceptance/category-events-calendar-test.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/test/javascripts/acceptance/category-events-calendar-test.js b/test/javascripts/acceptance/category-events-calendar-test.js index 56a9b219c..735ec9de0 100644 --- a/test/javascripts/acceptance/category-events-calendar-test.js +++ b/test/javascripts/acceptance/category-events-calendar-test.js @@ -1,9 +1,5 @@ -import { - acceptance, - exists, - query, -} from "discourse/tests/helpers/qunit-helpers"; -import { skip } from "qunit"; +import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers"; +import { test } from "qunit"; import { visit } from "@ember/test-helpers"; acceptance("Discourse Calendar - Category Events Calendar", function (needs) { @@ -71,18 +67,13 @@ acceptance("Discourse Calendar - Category Events Calendar", function (needs) { }); }); - // TODO: This test just started failing. Needs to be investigated. - skip("shows event calendar on category page", async (assert) => { + test("shows event calendar on category page", async (assert) => { await visit("/c/bug/1"); assert.ok( exists("#category-events-calendar"), "Events calendar div exists." ); - assert.strictEqual( - query(".fc-event-container .fc-content .fc-title").innerText, - "Awesome Event", - "Calendar has event name." - ); + assert.ok(exists(".fc-view-container"), "FullCalendar is loaded."); }); }); From ae8b9630f620a53ecc466914c1bc7a72c26de963 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 9 May 2022 14:38:17 +0100 Subject: [PATCH 020/333] Update UK bank holiday definitions for Platinum Jubilee (#264) Changes from upstream `holidays` gem --- vendor/holidays/definitions/gb.yaml | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/vendor/holidays/definitions/gb.yaml b/vendor/holidays/definitions/gb.yaml index a8688bb5b..b39a4bf4f 100644 --- a/vendor/holidays/definitions/gb.yaml +++ b/vendor/holidays/definitions/gb.yaml @@ -67,6 +67,25 @@ months: regions: [gb] week: -1 wday: 1 + year_ranges: + until: 2021 + - name: Bank Holiday + regions: [gb] + week: -1 + wday: 1 + year_ranges: + from: 2023 + 6: + - name: Bank Holiday + regions: [gb] + mday: 2 + year_ranges: + limited: [2022] + - name: Platinum Jubilee + regions: [gb] + mday: 3 + year_ranges: + limited: [2022] 7: - name: Tynwald Day regions: [im, gb_iom] @@ -456,3 +475,23 @@ tests: regions: ["je"] expect: name: "Bank Holiday" + - given: + date: '2022-06-02' + regions: ["gb"] + expect: + name: "Bank Holiday" + - given: + date: '2022-05-30' + regions: ["gb"] + expect: + holiday: false + - given: + date: '2022-06-03' + regions: ["gb"] + expect: + name: "Platinum Jubilee" + - given: + date: '2023-05-29' + regions: ["gb"] + expect: + name: "Bank Holiday" From a8abcfe52ae2c5cb8a76dbfcc1b17c771a65a75a Mon Sep 17 00:00:00 2001 From: David Taylor Date: Tue, 10 May 2022 11:42:52 +0100 Subject: [PATCH 021/333] DEV: Generate holiday definitions from yaml (#265) followup to ae8b9630f620a53ecc466914c1bc7a72c26de963 --- vendor/holidays/lib/generated_definitions/MANIFEST | 2 ++ vendor/holidays/lib/generated_definitions/europe.rb | 5 ++++- vendor/holidays/lib/generated_definitions/gb.rb | 5 ++++- vendor/holidays/test/defs/test_defs_europe.rb | 8 ++++++++ vendor/holidays/test/defs/test_defs_gb.rb | 8 ++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/vendor/holidays/lib/generated_definitions/MANIFEST b/vendor/holidays/lib/generated_definitions/MANIFEST index 002f2ae6c..764be74f2 100644 --- a/vendor/holidays/lib/generated_definitions/MANIFEST +++ b/vendor/holidays/lib/generated_definitions/MANIFEST @@ -34,6 +34,7 @@ The following definition files are included in this installation: * generated_definitions/hr * generated_definitions/hu * generated_definitions/ie +* generated_definitions/in * generated_definitions/is * generated_definitions/it * generated_definitions/jp @@ -63,6 +64,7 @@ The following definition files are included in this installation: * generated_definitions/rs_cyrl * generated_definitions/rs_la * generated_definitions/ru +* generated_definitions/sa * generated_definitions/scandinavia * generated_definitions/se * generated_definitions/sg diff --git a/vendor/holidays/lib/generated_definitions/europe.rb b/vendor/holidays/lib/generated_definitions/europe.rb index 2913c024d..eaa2d0164 100644 --- a/vendor/holidays/lib/generated_definitions/europe.rb +++ b/vendor/holidays/lib/generated_definitions/europe.rb @@ -227,7 +227,8 @@ def self.holidays_by_month {:mday => 8, :year_ranges => { :limited => [2020] },:name => "May Day", :regions => [:gb]}, {:wday => 1, :week => 1, :year_ranges => { :from => 2021 },:name => "May Day", :regions => [:gb]}, {:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]}, - {:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]}, + {:wday => 1, :week => -1, :year_ranges => { :until => 2021 },:name => "Bank Holiday", :regions => [:gb]}, + {:wday => 1, :week => -1, :year_ranges => { :from => 2023 },:name => "Bank Holiday", :regions => [:gb]}, {:mday => 1, :name => "Praznik rada", :regions => [:hr]}, {:mday => 30, :year_ranges => { :from => 2020 },:name => "Dan državnosti", :regions => [:hr]}, {:mday => 1, :name => "A munka ünnepe", :regions => [:hu]}, @@ -482,6 +483,8 @@ def self.holidays_by_month {:mday => 9, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Día de la Región de Murcia", :regions => [:es_mu]}, {:mday => 9, :observed => "to_monday_if_sunday(date)", :observed_arguments => [:date], :name => "Día de La Rioja", :regions => [:es_lo]}, {:mday => 24, :name => "San Juan", :regions => [:es_ct, :es_vc]}, + {:mday => 2, :year_ranges => { :limited => [2022] },:name => "Bank Holiday", :regions => [:gb]}, + {:mday => 3, :year_ranges => { :limited => [2022] },:name => "Platinum Jubilee", :regions => [:gb]}, {:mday => 22, :name => "Dan antifašističke borbe", :regions => [:hr]}, {:mday => 25, :year_ranges => { :until => 2019 },:name => "Dan državnosti", :regions => [:hr]}, {:wday => 1, :week => 1, :name => "June Bank Holiday", :regions => [:ie]}, diff --git a/vendor/holidays/lib/generated_definitions/gb.rb b/vendor/holidays/lib/generated_definitions/gb.rb index f54ba8e86..a08494980 100644 --- a/vendor/holidays/lib/generated_definitions/gb.rb +++ b/vendor/holidays/lib/generated_definitions/gb.rb @@ -23,7 +23,10 @@ def self.holidays_by_month {:mday => 8, :year_ranges => { :limited => [2020] },:name => "May Day", :regions => [:gb]}, {:wday => 1, :week => 1, :year_ranges => { :from => 2021 },:name => "May Day", :regions => [:gb]}, {:mday => 9, :name => "Liberation Day", :regions => [:je, :gb_jsy, :gg, :gb_gsy]}, - {:wday => 1, :week => -1, :name => "Bank Holiday", :regions => [:gb]}], + {:wday => 1, :week => -1, :year_ranges => { :until => 2021 },:name => "Bank Holiday", :regions => [:gb]}, + {:wday => 1, :week => -1, :year_ranges => { :from => 2023 },:name => "Bank Holiday", :regions => [:gb]}], + 6 => [{:mday => 2, :year_ranges => { :limited => [2022] },:name => "Bank Holiday", :regions => [:gb]}, + {:mday => 3, :year_ranges => { :limited => [2022] },:name => "Platinum Jubilee", :regions => [:gb]}], 7 => [{:mday => 5, :name => "Tynwald Day", :regions => [:im, :gb_iom]}, {:mday => 12, :observed => "to_monday_if_weekend(date)", :observed_arguments => [:date], :name => "Battle of the Boyne", :regions => [:gb_nir]}], 8 => [{:wday => 1, :week => 1, :name => "Bank Holiday", :regions => [:gb_sct]}, diff --git a/vendor/holidays/test/defs/test_defs_europe.rb b/vendor/holidays/test/defs/test_defs_europe.rb index 50d4b922a..13f4ce9ca 100644 --- a/vendor/holidays/test/defs/test_defs_europe.rb +++ b/vendor/holidays/test/defs/test_defs_europe.rb @@ -577,6 +577,14 @@ def test_europe assert_equal "Bank Holiday", (Holidays.on(Date.civil(2018, 8, 27), [:je])[0] || {})[:name] + assert_equal "Bank Holiday", (Holidays.on(Date.civil(2022, 6, 2), [:gb])[0] || {})[:name] + + assert_nil (Holidays.on(Date.civil(2022, 5, 30), [:gb])[0] || {})[:name] + + assert_equal "Platinum Jubilee", (Holidays.on(Date.civil(2022, 6, 3), [:gb])[0] || {})[:name] + + assert_equal "Bank Holiday", (Holidays.on(Date.civil(2023, 5, 29), [:gb])[0] || {})[:name] + assert_equal "Nova godina", (Holidays.on(Date.civil(2012, 1, 1), [:hr], [:informal])[0] || {})[:name] assert_equal "Bogojavljenje ili Sveta tri kralja", (Holidays.on(Date.civil(2012, 1, 6), [:hr], [:informal])[0] || {})[:name] diff --git a/vendor/holidays/test/defs/test_defs_gb.rb b/vendor/holidays/test/defs/test_defs_gb.rb index a18f4ac22..552cccd6a 100644 --- a/vendor/holidays/test/defs/test_defs_gb.rb +++ b/vendor/holidays/test/defs/test_defs_gb.rb @@ -129,5 +129,13 @@ def test_gb assert_equal "Bank Holiday", (Holidays.on(Date.civil(2018, 8, 27), [:je])[0] || {})[:name] + assert_equal "Bank Holiday", (Holidays.on(Date.civil(2022, 6, 2), [:gb])[0] || {})[:name] + + assert_nil (Holidays.on(Date.civil(2022, 5, 30), [:gb])[0] || {})[:name] + + assert_equal "Platinum Jubilee", (Holidays.on(Date.civil(2022, 6, 3), [:gb])[0] || {})[:name] + + assert_equal "Bank Holiday", (Holidays.on(Date.civil(2023, 5, 29), [:gb])[0] || {})[:name] + end end From 95ccc69fa444e9e371427bcd84248aa38c5ce1c7 Mon Sep 17 00:00:00 2001 From: Discourse Translator Bot Date: Tue, 10 May 2022 15:39:47 -0400 Subject: [PATCH 022/333] Update translations (#266) --- config/locales/client.fa_IR.yml | 15 +++++++++++++++ config/locales/server.he.yml | 2 ++ 2 files changed, 17 insertions(+) diff --git a/config/locales/client.fa_IR.yml b/config/locales/client.fa_IR.yml index 74d9c93cb..d2c608d14 100644 --- a/config/locales/client.fa_IR.yml +++ b/config/locales/client.fa_IR.yml @@ -300,6 +300,8 @@ fa_IR: bulk_invite_modal: confirm: "تایید" builder_modal: + custom_fields: + placeholder: "اختیاری" create_event_title: "ایجاد رویداد" update_event_title: "ویرایش رویداد" create: "ایجاد" @@ -308,9 +310,22 @@ fa_IR: timezone: label: منطقه زمانی remove_timezone: بدون منطقه زمانی (UTC) + recurrence: + every_day: "هر روز" + every_weekday: "هر هفته" + url: + label: "نشانی اینترنتی" + placeholder: "اختیاری" + name: + label: "نام رویداد" + placeholder: "اختیاری، پیش‌فرض عنوان موضوع است" + invitees: + label: "گروه‌های دعوت شده" status: label: "وضعیت" invite_user_or_group: invite: "ارسال" upcoming_events: + title: "رویدادهای آینده" + creator: "ایجاد کننده" status: "وضعیت" diff --git a/config/locales/server.he.yml b/config/locales/server.he.yml index 1f3e69faf..9649471b6 100644 --- a/config/locales/server.he.yml +++ b/config/locales/server.he.yml @@ -43,7 +43,9 @@ he: events_calendar_categories: "הצגת לוח אירועים בראש קטגוריה." discourse_calendar: invite_user_notification: "קיבלת הזמנה מאת %{username} אל: %{description}" + calendar_must_be_in_first_post: "ניתן להשתמש בתגית יומן רק בפוסט הראשון של נושא." more_than_one_calendar: "לא יכול להיות יותר מלוח שנה אחד בפוסט." + more_than_two_dates: "פוסט של נושא יומן לא יכול להכיל יותר משני תאריכים." event_expired: "תוקף האירוע פג" discourse_post_event: notifications: From c2fd73503732efdcf972782eaf3f7e3e3b000791 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Mon, 16 May 2022 16:05:24 +0300 Subject: [PATCH 023/333] FIX: Make region visible to current user too (#267) The 'holidays-region' custom field used to be visible only to staff members, but editable by the current user. This meant that the user could edit the value, but could not see the value after it was set. This caused the input field from their user preferences page to be always blank for regular users. --- plugin.rb | 2 +- spec/serializers/user_serializer_spec.rb | 38 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 spec/serializers/user_serializer_spec.rb diff --git a/plugin.rb b/plugin.rb index cf321347d..d9b7eccb0 100644 --- a/plugin.rb +++ b/plugin.rb @@ -319,7 +319,7 @@ def valid_event ) allow_staff_user_custom_field(DiscourseCalendar::HOLIDAY_CUSTOM_FIELD) - allow_staff_user_custom_field(DiscourseCalendar::REGION_CUSTOM_FIELD) + DiscoursePluginRegistry.serialized_current_user_fields << DiscourseCalendar::REGION_CUSTOM_FIELD register_editable_user_custom_field(DiscourseCalendar::REGION_CUSTOM_FIELD) on(:site_setting_changed) do |name, old_value, new_value| diff --git a/spec/serializers/user_serializer_spec.rb b/spec/serializers/user_serializer_spec.rb new file mode 100644 index 000000000..82de3c982 --- /dev/null +++ b/spec/serializers/user_serializer_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require "rails_helper" + +describe UserSerializer do + fab!(:user) { Fabricate(:user) } + + subject { described_class.new(user, scope: guardian).as_json } + + before do + SiteSetting.calendar_enabled = true + user.upsert_custom_fields(DiscourseCalendar::REGION_CUSTOM_FIELD => "uk") + end + + context "as another user" do + fab!(:guardian) { Fabricate(:user).guardian } + + it "does not return user region" do + expect(subject[:user][:custom_fields]).to be_blank + end + end + + context "as current user" do + fab!(:guardian) { user.guardian } + + it "returns user region" do + expect(subject[:user][:custom_fields]).to eq(DiscourseCalendar::REGION_CUSTOM_FIELD => "uk") + end + end + + context "as staff" do + fab!(:guardian) { Fabricate(:admin).guardian } + + it "returns user region" do + expect(subject[:user][:custom_fields]).to eq(DiscourseCalendar::REGION_CUSTOM_FIELD => "uk") + end + end +end From 0e154a62a079ba1ed6432dce86a32666ff3ae7e3 Mon Sep 17 00:00:00 2001 From: Shaun <103613060+yaki-imo@users.noreply.github.com> Date: Tue, 17 May 2022 08:26:19 -0600 Subject: [PATCH 024/333] DEV: Add API endpoints for holidays (#269) Adds two new endpoints available to admins: * `/admin/discourse-calendar/holiday-regions` - this will return a list of holiday regions (as defined by the Holidays gem) * `/admin/discourse-calendar/holiday-regions/:id/holidays` - this will return all of the holidays for a given region --- .../admin_discourse_calendar_controller.rb | 13 +++ .../admin_holiday_regions_controller.rb | 11 +++ .../admin_holidays_controller.rb | 19 +++++ config/locales/server.en.yml | 1 + plugin.rb | 15 ++++ .../admin_holiday_regions_controller_spec.rb | 80 +++++++++++++++++++ .../admin/admin_holidays_controller_spec.rb | 75 +++++++++++++++++ 7 files changed, 214 insertions(+) create mode 100644 app/controllers/admin/admin_discourse_calendar_controller.rb create mode 100644 app/controllers/admin/discourse_calendar/admin_holiday_regions_controller.rb create mode 100644 app/controllers/admin/discourse_calendar/admin_holidays_controller.rb create mode 100644 spec/requests/admin/admin_holiday_regions_controller_spec.rb create mode 100644 spec/requests/admin/admin_holidays_controller_spec.rb diff --git a/app/controllers/admin/admin_discourse_calendar_controller.rb b/app/controllers/admin/admin_discourse_calendar_controller.rb new file mode 100644 index 000000000..6e87b4942 --- /dev/null +++ b/app/controllers/admin/admin_discourse_calendar_controller.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Admin::DiscourseCalendar + class AdminDiscourseCalendarController < Admin::AdminController + before_action :ensure_calendar_enabled + + def ensure_calendar_enabled + if !SiteSetting.calendar_enabled + raise Discourse::NotFound + end + end + end +end diff --git a/app/controllers/admin/discourse_calendar/admin_holiday_regions_controller.rb b/app/controllers/admin/discourse_calendar/admin_holiday_regions_controller.rb new file mode 100644 index 000000000..98aa33ee4 --- /dev/null +++ b/app/controllers/admin/discourse_calendar/admin_holiday_regions_controller.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +require "holidays" + +module Admin::DiscourseCalendar + class AdminHolidayRegionsController < AdminDiscourseCalendarController + def index + render json: { holiday_regions: Holidays.available_regions } + end + end +end diff --git a/app/controllers/admin/discourse_calendar/admin_holidays_controller.rb b/app/controllers/admin/discourse_calendar/admin_holidays_controller.rb new file mode 100644 index 000000000..f59c85d7a --- /dev/null +++ b/app/controllers/admin/discourse_calendar/admin_holidays_controller.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +require "holidays" + +module Admin::DiscourseCalendar + class AdminHolidaysController < AdminDiscourseCalendarController + def index + region_code = params[:region_code] + + begin + holidays = Holidays.year_holidays([region_code], Time.current.beginning_of_year) + rescue Holidays::InvalidRegion + return render_json_error(I18n.t("system_messages.discourse_calendar_holiday_region_invalid"), 422) + end + + render json: { region_code: region_code, holidays: holidays } + end + end +end diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 871d158ed..6dff344b5 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -10,6 +10,7 @@ en: event_started: title: Event started system_messages: + discourse_calendar_holiday_region_invalid: "The holiday region you provided does not exist." discourse_post_event_bulk_invite_succeeded: title: "Event - Bulk Invite Succeeded" subject_template: "Bulk invite processed successfully" diff --git a/plugin.rb b/plugin.rb index d9b7eccb0..213ba3ff9 100644 --- a/plugin.rb +++ b/plugin.rb @@ -84,6 +84,21 @@ class Engine < ::Rails::Engine end end + # DISCOURSE CALENDAR + + %w[ + ../app/controllers/admin/admin_discourse_calendar_controller.rb + ../app/controllers/admin/discourse_calendar/admin_holiday_regions_controller.rb + ../app/controllers/admin/discourse_calendar/admin_holidays_controller.rb + ].each { |path| load File.expand_path(path, __FILE__) } + + Discourse::Application.routes.append do + mount ::DiscourseCalendar::Engine, at: '/' + + get '/admin/discourse-calendar/holiday-regions' => 'admin/discourse_calendar/admin_holiday_regions#index', constraints: StaffConstraint.new + get '/admin/discourse-calendar/holiday-regions/:region_code/holidays' => 'admin/discourse_calendar/admin_holidays#index', constraints: StaffConstraint.new + end + # DISCOURSE POST EVENT %w[ diff --git a/spec/requests/admin/admin_holiday_regions_controller_spec.rb b/spec/requests/admin/admin_holiday_regions_controller_spec.rb new file mode 100644 index 000000000..1fe44f1b5 --- /dev/null +++ b/spec/requests/admin/admin_holiday_regions_controller_spec.rb @@ -0,0 +1,80 @@ +# frozen_string_literal: true + +require "rails_helper" + +module Admin::DiscourseCalendar + describe AdminHolidayRegionsController do + fab!(:admin) { Fabricate(:user, admin: true) } + fab!(:member) { Fabricate(:user) } + + before do + SiteSetting.calendar_enabled = calendar_enabled + end + + describe "#index" do + context "when the calendar plugin is enabled" do + let(:calendar_enabled) { true } + + it "returns a list of holiday regions for an admin" do + sign_in(admin) + get "/admin/discourse-calendar/holiday-regions.json" + + expect(response.parsed_body["holiday_regions"].count).to eq(262) + expect(response.parsed_body["holiday_regions"]).to eq( + %w( + ar at au au_nsw au_vic au_qld au_nt au_act au_sa au_wa au_tas + au_tas_south au_qld_cairns au_qld_brisbane au_tas_north + au_vic_melbourne be_fr be_nl br br_spcapital br_sp bg_en bg_bg + ca ca_qc ca_ab ca_sk ca_on ca_bc ca_nb ca_mb ca_ns ca_pe ca_nl + ca_nt ca_nu ca_yt us ch_zh ch_be ch_lu ch_ur ch_sz ch_ow ch_nw + ch_gl ch_zg ch_fr ch_so ch_bs ch_bl ch_sh ch_ar ch_ai ch_sg ch_gr + ch_ag ch_tg ch_ti ch_vd ch_ne ch_ge ch_ju ch_vs ch cl co cr cz dk + de de_bw de_by de_he de_nw de_rp de_sl de_sn_sorbian de_th_cath + de_sn de_st de_be de_by_cath de_by_augsburg de_bb de_mv de_th + de_hb de_hh de_ni de_sh ecbtarget ee el es_pv es_na es_an es_ib + es_cm es_mu es_m es_ar es_cl es_cn es_lo es_ga es_ce es_o es_ex es + es_ct es_v es_vc federalreserve federalreservebanks fedex fi fr_a + fr_m fr gb gb_eng gb_wls gb_eaw gb_nir je gb_jsy gg gb_gsy gb_sct + gb_con im gb_iom ge hr hk hu ie in is it it_ve it_tv it_vr it_pd + it_fi it_ge it_to it_rm it_vi it_bl it_ro kr kz li lt lv ma mt_mt + mt_en mx mx_pue nerc nl lu no nyse nz nz_sl nz_we nz_ak nz_nl + nz_ne nz_ot nz_ta nz_sc nz_hb nz_mb nz_ca nz_ch nz_wl pe ph pl pt + pt_li pt_po ro rs_cyrl rs_la ru se sa tn tr ua us_fl us_la us_ct + us_de us_gu us_hi us_in us_ky us_nj us_nc us_nd us_pr us_tn us_ms + us_id us_ar us_tx us_dc us_md us_va us_vt us_ak us_ca us_me us_ma + us_al us_ga us_ne us_mo us_sc us_wv us_vi us_ut us_ri us_az us_co + us_il us_mt us_nm us_ny us_oh us_pa us_mi us_mn us_nv us_or us_sd + us_wa us_wi us_wy us_ia us_ks us_nh us_ok unitednations ups za ve + sk si jp vi sg my th ng + ) + ) + end + + it "returns a 404 for a member" do + sign_in(member) + get "/admin/discourse-calendar/holiday-regions.json" + + expect(response.status).to eq(404) + end + end + + context "when the calendar plugin is not enabled" do + let(:calendar_enabled) { false } + + it "returns a 404 for an admin" do + sign_in(admin) + get "/admin/discourse-calendar/holiday-regions.json" + + expect(response.status).to eq(404) + end + + it "returns a 404 for a member" do + sign_in(member) + get "/admin/discourse-calendar/holiday-regions.json" + + expect(response.status).to eq(404) + end + end + end + end +end diff --git a/spec/requests/admin/admin_holidays_controller_spec.rb b/spec/requests/admin/admin_holidays_controller_spec.rb new file mode 100644 index 000000000..a94435e40 --- /dev/null +++ b/spec/requests/admin/admin_holidays_controller_spec.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +require "rails_helper" + +module Admin::DiscourseCalendar + describe AdminHolidaysController do + fab!(:admin) { Fabricate(:user, admin: true) } + fab!(:member) { Fabricate(:user) } + + before do + SiteSetting.calendar_enabled = calendar_enabled + end + + describe "#index" do + context "when the calendar plugin is enabled" do + let(:calendar_enabled) { true } + + context "when an admin is signed in" do + before do + sign_in(admin) + end + + it "returns a list of holidays for a given region" do + get "/admin/discourse-calendar/holiday-regions/mx/holidays.json" + + expect(response.parsed_body["holidays"]).to eq([ + { "date" => "2022-01-01", "name" => "Año nuevo", "regions" => ["mx"] }, + { "date" => "2022-02-07", "name" => "Día de la Constitución", "regions" => ["mx"] }, + { "date" => "2022-03-21", "name" => "Natalicio de Benito Juárez", "regions" => ["mx"] }, + { "date" => "2022-05-01", "name" => "Día del Trabajo", "regions" => ["mx"] }, + { "date" => "2022-09-15", "name" => "Grito de Dolores", "regions" => ["mx"] }, + { "date" => "2022-09-16", "name" => "Día de la Independencia", "regions" => ["mx"] }, + { "date" => "2022-11-21", "name" => "Día de la Revolución", "regions" => ["mx"] }, + { "date" => "2022-12-25", "name" => "Navidad", "regions" => ["mx"] } + ]) + end + + it "returns a 422 and an error message for an invalid region" do + get "/admin/discourse-calendar/holiday-regions/regionxyz/holidays.json" + + expect(response.status).to eq(422) + expect(response.parsed_body["errors"]).to include( + I18n.t("system_messages.discourse_calendar_holiday_region_invalid") + ) + end + end + + it "returns a 404 for a member" do + sign_in(member) + get "/admin/discourse-calendar/holiday-regions/mx/holidays.json" + + expect(response.status).to eq(404) + end + end + + context "when the calendar plugin is not enabled" do + let(:calendar_enabled) { false } + + it "returns a 404 for an admin" do + sign_in(admin) + get "/admin/discourse-calendar/holiday-regions/mx/holidays.json" + + expect(response.status).to eq(404) + end + + it "returns a 404 for a member" do + sign_in(member) + get "/admin/discourse-calendar/holiday-regions/mx/holidays.json" + + expect(response.status).to eq(404) + end + end + end + end +end From 0c48a4ea1d33acee78f920500be9f7b6a18e521f Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Tue, 17 May 2022 13:04:08 -0400 Subject: [PATCH 025/333] DEV: Fix flakey spec (#271) --- .../requests/admin/admin_holidays_controller_spec.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/spec/requests/admin/admin_holidays_controller_spec.rb b/spec/requests/admin/admin_holidays_controller_spec.rb index a94435e40..51792eac5 100644 --- a/spec/requests/admin/admin_holidays_controller_spec.rb +++ b/spec/requests/admin/admin_holidays_controller_spec.rb @@ -23,16 +23,10 @@ module Admin::DiscourseCalendar it "returns a list of holidays for a given region" do get "/admin/discourse-calendar/holiday-regions/mx/holidays.json" - expect(response.parsed_body["holidays"]).to eq([ + expect(response.parsed_body["holidays"]).to include( { "date" => "2022-01-01", "name" => "Año nuevo", "regions" => ["mx"] }, - { "date" => "2022-02-07", "name" => "Día de la Constitución", "regions" => ["mx"] }, - { "date" => "2022-03-21", "name" => "Natalicio de Benito Juárez", "regions" => ["mx"] }, - { "date" => "2022-05-01", "name" => "Día del Trabajo", "regions" => ["mx"] }, - { "date" => "2022-09-15", "name" => "Grito de Dolores", "regions" => ["mx"] }, - { "date" => "2022-09-16", "name" => "Día de la Independencia", "regions" => ["mx"] }, - { "date" => "2022-11-21", "name" => "Día de la Revolución", "regions" => ["mx"] }, - { "date" => "2022-12-25", "name" => "Navidad", "regions" => ["mx"] } - ]) + { "date" => "2022-09-16", "name" => "Día de la Independencia", "regions" => ["mx"] } + ) end it "returns a 422 and an error message for an invalid region" do From d8e3d31e726f8ee9c2e5791b6078497e20a49b78 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 23 May 2022 12:07:37 +0200 Subject: [PATCH 026/333] FIX: Don't initialize on logged-out login_required (#268) Fixes a js error. The code later tried to access categories when there were non available. --- assets/javascripts/initializers/discourse-calendar.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/javascripts/initializers/discourse-calendar.js b/assets/javascripts/initializers/discourse-calendar.js index ea0f6d344..09123208d 100644 --- a/assets/javascripts/initializers/discourse-calendar.js +++ b/assets/javascripts/initializers/discourse-calendar.js @@ -28,8 +28,13 @@ let eventPopper; const EVENT_POPOVER_ID = "event-popover"; function initializeDiscourseCalendar(api) { - let _topicController; const siteSettings = api.container.lookup("site-settings:main"); + + if (siteSettings.login_required && !api.getCurrentUser()) { + return; + } + + let _topicController; const outletName = siteSettings.calendar_categories_outlet; const site = api.container.lookup("site:main"); From f3700c9ae8c2aa64e00af7d4f38a5b99acbdf915 Mon Sep 17 00:00:00 2001 From: discoursebot Date: Mon, 23 May 2022 10:59:34 -0400 Subject: [PATCH 027/333] DEV: Update CI workflows (#272) Co-authored-by: discoursebuild --- .github/workflows/plugin-linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/plugin-linting.yml b/.github/workflows/plugin-linting.yml index d0e6e6047..61610901b 100644 --- a/.github/workflows/plugin-linting.yml +++ b/.github/workflows/plugin-linting.yml @@ -50,7 +50,7 @@ jobs: - name: Ember template lint if: ${{ always() }} - run: yarn ember-template-lint assets/javascripts + run: yarn ember-template-lint --no-error-on-unmatched-pattern assets/javascripts - name: Rubocop if: ${{ always() }} From e533eddfba22ae7691ada465fe53d2aecab5f7d2 Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Tue, 24 May 2022 13:22:02 +0300 Subject: [PATCH 028/333] Revert "FIX: ensures client is sending UTC to backend (#241)" (#273) This reverts commit 2c827c5a070a910648cb8d2cd9bd5fab55d3144c. We're reverting the commit because the core components for date/time input that this plugin depends still work with the local timezone of the user rather UTC which causes weird problems due to moment.js objects being in different timezones to what the core components and this plugin expect. --- .../discourse-post-event-builder.js | 11 +++--- .../modal/discourse-post-event-builder.hbs | 17 +++++---- .../initializers/add-event-ui-builder.js | 1 - assets/javascripts/lib/raw-event-helper.js | 20 ++++------ .../common/discourse-post-event-builder.scss | 36 ++++++++++++++++-- .../mobile/discourse-post-event-builder.scss | 38 ++----------------- spec/acceptance/post_spec.rb | 7 ---- 7 files changed, 56 insertions(+), 74 deletions(-) diff --git a/assets/javascripts/discourse/controllers/discourse-post-event-builder.js b/assets/javascripts/discourse/controllers/discourse-post-event-builder.js index 67bc2d6b0..43bbe182e 100644 --- a/assets/javascripts/discourse/controllers/discourse-post-event-builder.js +++ b/assets/javascripts/discourse/controllers/discourse-post-event-builder.js @@ -120,16 +120,15 @@ export default Controller.extend(ModalFunctionality, { startsAt: computed("model.eventModel.starts_at", { get() { return this.model.eventModel.starts_at - ? moment.utc(this.model.eventModel.starts_at) - : moment().utcOffset(0, true); + ? moment(this.model.eventModel.starts_at) + : moment(); }, }), endsAt: computed("model.eventModel.ends_at", { get() { return ( - this.model.eventModel.ends_at && - moment.utc(this.model.eventModel.ends_at) + this.model.eventModel.ends_at && moment(this.model.eventModel.ends_at) ); }, }), @@ -141,8 +140,8 @@ export default Controller.extend(ModalFunctionality, { @action onChangeDates(changes) { this.model.eventModel.setProperties({ - starts_at: changes.from?.tz("utc", true), - ends_at: changes.to?.tz("utc", true), + starts_at: changes.from, + ends_at: changes.to, }); }, diff --git a/assets/javascripts/discourse/templates/modal/discourse-post-event-builder.hbs b/assets/javascripts/discourse/templates/modal/discourse-post-event-builder.hbs index 1d729a094..7c5f28269 100644 --- a/assets/javascripts/discourse/templates/modal/discourse-post-event-builder.hbs +++ b/assets/javascripts/discourse/templates/modal/discourse-post-event-builder.hbs @@ -12,14 +12,6 @@ onChange=(action "onChangeDates") }} - {{#event-field class="timezone" label="discourse_post_event.builder_modal.timezone.label"}} - {{timezone-input - value=model.eventModel.timezone - onChange=(action (mut model.eventModel.timezone)) - none="discourse_post_event.builder_modal.timezone.remove_timezone" - }} - {{/event-field}} - {{#event-field class="name" label="discourse_post_event.builder_modal.name.label"}} {{input value=(readonly model.eventModel.name) @@ -36,6 +28,15 @@ }} {{/event-field}} + {{#event-field class="timezone" label="discourse_post_event.builder_modal.timezone.label"}} + {{timezone-input + value=model.eventModel.timezone + onChange=(action (mut model.eventModel.timezone)) + class="input-xxlarge" + none="discourse_post_event.builder_modal.timezone.remove_timezone" + }} + {{/event-field}} + {{#event-field label="discourse_post_event.builder_modal.status.label"}}