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

FEATURE: Allow topic URL without post number for post_id param #275

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

martin-brennan
Copy link
Contributor

This commit allows base topic URLs (e.g. https://meta.discourse.org/t/hide-text-in-text-select-popup-menu-feedback/287656)
to be used by the post_id parameter type. We just assume in this case
that the post_id for the param is 1.

@@ -67,6 +67,46 @@ def self.type_aliases
@type_aliases ||= { integer: :int, text: :string, timestamp: :datetime }
end

def self.create_from_sql(sql, opts = {})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just moved around so the class + instance methods are grouped properly

@@ -173,9 +205,13 @@ def invalid_format(string, msg = nil)
invalid_format string, "The user named #{string} was not found"
end
elsif type == :post_id
if string =~ %r{(\d+)/(\d+)(\?u=.*)?$}
if string =~ %r{/t/[^/]+/(\d+)(\?u=.*)?$}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main change is here

@martin-brennan martin-brennan force-pushed the feature/allow-topic-url-in-post-id-param branch from 0126826 to 96d79db Compare January 12, 2024 03:20
This commit allows base topic URLs (e.g. https://meta.discourse.org/t/hide-text-in-text-select-popup-menu-feedback/287656)
to be used by the post_id parameter type. We just assume in this case
that the post_id for the param is 1.
@martin-brennan martin-brennan force-pushed the feature/allow-topic-url-in-post-id-param branch from 96d79db to fa7dfda Compare January 12, 2024 03:22
@martin-brennan
Copy link
Contributor Author

Thanks @tgxworld !

@martin-brennan martin-brennan merged commit 48a4038 into main Jan 16, 2024
5 checks passed
@martin-brennan martin-brennan deleted the feature/allow-topic-url-in-post-id-param branch January 16, 2024 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants