Merge branch 'fix-event-deletion' into 'master'

fix pattern validation in event deletion

See merge request framasoft/mobilizon!422
This commit is contained in:
Thomas Citharel 2020-04-22 09:06:11 +02:00
commit e4f506d0a5

View file

@ -77,6 +77,9 @@ export default class EventMixin extends mixins(Vue) {
} }
protected async openDeleteEventModal(event: IEvent, currentActor: IPerson) { protected async openDeleteEventModal(event: IEvent, currentActor: IPerson) {
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
}
const participantsLength = event.participantStats.participant; const participantsLength = event.participantStats.participant;
const prefix = participantsLength const prefix = participantsLength
? this.$tc('There are {participants} participants.', event.participantStats.participant, { ? this.$tc('There are {participants} participants.', event.participantStats.participant, {
@ -97,7 +100,7 @@ export default class EventMixin extends mixins(Vue) {
) as string, ) as string,
inputAttrs: { inputAttrs: {
placeholder: event.title, placeholder: event.title,
pattern: event.title, pattern: escapeRegExp(event.title),
}, },
onConfirm: () => this.deleteEvent(event, currentActor), onConfirm: () => this.deleteEvent(event, currentActor),
}); });