Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript migration, phase 3 #155

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cypress/e2e/event.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ describe("Events", () => {
cy.get("#postComment").click();
cy.get(".comment").should("contain.text", "Test Author");
cy.get(".comment").should("contain.text", "Test Comment");
// Wait until URL contains the edit token because the page is reloaded
// after posting a comment
cy.url().should("include", this.editToken);
cy.get(".openReplyBox").click();
cy.get(".replyContainer").should("be.visible");
cy.get("#replyAuthor").type("Test Reply Author");
cy.get("#replyContent").type("Test Reply");
cy.get("#postReply").click();
cy.get(".repliesContainer").should("contain.text", "Test Reply Author");
cy.get(".repliesContainer").should("contain.text", "Test Reply");
});

it("displays the ActivityPub featured post", function () {
Expand Down
35 changes: 30 additions & 5 deletions public/js/modules/event-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ $(document).ready(function () {
}
});

$('#editModal').on('shown.bs.modal', function (e) {
console.log('hii');
$("#editModal").on("shown.bs.modal", function (e) {
const ta = document.querySelector("#editModal textarea");
ta.style.display = 'none';
ta.style.display = "none";
autosize(ta);
ta.style.display = '';
ta.style.display = "";
// Call the update method to recalculate the size:
autosize.update(ta);
});
Expand All @@ -49,6 +48,7 @@ function editEventForm() {
},
errors: [],
submitting: false,
deletingImage: false,
init() {
// Set up Select2
this.select2 = $(this.$refs.timezone).select2();
Expand All @@ -66,7 +66,10 @@ function editEventForm() {
this.data.publicCheckbox = window.eventData.showOnPublicList;
},
updateEventEnd() {
if (this.data.eventEnd === "" || this.data.eventEnd < this.data.eventStart) {
if (
this.data.eventEnd === "" ||
this.data.eventEnd < this.data.eventStart
) {
this.data.eventEnd = this.data.eventStart;
}
},
Expand Down Expand Up @@ -109,5 +112,27 @@ function editEventForm() {
this.submitting = false;
}
},
async deleteImage() {
this.deletingImage = true;
const response = await fetch(
`/event/${window.eventData.id}/image/${window.eventData.editToken}`,
{
method: "DELETE",
},
);
if (!response.ok) {
alert("An error occurred while deleting the image.");
this.deletingImage = false;
return;
}
document.querySelector(
"#event-image-preview",
).style.backgroundImage = "";
document.querySelector("#eventImageContainer").remove();
document.querySelector(
"#genericEventImageContainer",
).style.display = "block";
this.deletingImage = false;
},
};
}
1 change: 1 addition & 0 deletions src/lib/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type EmailTemplate =
| "createEventGroup"
| "createEventMagicLink"
| "deleteEvent"
| "deleteGroup"
| "editEvent"
| "eventGroupUpdated"
| "subscribed"
Expand Down
Loading
Loading