diff --git a/assets/javascripts/discourse/components/modal/post-event-bulk-invite.js b/assets/javascripts/discourse/components/modal/post-event-bulk-invite.js
index aeb4a26ae..2b14159c8 100644
--- a/assets/javascripts/discourse/components/modal/post-event-bulk-invite.js
+++ b/assets/javascripts/discourse/components/modal/post-event-bulk-invite.js
@@ -22,27 +22,19 @@ export default class PostEventBulkInvite extends Component {
get bulkInviteStatuses() {
return [
{
- label: I18n.t(
- "discourse_calendar.discourse_post_event.models.invitee.status.unknown"
- ),
+ label: I18n.t("discourse_post_event.models.invitee.status.unknown"),
name: "unknown",
},
{
- label: I18n.t(
- "discourse_calendar.discourse_post_event.models.invitee.status.going"
- ),
+ label: I18n.t("discourse_post_event.models.invitee.status.going"),
name: "going",
},
{
- label: I18n.t(
- "discourse_calendar.discourse_post_event.models.invitee.status.not_going"
- ),
+ label: I18n.t("discourse_post_event.models.invitee.status.not_going"),
name: "not_going",
},
{
- label: I18n.t(
- "discourse_calendar.discourse_post_event.models.invitee.status.interested"
- ),
+ label: I18n.t("discourse_post_event.models.invitee.status.interested"),
name: "interested",
},
];
@@ -105,9 +97,7 @@ export default class PostEventBulkInvite extends Component {
@action
async uploadDone() {
await this.dialog.alert(
- I18n.t(
- "discourse_calendar.discourse_post_event.bulk_invite_modal.success"
- )
+ I18n.t("discourse_post_event.bulk_invite_modal.success")
);
this.args.closeModal();
}
diff --git a/assets/javascripts/discourse/components/modal/post-event-invite-user-or-group.hbs b/assets/javascripts/discourse/components/modal/post-event-invite-user-or-group.hbs
index f96ce6111..6f1ca0402 100644
--- a/assets/javascripts/discourse/components/modal/post-event-invite-user-or-group.hbs
+++ b/assets/javascripts/discourse/components/modal/post-event-invite-user-or-group.hbs
@@ -1,7 +1,5 @@
@@ -24,7 +22,7 @@
diff --git a/assets/javascripts/discourse/components/modal/post-event-invitees/index.gjs b/assets/javascripts/discourse/components/modal/post-event-invitees/index.gjs
index 203c4019c..49dda1725 100644
--- a/assets/javascripts/discourse/components/modal/post-event-invitees/index.gjs
+++ b/assets/javascripts/discourse/components/modal/post-event-invitees/index.gjs
@@ -39,7 +39,7 @@ export default class PostEventInviteesModal extends Component {
get title() {
return I18n.t(
- `discourse_calendar.discourse_post_event.invitees_modal.${
+ `discourse_post_event.invitees_modal.${
this.args.model.title || "title_invited"
}`
);
@@ -103,7 +103,7 @@ export default class PostEventInviteesModal extends Component {
{{on "input" this.onFilterChanged}}
type="text"
placeholder={{i18n
- "discourse_calendar.discourse_post_event.invitees_modal.filter_placeholder"
+ "discourse_post_event.invitees_modal.filter_placeholder"
}}
class="filter"
/>
@@ -121,7 +121,7 @@ export default class PostEventInviteesModal extends Component {
@icon="trash-alt"
@action={{fn this.removeInvitee invitee}}
title={{i18n
- "discourse_calendar.discourse_post_event.invitees_modal.remove_invitee"
+ "discourse_post_event.invitees_modal.remove_invitee"
}}
/>
{{/if}}
@@ -138,7 +138,7 @@ export default class PostEventInviteesModal extends Component {
@icon="plus"
@action={{fn this.addInvitee user}}
title={{i18n
- "discourse_calendar.discourse_post_event.invitees_modal.add_invitee"
+ "discourse_post_event.invitees_modal.add_invitee"
}}
/>
@@ -147,9 +147,7 @@ export default class PostEventInviteesModal extends Component {
{{/if}}
{{else}}
- {{i18n
- "discourse_calendar.discourse_post_event.models.invitee.no_users"
- }}
+ {{i18n "discourse_post_event.models.invitee.no_users"}}
{{/if}}
diff --git a/assets/javascripts/discourse/components/toggle-invitees.hbs b/assets/javascripts/discourse/components/toggle-invitees.hbs
index d71393581..4b54c93b7 100644
--- a/assets/javascripts/discourse/components/toggle-invitees.hbs
+++ b/assets/javascripts/discourse/components/toggle-invitees.hbs
@@ -1,6 +1,6 @@
{{/if}}
diff --git a/assets/javascripts/discourse/initializers/add-event-ui-builder.js b/assets/javascripts/discourse/initializers/add-event-ui-builder.js
index 3a84f9637..deaf65d81 100644
--- a/assets/javascripts/discourse/initializers/add-event-ui-builder.js
+++ b/assets/javascripts/discourse/initializers/add-event-ui-builder.js
@@ -20,7 +20,7 @@ function initializeEventBuilder(api) {
},
group: "insertions",
icon: "calendar-day",
- label: "discourse_calendar.discourse_post_event.builder_modal.attach",
+ label: "discourse_post_event.builder_modal.attach",
condition: (composer) => {
if (!currentUser || !currentUser.can_create_discourse_post_event) {
return false;
diff --git a/assets/javascripts/discourse/initializers/add-upcoming-events-to-sidebar.js b/assets/javascripts/discourse/initializers/add-upcoming-events-to-sidebar.js
index dc4d53f89..37212902a 100644
--- a/assets/javascripts/discourse/initializers/add-upcoming-events-to-sidebar.js
+++ b/assets/javascripts/discourse/initializers/add-upcoming-events-to-sidebar.js
@@ -15,12 +15,8 @@ export default {
return class UpcomingEventsSectionLink extends baseSectionLink {
name = "upcoming-events";
route = "discourse-post-event-upcoming-events";
- text = I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events.title"
- );
- title = I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events.title"
- );
+ text = I18n.t("discourse_post_event.upcoming_events.title");
+ title = I18n.t("discourse_post_event.upcoming_events.title");
};
});
});
diff --git a/assets/javascripts/discourse/initializers/discourse-calendar.js b/assets/javascripts/discourse/initializers/discourse-calendar.js
index 22d81e787..1945c234c 100644
--- a/assets/javascripts/discourse/initializers/discourse-calendar.js
+++ b/assets/javascripts/discourse/initializers/discourse-calendar.js
@@ -285,7 +285,7 @@ function initializeDiscourseCalendar(api) {
get label() {
if (
this.notification.data.message ===
- "discourse_calendar.discourse_post_event.notifications.invite_user_predefined_attendance_notification"
+ "discourse_post_event.notifications.invite_user_predefined_attendance_notification"
) {
return I18n.t(this.notification.data.message, {
username: this.username,
diff --git a/assets/javascripts/discourse/initializers/discourse-post-event-decorator.gjs b/assets/javascripts/discourse/initializers/discourse-post-event-decorator.gjs
index 4c3612ab4..e41971046 100644
--- a/assets/javascripts/discourse/initializers/discourse-post-event-decorator.gjs
+++ b/assets/javascripts/discourse/initializers/discourse-post-event-decorator.gjs
@@ -8,7 +8,7 @@ function _validEventPreview(eventContainer) {
eventContainer.innerHTML = "";
eventContainer.classList.add("discourse-post-event-preview");
- const statusLocaleKey = `discourse_calendar.discourse_post_event.models.event.status.${
+ const statusLocaleKey = `discourse_post_event.models.event.status.${
eventContainer.dataset.status || "public"
}.title`;
if (I18n.lookup(statusLocaleKey, { locale: "en" })) {
@@ -56,7 +56,7 @@ function _invalidEventPreview(eventContainer) {
);
eventContainer.classList.remove("discourse-post-event");
eventContainer.innerText = I18n.t(
- "discourse_calendar.discourse_post_event.preview.more_than_one_event"
+ "discourse_post_event.preview.more_than_one_event"
);
}
diff --git a/assets/javascripts/discourse/lib/event-relative-date.js b/assets/javascripts/discourse/lib/event-relative-date.js
index c07642dbd..18883e64b 100644
--- a/assets/javascripts/discourse/lib/event-relative-date.js
+++ b/assets/javascripts/discourse/lib/event-relative-date.js
@@ -8,12 +8,9 @@ function _computeCurrentEvent(container, endsAt) {
const text = document.createElement("span");
text.classList.add("text");
- text.innerText = I18n.t(
- "discourse_calendar.discourse_post_event.topic_title.ends_in_duration",
- {
- duration: endsAt.from(moment()),
- }
- );
+ text.innerText = I18n.t("discourse_post_event.topic_title.ends_in_duration", {
+ duration: endsAt.from(moment()),
+ });
container.appendChild(text);
}
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index aeb448f3f..5de542ba7 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -307,170 +307,11 @@ en:
week: "Week"
day: "Day"
list: "List"
- discourse_post_event:
- notifications:
- invite_user_predefined_attendance_notification: "%{username} has automatically set your attendance and invited you to"
- before_event_reminder: "An event is about to start"
- after_event_reminder: "An event has ended"
- ongoing_event_reminder: "An event is ongoing"
- # TODO: delete the following keys (until ongoing_event_reminder_html)
- # when event-invitation and event-reminder notification item widgets
- # are removed
- invite_user_notification: "%{username} %{description}"
- invite_user_predefined_attendance_notification_html: "%{username} has automatically set your attendance and invited you to %{description}"
- before_event_reminder_html: "An event is about to start %{description}"
- after_event_reminder_html: "An event has ended %{description}"
- ongoing_event_reminder_html: "An event is ongoing %{description}"
- preview:
- more_than_one_event: "You can’t have more than one event."
- edit_reason: "Event updated"
- topic_title:
- starts_at: "Event will start: %{date}"
- ended_at: "Event ended: %{date}"
- ends_in_duration: "Ends %{duration}"
- models:
- invitee:
- no_users: "No users found"
- status:
- unknown: "Not interested"
- going: "Going"
- not_going: "Not Going"
- interested: "Interested"
- going_count:
- one: "%{count} going"
- other: "%{count} going"
- not_going_count:
- one: "%{count} not going"
- other: "%{count} not going"
- interested_count:
- one: "%{count} interested"
- other: "%{count} interested"
- invited_count:
- one: "%{count} user invited"
- other: "%{count} users invited"
- event:
- expired: "Expired"
- closed: "Closed"
- status:
- standalone:
- title: "Standalone"
- description: "A standalone event can't be joined."
- public:
- title: "Public"
- description: "A public event can be joined by anyone."
- private:
- title: "Private"
- description: "A private event can only be joined by invited users."
- event_ui:
- show_all: "Show all"
- show_participants: "Show participants"
- participants:
- one: "%{count} user participated."
- other: "%{count} users participated."
- invite: "Notify user"
- add_to_calendar: "Add to calendar"
- send_pm_to_creator: "Send PM to %{username}"
- leave: "Leave event"
- edit_event: "Edit event"
- export_event: "Export event"
- created_by: "Created by"
- bulk_invite: "Bulk Invite"
- close_event: "Close event"
- open_event: "Open event"
- invitees_modal:
- title_invited: "Event Participation"
- title_participated: "List of users who participated"
- filter_placeholder: "Filter users"
- remove_invitee: "Remove invitee from list"
- add_invitee: "Add invitee to list"
- bulk_invite_modal:
- confirm: "confirm"
- text: "Upload CSV file"
- title: "Bulk Invite"
- success: "File uploaded successfully, you will be notified via message when the process is complete."
- error: "Sorry, file should be CSV format."
- confirmation_message: "You’re about to notify everyone in the uploaded file."
- description_public: "Public events only accept usernames for bulk invites."
- description_private: "Private events only accept group names for bulk invites."
- download_sample_csv: "Download a sample CSV file"
- send_bulk_invites: "Send invites"
- group_selector_placeholder: "Choose a group..."
- user_selector_placeholder: "Choose user..."
- inline_title: "Inline bulk invite"
- csv_title: "CSV bulk invite"
- builder_modal:
- custom_fields:
- label: "Custom Fields"
- placeholder: "Optional"
- description: "Allowed custom fields are defined in site settings. Custom fields are used to transmit data to other plugins."
- create_event_title: "Create Event"
- update_event_title: "Edit Event"
- confirm_delete: "Are you sure you want to delete this event?"
- confirm_close: "Are you sure you want to close this event?"
- confirm_open: "Are you sure you want to open this event?"
- create: "Create"
- update: "Save"
- attach: "Create event"
- add_reminder: "Add reminder"
- timezone:
- label: Timezone
- remove_timezone: No timezone (UTC)
- reminders:
- label: "Reminders"
- types:
- bump_topic: "auto-bump topic"
- notification: "notify participants"
- units:
- minutes: "minutes"
- hours: "hours"
- days: "days"
- weeks: "weeks"
- periods:
- before: "before"
- after: "after"
- recurrence:
- label: "Recurrence"
- none: "No recurrence"
- every_day: "Every day"
- every_month: "Every month at this weekday"
- every_weekday: "Every weekday"
- every_week: "Every week at this weekday"
- every_two_weeks: "Every two weeks at this weekday"
- every_four_weeks: "Every four weeks at this weekday"
- minimal:
- label: "Minimal event"
- checkbox_label: "Hide Going/Not going buttons and invitees status"
- url:
- label: "URL"
- placeholder: "Optional"
- name:
- label: "Event name"
- placeholder: "Optional, defaults to topic title"
- invitees:
- label: "Invited groups"
- status:
- label: "Status"
- invite_user_or_group:
- title: "Notify user(s) or group(s)"
- invite: "Send"
- upcoming_events:
- title: "Upcoming events"
- creator: "Creator"
- status: "Status"
- starts_at: "Starts at"
- upcoming_events_list:
- title: "Upcoming events"
- empty: "No upcoming events"
- all_day: "All-day"
- error: "Failed to retrieve events"
- try_again: "Try again"
- view_all: "View all"
group_timezones:
search: "Search..."
group_availability: "%{group} availability"
discourse_post_event:
notifications:
- invite_user_predefined_attendance_notification: "%{username} has automatically set your attendance and invited you to"
before_event_reminder: "An event is about to start"
after_event_reminder: "An event has ended"
ongoing_event_reminder: "An event is ongoing"
@@ -482,8 +323,6 @@ en:
before_event_reminder_html: "An event is about to start %{description}"
after_event_reminder_html: "An event has ended %{description}"
ongoing_event_reminder_html: "An event is ongoing %{description}"
- preview:
- more_than_one_event: "You can’t have more than one event."
edit_reason: "Event updated"
edit_reason_closed: "Event closed"
edit_reason_opened: "Event opened"
@@ -491,16 +330,84 @@ en:
starts_at: "Event will start: %{date}"
ended_at: "Event ended: %{date}"
ends_in_duration: "Ends %{duration}"
+ show_all: "Show all"
+ show_participants: "Show participants"
+ participants:
+ one: "%{count} user participated."
+ other: "%{count} users participated."
+ invite: "Notify user"
+ add_to_calendar: "Add to calendar"
+ send_pm_to_creator: "Send PM to %{username}"
+ leave: "Leave event"
+ edit_event: "Edit event"
+ export_event: "Export event"
+ created_by: "Created by"
+ bulk_invite: "Bulk Invite"
+ close_event: "Close event"
+ open_event: "Open event"
+ invitees_modal:
+ title_invited: "Event Participation"
+ title_participated: "List of users who participated"
+ filter_placeholder: "Filter users"
+ remove_invitee: "Remove invitee from list"
+ add_invitee: "Add invitee to list"
+ bulk_invite_modal:
+ confirm: "confirm"
+ text: "Upload CSV file"
+ title: "Bulk Invite"
+ success: "File uploaded successfully, you will be notified via message when the process is complete."
+ error: "Sorry, file should be CSV format."
+ confirmation_message: "You’re about to notify everyone in the uploaded file."
+ description_public: "Public events only accept usernames for bulk invites."
+ description_private: "Private events only accept group names for bulk invites."
+ download_sample_csv: "Download a sample CSV file"
+ send_bulk_invites: "Send invites"
+ group_selector_placeholder: "Choose a group..."
+ user_selector_placeholder: "Choose user..."
+ inline_title: "Inline bulk invite"
+ csv_title: "CSV bulk invite"
+ upcoming_events:
+ title: "Upcoming events"
+ creator: "Creator"
+ status: "Status"
+ starts_at: "Starts at"
+ upcoming_events_list:
+ title: "Upcoming events"
+ empty: "No upcoming events"
+ all_day: "All-day"
+ error: "Failed to retrieve events"
+ try_again: "Try again"
+ view_all: "View all"
+ category:
+ sort_topics_by_event_start_date: "Sort topics by event start date."
+ disable_topic_resorting: "Disable topic resorting."
+ settings_sections:
+ event_sorting: "Event Sorting"
+ preview:
+ more_than_one_event: "You can’t have more than one event."
models:
invitee:
- no_users: "There are no users of this type."
+ no_users: "No users found"
status:
unknown: "Not interested"
going: "Going"
not_going: "Not Going"
interested: "Interested"
+ going_count:
+ one: "%{count} going"
+ other: "%{count} going"
+ not_going_count:
+ one: "%{count} not going"
+ other: "%{count} not going"
+ interested_count:
+ one: "%{count} interested"
+ other: "%{count} interested"
+ invited_count:
+ one: "%{count} user invited"
+ other: "%{count} users invited"
event:
expired: "Expired"
+ closed: "Closed"
status:
standalone:
title: "Standalone"
@@ -511,40 +418,6 @@ en:
private:
title: "Private"
description: "A private event can only be joined by invited users."
- event_ui:
- show_all: "Show all"
- participants:
- one: "%{count} user participated."
- other: "%{count} users participated."
- invite: "Notify user"
- add_to_calendar: "Add to calendar"
- upcoming_events: "Upcoming events"
- send_pm_to_creator: "Send PM to %{username}"
- leave: "Leave event"
- edit_event: "Edit event"
- export_event: "Export event"
- created_by: "Created by"
- bulk_invite: "Bulk Invite"
- close_event: "Close event"
- invitees_modal:
- title_invited: "List of RSVPed users"
- title_participated: "List of users who participated"
- filter_placeholder: "Filter users"
- bulk_invite_modal:
- confirm: "confirm"
- text: "Upload CSV file"
- title: "Bulk Invite"
- success: "File uploaded successfully, you will be notified via message when the process is complete."
- error: "Sorry, file should be CSV format."
- confirmation_message: "You’re about to notify everyone in the uploaded file."
- description_public: "Public events only accept usernames for bulk invites."
- description_private: "Private events only accept group names for bulk invites."
- download_sample_csv: "Download a sample CSV file"
- send_bulk_invites: "Send invites"
- group_selector_placeholder: "Choose a group..."
- user_selector_placeholder: "Choose user..."
- inline_title: "Inline bulk invite"
- csv_title: "CSV bulk invite"
builder_modal:
custom_fields:
label: "Custom Fields"
@@ -554,6 +427,7 @@ en:
update_event_title: "Edit Event"
confirm_delete: "Are you sure you want to delete this event?"
confirm_close: "Are you sure you want to close this event?"
+ confirm_open: "Are you sure you want to open this event?"
create: "Create"
update: "Save"
attach: "Create event"
@@ -599,19 +473,3 @@ en:
invite_user_or_group:
title: "Notify user(s) or group(s)"
invite: "Send"
- upcoming_events:
- title: "Upcoming events"
- creator: "Creator"
- status: "Status"
- starts_at: "Starts at"
- upcoming_events_list:
- title: "Upcoming events"
- empty: "No upcoming events"
- all_day: "All-day"
- error: "Failed to retrieve events"
- try_again: "Try again"
- category:
- sort_topics_by_event_start_date: "Sort topics by event start date."
- disable_topic_resorting: "Disable topic resorting."
- settings_sections:
- event_sorting: "Event Sorting"
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index dee98cd61..2eb9ef0bb 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -66,34 +66,34 @@ en:
event_expired: "Event expired"
holiday_status:
description: "On holiday"
- discourse_post_event:
- notifications:
- before_event_reminder: "%{title} is about to start."
- after_event_reminder: "%{title} has ended."
- ongoing_event_reminder: "%{title} is ongoing."
- errors:
- bulk_invite:
- max_invitees: "First %{max_invittes} invitees have been created. Try splitting the file in smaller parts."
- error: "There was an error uploading that file. Please try again later."
- models:
- event:
- only_one_event: "A post can only have one event."
- must_be_in_first_post: "An event can only be in the first post of a topic."
- raw_invitees_length: "An event is limited to %{count} users/groups."
- raw_invitees:
- only_group: "An event accepts only group names."
- ends_at_before_starts_at: "An event can't end before it starts."
- start_must_be_present_and_a_valid_date: "An event requires a valid start date."
- end_must_be_a_valid_date: "End date must be a valid date."
- invalid_recurrence: "Recurrence must be one of: every_month, every_week, every_two_weeks, every_four_weeks, every_day, every_weekday."
- invalid_timezone: "Timezone not recognized."
- acting_user_not_allowed_to_create_event: "Current user is not allowed to create events."
- acting_user_not_allowed_to_act_on_this_event: "Current user is not allowed to act on this event."
- invalid_allowed_groups: "Invalid allowed groups."
- acting_user_not_allowed_to_invite_these_groups: "Current user is not allowed to invite these groups."
- custom_field_is_invalid: "The custom field `%{field}` is not allowed."
- name:
- length: "Event name length must be between %{minimum} and %{maximum} characters."
+ discourse_post_event:
+ notifications:
+ before_event_reminder: "%{title} is about to start."
+ after_event_reminder: "%{title} has ended."
+ ongoing_event_reminder: "%{title} is ongoing."
+ errors:
+ bulk_invite:
+ max_invitees: "First %{max_invittes} invitees have been created. Try splitting the file in smaller parts."
+ error: "There was an error uploading that file. Please try again later."
+ models:
+ event:
+ only_one_event: "A post can only have one event."
+ must_be_in_first_post: "An event can only be in the first post of a topic."
+ raw_invitees_length: "An event is limited to %{count} users/groups."
+ raw_invitees:
+ only_group: "An event accepts only group names."
+ ends_at_before_starts_at: "An event can't end before it starts."
+ start_must_be_present_and_a_valid_date: "An event requires a valid start date."
+ end_must_be_a_valid_date: "End date must be a valid date."
+ invalid_recurrence: "Recurrence must be one of: every_month, every_week, every_two_weeks, every_four_weeks, every_day, every_weekday."
+ invalid_timezone: "Timezone not recognized."
+ acting_user_not_allowed_to_create_event: "Current user is not allowed to create events."
+ acting_user_not_allowed_to_act_on_this_event: "Current user is not allowed to act on this event."
+ invalid_allowed_groups: "Invalid allowed groups."
+ acting_user_not_allowed_to_invite_these_groups: "Current user is not allowed to invite these groups."
+ custom_field_is_invalid: "The custom field `%{field}` is not allowed."
+ name:
+ length: "Event name length must be between %{minimum} and %{maximum} characters."
discourse_push_notifications:
popup:
event_reminder: "Event Reminder"
diff --git a/jobs/regular/discourse_post_event/send_reminder.rb b/jobs/regular/discourse_post_event/send_reminder.rb
index 51f10d17c..a0774efcc 100644
--- a/jobs/regular/discourse_post_event/send_reminder.rb
+++ b/jobs/regular/discourse_post_event/send_reminder.rb
@@ -66,8 +66,7 @@ def execute(args)
data: {
topic_title: event.name || event.post.topic.title,
display_username: invitee.user.username,
- message:
- "discourse_calendar.discourse_post_event.notifications.#{prefix}_event_reminder",
+ message: "discourse_post_event.notifications.#{prefix}_event_reminder",
}.to_json,
}
@@ -80,7 +79,7 @@ def execute(args)
notification_type: Notification.types[:event_reminder] || Notification.types[:custom],
excerpt:
I18n.t(
- "discourse_calendar.discourse_post_event.notifications.#{prefix}_event_reminder",
+ "discourse_post_event.notifications.#{prefix}_event_reminder",
title: event.name || event.post.topic.title,
locale: invitee.user.effective_locale,
),
diff --git a/lib/discourse_post_event/event_validator.rb b/lib/discourse_post_event/event_validator.rb
index f50f88bf1..233334d45 100644
--- a/lib/discourse_post_event/event_validator.rb
+++ b/lib/discourse_post_event/event_validator.rb
@@ -21,19 +21,14 @@ def validate_event
return false if extracted_events.count == 0
if extracted_events.count > 1
- @post.errors.add(
- :base,
- I18n.t("discourse_calendar.discourse_post_event.errors.models.event.only_one_event"),
- )
+ @post.errors.add(:base, I18n.t("discourse_post_event.errors.models.event.only_one_event"))
return false
end
if !@post.is_first_post?
@post.errors.add(
:base,
- I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.must_be_in_first_post",
- ),
+ I18n.t("discourse_post_event.errors.models.event.must_be_in_first_post"),
)
return false
end
@@ -47,7 +42,7 @@ def validate_event
@post.errors.add(
:base,
I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.acting_user_not_allowed_to_act_on_this_event",
+ "discourse_post_event.errors.models.event.acting_user_not_allowed_to_act_on_this_event",
),
)
return false
@@ -57,7 +52,7 @@ def validate_event
@post.errors.add(
:base,
I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.acting_user_not_allowed_to_create_event",
+ "discourse_post_event.errors.models.event.acting_user_not_allowed_to_create_event",
),
)
return false
@@ -74,9 +69,7 @@ def validate_event
).nil?
@post.errors.add(
:base,
- I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.start_must_be_present_and_a_valid_date",
- ),
+ I18n.t("discourse_post_event.errors.models.event.start_must_be_present_and_a_valid_date"),
)
return false
end
@@ -91,9 +84,7 @@ def validate_event
).nil?
@post.errors.add(
:base,
- I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.end_must_be_a_valid_date",
- ),
+ I18n.t("discourse_post_event.errors.models.event.end_must_be_a_valid_date"),
)
return false
end
@@ -102,9 +93,7 @@ def validate_event
if Time.parse(extracted_event[:start]) > Time.parse(extracted_event[:end])
@post.errors.add(
:base,
- I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.ends_at_before_starts_at",
- ),
+ I18n.t("discourse_post_event.errors.models.event.ends_at_before_starts_at"),
)
return false
end
@@ -115,7 +104,7 @@ def validate_event
@post.errors.add(
:base,
I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.name.length",
+ "discourse_post_event.errors.models.event.name.length",
minimum: Event::MIN_NAME_LENGTH,
maximum: Event::MAX_NAME_LENGTH,
),
@@ -128,9 +117,7 @@ def validate_event
if !VALID_RECURRENCES.include?(extracted_event[:recurrence].to_s)
@post.errors.add(
:base,
- I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.invalid_recurrence",
- ),
+ I18n.t("discourse_post_event.errors.models.event.invalid_recurrence"),
)
end
end
@@ -140,7 +127,7 @@ def validate_event
@post.errors.add(
:base,
I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.invalid_timezone",
+ "discourse_post_event.errors.models.event.invalid_timezone",
timezone: extracted_event[:timezone],
),
)
@@ -169,9 +156,7 @@ def can_invite_groups?(event)
if !group || !guardian.can_see_group?(group)
@post.errors.add(
:base,
- I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.invalid_allowed_groups",
- ),
+ I18n.t("discourse_post_event.errors.models.event.invalid_allowed_groups"),
)
return false
end
@@ -180,7 +165,7 @@ def can_invite_groups?(event)
@post.errors.add(
:base,
I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.acting_user_not_allowed_to_invite_these_groups",
+ "discourse_post_event.errors.models.event.acting_user_not_allowed_to_invite_these_groups",
),
)
return false
diff --git a/spec/integration/post_spec.rb b/spec/integration/post_spec.rb
index 51572c528..640c5b286 100644
--- a/spec/integration/post_spec.rb
+++ b/spec/integration/post_spec.rb
@@ -324,7 +324,7 @@
end.to(
raise_error(ActiveRecord::RecordNotSaved).with_message(
I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.acting_user_not_allowed_to_create_event",
+ "discourse_post_event.errors.models.event.acting_user_not_allowed_to_create_event",
),
),
)
@@ -344,7 +344,7 @@
end.to(
raise_error(ActiveRecord::RecordNotSaved).with_message(
I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.start_must_be_present_and_a_valid_date",
+ "discourse_post_event.errors.models.event.start_must_be_present_and_a_valid_date",
),
),
)
@@ -354,9 +354,7 @@
context "when recurrence is invalid" do
it "raises an error" do
expect { create_post_with_event(user, 'recurrence="foo"') }.to raise_error(
- I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.invalid_recurrence",
- ),
+ I18n.t("discourse_post_event.errors.models.event.invalid_recurrence"),
)
end
end
@@ -382,9 +380,7 @@
)
end.to(
raise_error(ActiveRecord::RecordNotSaved).with_message(
- I18n.t(
- "discourse_calendar.discourse_post_event.errors.models.event.end_must_be_a_valid_date",
- ),
+ I18n.t("discourse_post_event.errors.models.event.end_must_be_a_valid_date"),
),
)
end
@@ -401,7 +397,7 @@
[/event]
TXT
raise_error(ActiveRecord::RecordNotSaved).with_message(
- I18n.t("discourse_calendar.discourse_post_event.errors.models.event.only_one_event"),
+ I18n.t("discourse_post_event.errors.models.event.only_one_event"),
),
)
end
@@ -761,9 +757,7 @@
title: "Beach party",
raw: "[event start='2022-07-24 14:01' timezone='Westeros/Winterfell']\n[/event]",
)
- }.to raise_error(
- I18n.t("discourse_calendar.discourse_post_event.errors.models.event.invalid_timezone"),
- )
+ }.to raise_error(I18n.t("discourse_post_event.errors.models.event.invalid_timezone"))
end
it "handles simple weekly recurrence correctly" do
diff --git a/spec/jobs/regular/discourse_post_event/send_reminder_spec.rb b/spec/jobs/regular/discourse_post_event/send_reminder_spec.rb
index abe3568de..251fbdf6a 100644
--- a/spec/jobs/regular/discourse_post_event/send_reminder_spec.rb
+++ b/spec/jobs/regular/discourse_post_event/send_reminder_spec.rb
@@ -249,8 +249,7 @@ def init_invitees
data: {
topic_title: event_1.name || post_1.topic.title,
display_username: going_user.username,
- message:
- "discourse_calendar.discourse_post_event.notifications.before_event_reminder",
+ message: "discourse_post_event.notifications.before_event_reminder",
}.to_json,
)
@@ -265,8 +264,8 @@ def init_invitees
).pluck("data::json ->> 'message'")
expect(messages).to contain_exactly(
- "discourse_calendar.discourse_post_event.notifications.before_event_reminder",
- "discourse_calendar.discourse_post_event.notifications.ongoing_event_reminder",
+ "discourse_post_event.notifications.before_event_reminder",
+ "discourse_post_event.notifications.ongoing_event_reminder",
)
end
diff --git a/test/javascripts/acceptance/notifications-test.js b/test/javascripts/acceptance/notifications-test.js
index f0d0d2d17..d7a4b5447 100644
--- a/test/javascripts/acceptance/notifications-test.js
+++ b/test/javascripts/acceptance/notifications-test.js
@@ -26,7 +26,7 @@ acceptance("Discourse Calendar - Notifications", function (needs) {
topic_title: "Monthly Hangout #3",
display_username: "fun-haver",
message:
- "discourse_calendar.discourse_post_event.notifications.before_event_reminder",
+ "discourse_post_event.notifications.before_event_reminder",
},
},
{
@@ -44,7 +44,7 @@ acceptance("Discourse Calendar - Notifications", function (needs) {
topic_title: "Fancy title and pants",
display_username: "fancy-pants-wearer",
message:
- "discourse_calendar.discourse_post_event.notifications.ongoing_event_reminder",
+ "discourse_post_event.notifications.ongoing_event_reminder",
},
},
{
@@ -62,7 +62,7 @@ acceptance("Discourse Calendar - Notifications", function (needs) {
topic_title: "Topic with event and after_event reminder",
display_username: "attender-no193",
message:
- "discourse_calendar.discourse_post_event.notifications.after_event_reminder",
+ "discourse_post_event.notifications.after_event_reminder",
},
},
{
@@ -80,7 +80,7 @@ acceptance("Discourse Calendar - Notifications", function (needs) {
topic_title: "Tuesdays are for Among Us",
display_username: "imposter",
message:
- "discourse_calendar.discourse_post_event.notifications.invite_user_notification",
+ "discourse_post_event.notifications.invite_user_notification",
},
},
{
@@ -98,7 +98,7 @@ acceptance("Discourse Calendar - Notifications", function (needs) {
topic_title: "Asia Pacific team call",
display_username: "apacer",
message:
- "discourse_calendar.discourse_post_event.notifications.invite_user_predefined_attendance_notification",
+ "discourse_post_event.notifications.invite_user_predefined_attendance_notification",
},
},
],
@@ -118,7 +118,7 @@ acceptance("Discourse Calendar - Notifications", function (needs) {
assert.strictEqual(
notifications[0].textContent.replaceAll(/\s+/g, " ").trim(),
`${I18n.t(
- "discourse_calendar.discourse_post_event.notifications.before_event_reminder"
+ "discourse_post_event.notifications.before_event_reminder"
)} Monthly Hangout #3`,
"before event reminder notification has the right content"
);
@@ -133,7 +133,7 @@ acceptance("Discourse Calendar - Notifications", function (needs) {
assert.strictEqual(
notifications[1].textContent.replaceAll(/\s+/g, " ").trim(),
`${I18n.t(
- "discourse_calendar.discourse_post_event.notifications.ongoing_event_reminder"
+ "discourse_post_event.notifications.ongoing_event_reminder"
)} Fancy title and pants`,
"ongoing event reminder notification has the right content"
);
@@ -148,7 +148,7 @@ acceptance("Discourse Calendar - Notifications", function (needs) {
assert.strictEqual(
notifications[2].textContent.replaceAll(/\s+/g, " ").trim(),
`${I18n.t(
- "discourse_calendar.discourse_post_event.notifications.after_event_reminder"
+ "discourse_post_event.notifications.after_event_reminder"
)} Topic with event and after_event reminder`,
"after event reminder notification has the right content"
);
@@ -178,7 +178,7 @@ acceptance("Discourse Calendar - Notifications", function (needs) {
assert.strictEqual(
notifications[4].textContent.replaceAll(/\s+/g, " ").trim(),
`${I18n.t(
- "discourse_calendar.discourse_post_event.notifications.invite_user_predefined_attendance_notification",
+ "discourse_post_event.notifications.invite_user_predefined_attendance_notification",
{ username: "apacer" }
)} Asia Pacific team call`,
"event invitation with predefined attendance notification has the right content"
diff --git a/test/javascripts/acceptance/post-event-builder-test.js b/test/javascripts/acceptance/post-event-builder-test.js
index 28f516c42..6299400f8 100644
--- a/test/javascripts/acceptance/post-event-builder-test.js
+++ b/test/javascripts/acceptance/post-event-builder-test.js
@@ -24,7 +24,7 @@ acceptance("Post event - composer", function (needs) {
await click(".toolbar-popup-menu-options .dropdown-select-box-header");
await click(
`.toolbar-popup-menu-options *[data-name='${I18n.t(
- "discourse_calendar.discourse_post_event.builder_modal.attach"
+ "discourse_post_event.builder_modal.attach"
)}']`
);
@@ -94,7 +94,7 @@ acceptance("Post event - composer", function (needs) {
await click(".toolbar-popup-menu-options .dropdown-select-box-header");
await click(
`.toolbar-popup-menu-options *[data-name='${I18n.t(
- "discourse_calendar.discourse_post_event.builder_modal.attach"
+ "discourse_post_event.builder_modal.attach"
)}']`
);
diff --git a/test/javascripts/integration/components/upcoming-events-list-test.gjs b/test/javascripts/integration/components/upcoming-events-list-test.gjs
index 078941e3b..e82546076 100644
--- a/test/javascripts/integration/components/upcoming-events-list-test.gjs
+++ b/test/javascripts/integration/components/upcoming-events-list-test.gjs
@@ -59,9 +59,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
assert.strictEqual(
query(".upcoming-events-list__heading").innerText,
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.title"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.title"),
"it displays the title"
);
@@ -69,9 +67,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
assert.strictEqual(
query(".upcoming-events-list__empty-message").innerText,
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.empty"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.empty"),
"it displays the empty list message"
);
});
@@ -85,9 +81,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
assert.strictEqual(
query(".upcoming-events-list__heading").innerText,
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.title"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.title"),
"it displays the title"
);
@@ -120,9 +114,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
(el) => el.innerText
),
[
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.all_day"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.all_day"),
moment(nextMonth).format(DEFAULT_TIME_FORMAT),
],
"it displays the formatted time"
@@ -153,9 +145,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
assert.strictEqual(
query(".upcoming-events-list__view-all").innerText,
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.view_all"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.view_all"),
"it displays the view-all link"
);
@@ -181,9 +171,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
assert.strictEqual(
query(".upcoming-events-list__heading").innerText,
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.title"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.title"),
"it displays the title"
);
@@ -202,9 +190,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
(el) => el.innerText
),
[
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.all_day"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.all_day"),
moment(nextMonth).format("LLL"),
],
"it displays the formatted time"
@@ -230,9 +216,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
assert
.dom(".upcoming-events-list__heading")
.hasText(
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.title"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.title"),
"it displays the title"
);
@@ -258,9 +242,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
assert.strictEqual(
query(".upcoming-events-list__heading").innerText,
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.title"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.title"),
"it displays the title"
);
@@ -268,17 +250,13 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
assert.strictEqual(
query(".upcoming-events-list__error-message").innerText,
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.error"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.error"),
"it displays the error message"
);
assert.strictEqual(
query(".upcoming-events-list__try-again").innerText,
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.try_again"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.try_again"),
"it displays the try again button"
);
});
@@ -294,9 +272,7 @@ module("Integration | Component | upcoming-events-list", function (hooks) {
assert.strictEqual(
query(".upcoming-events-list__heading").innerText,
- I18n.t(
- "discourse_calendar.discourse_post_event.upcoming_events_list.title"
- ),
+ I18n.t("discourse_post_event.upcoming_events_list.title"),
"it displays the title"
);