mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 21:57:36 +08:00
DEV: Export regex for parsing topic URL (#12740)
This commit is contained in:
parent
35f977f8a5
commit
74e84a1953
|
@ -10,7 +10,7 @@ import offsetCalculator from "discourse/lib/offset-calculator";
|
|||
import { setOwner } from "@ember/application";
|
||||
|
||||
const rewrites = [];
|
||||
const TOPIC_REGEXP = /\/t\/([^\/]+)\/(\d+)\/?(\d+)?/;
|
||||
export const TOPIC_URL_REGEXP = /\/t\/([^\/]+)\/(\d+)\/?(\d+)?/;
|
||||
|
||||
// We can add links here that have server side responses but not client side.
|
||||
const SERVER_SIDE_ONLY = [
|
||||
|
@ -348,11 +348,11 @@ const DiscourseURL = EmberObject.extend({
|
|||
same topic, use replaceState and instruct our controller to load more posts.
|
||||
**/
|
||||
navigatedToPost(oldPath, path, routeOpts) {
|
||||
const newMatches = TOPIC_REGEXP.exec(path);
|
||||
const newMatches = TOPIC_URL_REGEXP.exec(path);
|
||||
const newTopicId = newMatches ? newMatches[2] : null;
|
||||
|
||||
if (newTopicId) {
|
||||
const oldMatches = TOPIC_REGEXP.exec(oldPath);
|
||||
const oldMatches = TOPIC_URL_REGEXP.exec(oldPath);
|
||||
const oldTopicId = oldMatches ? oldMatches[2] : null;
|
||||
|
||||
// If the topic_id is the same
|
||||
|
|
Loading…
Reference in New Issue
Block a user