FIX: removes clean title codepath (#600)
This codepath was buggy when the title was ending with digits and moreover it's usefulness was debatable given post events support showing the date in the topic list; you shouldn't need to have the date in the title itself.
This commit is contained in:
parent
f268eccaa0
commit
70ef3f8fea
|
|
@ -1,14 +0,0 @@
|
|||
const DATE_SEPARATOR = `[-\/]`;
|
||||
const DATE_TIME_REGEX = new RegExp(
|
||||
`[^|\\s](\\d{1,2}${DATE_SEPARATOR}\\d{1,2}${DATE_SEPARATOR}\\d{2,4}(?:\\s\\d{1,2}:\\d{2})?)$`,
|
||||
"g"
|
||||
);
|
||||
|
||||
export default function cleanTitle(title, startsAt) {
|
||||
if (!title || !startsAt) {
|
||||
return;
|
||||
}
|
||||
|
||||
const match = title.trim().match(DATE_TIME_REGEX);
|
||||
return match && match[0];
|
||||
}
|
||||
|
|
@ -11,7 +11,6 @@ import PostEventBuilder from "../components/modal/post-event-builder";
|
|||
import PostEventBulkInvite from "../components/modal/post-event-bulk-invite";
|
||||
import PostEventInviteUserOrGroup from "../components/modal/post-event-invite-user-or-group";
|
||||
import PostEventInvitees from "../components/modal/post-event-invitees";
|
||||
import cleanTitle from "../lib/clean-title";
|
||||
import { buildParams, replaceRaw } from "../lib/raw-event-helper";
|
||||
|
||||
const DEFAULT_REMINDER = {
|
||||
|
|
@ -257,11 +256,7 @@ export default createWidget("discourse-post-event", {
|
|||
startsAtMonth: moment(eventModel.starts_at).format("MMM"),
|
||||
startsAtDay: moment(eventModel.starts_at).format("D"),
|
||||
eventName: emojiUnescape(
|
||||
escapeExpression(eventModel.name) ||
|
||||
this._cleanTopicTitle(
|
||||
eventModel.post.topic.title,
|
||||
eventModel.starts_at
|
||||
)
|
||||
escapeExpression(eventModel.name) || eventModel.post.topic.title
|
||||
),
|
||||
statusClass: `status ${eventModel.status}`,
|
||||
isPublicEvent: eventModel.status === "public",
|
||||
|
|
@ -357,16 +352,6 @@ export default createWidget("discourse-post-event", {
|
|||
{{/unless}}
|
||||
{{/if}}
|
||||
`,
|
||||
|
||||
_cleanTopicTitle(topicTitle, startsAt) {
|
||||
topicTitle = escapeExpression(topicTitle);
|
||||
const cleaned = cleanTitle(topicTitle, startsAt);
|
||||
if (cleaned) {
|
||||
return topicTitle.replace(cleaned, "");
|
||||
}
|
||||
|
||||
return topicTitle;
|
||||
},
|
||||
});
|
||||
|
||||
function replaceTimezone(val, newTimezone) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue