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

Permalink URLs for posts and private posts #301

Merged
merged 1 commit into from May 19, 2016
Merged

Permalink URLs for posts and private posts #301

merged 1 commit into from May 19, 2016

Conversation

glebm
Copy link
Collaborator

@glebm glebm commented May 16, 2016

Currently we send emails with the URL to the page of the topic where the
post is at. However, when posts are deleted the page may change.

This introduces permalinks for posts and private posts that always
redirect to the correct page.

@glebm glebm added the bug label May 16, 2016
@glebm glebm added this to the v0.4.0 milestone May 16, 2016
@@ -2,7 +2,8 @@
Thredded::Engine.routes.draw do
resource :theme_preview, only: [:show], path: 'theme-preview' if %w(development test).include? Rails.env

page_constraint = { page: /[1-9]\d*/ }
positive_int = /[1-9]\d*/
page_constraint = { page: positive_int }
Copy link
Member

Choose a reason for hiding this comment

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

love this

@@ -6,7 +6,8 @@ class Messageboard < ActiveRecord::Base
use: [:slugged, :reserved],
# Avoid route conflicts
reserved_words: ::Thredded::FriendlyIdReservedWordsAndPagination.new(
%w(messageboards preferences private-topics autocomplete-users theme-preview admin)
%w(messageboards preferences private-topics private-posts posts autocomplete-users
theme-preview admin)
Copy link
Member

Choose a reason for hiding this comment

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

This array has gotten big enough where it's a little bit of mental overhead to parse it on a quick look. Could you break these out into their own lines? It'd make diffs cleaner too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call, done.

@jayroh
Copy link
Member

jayroh commented May 17, 2016

Looks great @glebm - just a couple comments in there.

Currently we send emails with the URL to the page of the topic where the
post is at. However, when posts are deleted, the page may change.

This introduces permalinks for posts and private posts that always
redirect to the correct page.
@glebm glebm merged commit 9f3e77f into master May 19, 2016
@glebm glebm deleted the permalinks branch May 21, 2016 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants