threddedDANIEL 0.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +744 -0
- data/app/assets/images/favicons/README.md +3 -0
- data/app/assets/images/favicons/amazon.png +0 -0
- data/app/assets/images/favicons/github.png +0 -0
- data/app/assets/images/favicons/google_branding/logo_calendar_128px.png +0 -0
- data/app/assets/images/favicons/google_branding/logo_docs_48px.png +0 -0
- data/app/assets/images/favicons/google_branding/logo_drive_48px.png +0 -0
- data/app/assets/images/favicons/google_branding/logo_forms_48px.png +0 -0
- data/app/assets/images/favicons/google_branding/logo_sheets_48px.png +0 -0
- data/app/assets/images/favicons/google_branding/logo_slides_48px.png +0 -0
- data/app/assets/images/favicons/stackexchange.png +0 -0
- data/app/assets/images/favicons/twitter.png +0 -0
- data/app/assets/images/favicons/wikipedia.png +0 -0
- data/app/assets/images/thredded/breadcrumb-chevron.svg +1 -0
- data/app/assets/images/thredded/follow.svg +1 -0
- data/app/assets/images/thredded/lock.svg +1 -0
- data/app/assets/images/thredded/moderation.svg +1 -0
- data/app/assets/images/thredded/private-messages.svg +1 -0
- data/app/assets/images/thredded/settings.svg +1 -0
- data/app/assets/images/thredded/three-dot-menu.svg +3 -0
- data/app/assets/images/thredded/unfollow.svg +1 -0
- data/app/assets/javascripts/thredded.es6 +2 -0
- data/app/assets/javascripts/thredded/components/currently_online.es6 +32 -0
- data/app/assets/javascripts/thredded/components/flash_messages.es6 +9 -0
- data/app/assets/javascripts/thredded/components/mention_autocompletion.es6 +40 -0
- data/app/assets/javascripts/thredded/components/post_form.es6 +37 -0
- data/app/assets/javascripts/thredded/components/preview_area.es6 +56 -0
- data/app/assets/javascripts/thredded/components/quote_post.es6 +49 -0
- data/app/assets/javascripts/thredded/components/time_stamps.es6 +25 -0
- data/app/assets/javascripts/thredded/components/topic_form.es6 +94 -0
- data/app/assets/javascripts/thredded/components/topics.es6 +46 -0
- data/app/assets/javascripts/thredded/components/turboforms.es6 +25 -0
- data/app/assets/javascripts/thredded/components/user_preferences_form.es6 +66 -0
- data/app/assets/javascripts/thredded/components/user_textcomplete.es6 +50 -0
- data/app/assets/javascripts/thredded/components/users_select.es6 +122 -0
- data/app/assets/javascripts/thredded/core/csrf_tokens.es6 +9 -0
- data/app/assets/javascripts/thredded/core/debounce.es6 +32 -0
- data/app/assets/javascripts/thredded/core/escape_html.es6 +7 -0
- data/app/assets/javascripts/thredded/core/hide_soft_keyboard.es6 +7 -0
- data/app/assets/javascripts/thredded/core/on_page_load.es6 +54 -0
- data/app/assets/javascripts/thredded/core/serialize_form.es6 +9 -0
- data/app/assets/javascripts/thredded/core/thredded.es6 +1 -0
- data/app/assets/javascripts/thredded/dependencies.js +8 -0
- data/app/assets/javascripts/thredded/dependencies/autosize.js +1 -0
- data/app/assets/javascripts/thredded/dependencies/textcomplete.js +1 -0
- data/app/assets/javascripts/thredded/dependencies/timeago.js +1 -0
- data/app/assets/javascripts/thredded/dependencies/ujs.js +1 -0
- data/app/assets/javascripts/thredded/thredded.es6 +2 -0
- data/app/assets/stylesheets/thredded.scss +3 -0
- data/app/assets/stylesheets/thredded/_base.scss +13 -0
- data/app/assets/stylesheets/thredded/_dependencies.scss +0 -0
- data/app/assets/stylesheets/thredded/_email.scss +51 -0
- data/app/assets/stylesheets/thredded/_thredded.scss +33 -0
- data/app/assets/stylesheets/thredded/base/_alerts.scss +44 -0
- data/app/assets/stylesheets/thredded/base/_buttons.scss +73 -0
- data/app/assets/stylesheets/thredded/base/_dropdown-menu.scss +83 -0
- data/app/assets/stylesheets/thredded/base/_forms.scss +84 -0
- data/app/assets/stylesheets/thredded/base/_grid.scss +58 -0
- data/app/assets/stylesheets/thredded/base/_lists.scss +31 -0
- data/app/assets/stylesheets/thredded/base/_nav.scss +67 -0
- data/app/assets/stylesheets/thredded/base/_tables.scss +17 -0
- data/app/assets/stylesheets/thredded/base/_typography.scss +72 -0
- data/app/assets/stylesheets/thredded/base/_variables.scss +141 -0
- data/app/assets/stylesheets/thredded/components/_alerts.scss +19 -0
- data/app/assets/stylesheets/thredded/components/_base.scss +25 -0
- data/app/assets/stylesheets/thredded/components/_currently-online.scss +54 -0
- data/app/assets/stylesheets/thredded/components/_empty.scss +11 -0
- data/app/assets/stylesheets/thredded/components/_flash-message.scss +19 -0
- data/app/assets/stylesheets/thredded/components/_following.scss +14 -0
- data/app/assets/stylesheets/thredded/components/_form-list.scss +39 -0
- data/app/assets/stylesheets/thredded/components/_icons.scss +3 -0
- data/app/assets/stylesheets/thredded/components/_main-section.scss +9 -0
- data/app/assets/stylesheets/thredded/components/_mention-autocomplete.scss +57 -0
- data/app/assets/stylesheets/thredded/components/_messageboard.scss +155 -0
- data/app/assets/stylesheets/thredded/components/_onebox.scss +275 -0
- data/app/assets/stylesheets/thredded/components/_pagination.scss +35 -0
- data/app/assets/stylesheets/thredded/components/_post-form.scss +27 -0
- data/app/assets/stylesheets/thredded/components/_post.scss +138 -0
- data/app/assets/stylesheets/thredded/components/_preferences.scss +19 -0
- data/app/assets/stylesheets/thredded/components/_preview_area.scss +11 -0
- data/app/assets/stylesheets/thredded/components/_topic-delete.scss +8 -0
- data/app/assets/stylesheets/thredded/components/_topic-header.scss +111 -0
- data/app/assets/stylesheets/thredded/components/_topics.scss +186 -0
- data/app/assets/stylesheets/thredded/layout/_main-container.scss +16 -0
- data/app/assets/stylesheets/thredded/layout/_main-navigation.scss +79 -0
- data/app/assets/stylesheets/thredded/layout/_moderation.scss +97 -0
- data/app/assets/stylesheets/thredded/layout/_navigation.scss +87 -0
- data/app/assets/stylesheets/thredded/layout/_search-navigation.scss +126 -0
- data/app/assets/stylesheets/thredded/layout/_user-navigation.scss +20 -0
- data/app/assets/stylesheets/thredded/layout/_user.scss +10 -0
- data/app/assets/stylesheets/thredded/utilities/_is-compact.scss +26 -0
- data/app/assets/stylesheets/thredded/utilities/_is-expanded.scss +16 -0
- data/app/commands/thredded/at_notification_extractor.rb +23 -0
- data/app/commands/thredded/autofollow_users.rb +62 -0
- data/app/commands/thredded/create_messageboard.rb +42 -0
- data/app/commands/thredded/mark_all_read.rb +22 -0
- data/app/commands/thredded/moderate_post.rb +48 -0
- data/app/commands/thredded/notify_following_users.rb +78 -0
- data/app/commands/thredded/notify_private_topic_users.rb +34 -0
- data/app/controllers/concerns/thredded/new_post_params.rb +21 -0
- data/app/controllers/concerns/thredded/new_private_post_params.rb +21 -0
- data/app/controllers/concerns/thredded/new_private_topic_params.rb +25 -0
- data/app/controllers/concerns/thredded/new_topic_params.rb +19 -0
- data/app/controllers/concerns/thredded/render_preview.rb +16 -0
- data/app/controllers/thredded/application_controller.rb +145 -0
- data/app/controllers/thredded/autocomplete_users_controller.rb +52 -0
- data/app/controllers/thredded/messageboard_groups_controller.rb +31 -0
- data/app/controllers/thredded/messageboards_controller.rb +53 -0
- data/app/controllers/thredded/moderation_controller.rb +103 -0
- data/app/controllers/thredded/post_permalinks_controller.rb +11 -0
- data/app/controllers/thredded/post_previews_controller.rb +29 -0
- data/app/controllers/thredded/posts_controller.rb +97 -0
- data/app/controllers/thredded/preferences_controller.rb +42 -0
- data/app/controllers/thredded/private_post_permalinks_controller.rb +12 -0
- data/app/controllers/thredded/private_post_previews_controller.rb +29 -0
- data/app/controllers/thredded/private_posts_controller.rb +96 -0
- data/app/controllers/thredded/private_topic_previews_controller.rb +15 -0
- data/app/controllers/thredded/private_topics_controller.rb +102 -0
- data/app/controllers/thredded/read_states_controller.rb +13 -0
- data/app/controllers/thredded/theme_previews_controller.rb +34 -0
- data/app/controllers/thredded/topic_previews_controller.rb +15 -0
- data/app/controllers/thredded/topics_controller.rb +205 -0
- data/app/forms/thredded/edit_topic_form.rb +51 -0
- data/app/forms/thredded/post_form.rb +54 -0
- data/app/forms/thredded/private_post_form.rb +50 -0
- data/app/forms/thredded/private_topic_form.rb +160 -0
- data/app/forms/thredded/topic_form.rb +95 -0
- data/app/forms/thredded/user_preferences_form.rb +110 -0
- data/app/helpers/thredded/application_helper.rb +129 -0
- data/app/helpers/thredded/nav_helper.rb +42 -0
- data/app/helpers/thredded/render_helper.rb +15 -0
- data/app/helpers/thredded/urls_helper.rb +134 -0
- data/app/jobs/thredded/activity_updater_job.rb +21 -0
- data/app/jobs/thredded/auto_follow_and_notify_job.rb +14 -0
- data/app/jobs/thredded/notify_private_topic_users_job.rb +12 -0
- data/app/mailer_previews/thredded/base_mailer_preview.rb +118 -0
- data/app/mailer_previews/thredded/post_mailer_preview.rb +13 -0
- data/app/mailer_previews/thredded/private_topic_mailer_preview.rb +13 -0
- data/app/mailers/thredded/base_mailer.rb +18 -0
- data/app/mailers/thredded/post_mailer.rb +21 -0
- data/app/mailers/thredded/private_topic_mailer.rb +21 -0
- data/app/models/concerns/thredded/content_moderation_state.rb +67 -0
- data/app/models/concerns/thredded/friendly_id_reserved_words_and_pagination.rb +17 -0
- data/app/models/concerns/thredded/moderation_state.rb +14 -0
- data/app/models/concerns/thredded/notifier_preference.rb +19 -0
- data/app/models/concerns/thredded/post_common.rb +76 -0
- data/app/models/concerns/thredded/search_parser.rb +41 -0
- data/app/models/concerns/thredded/topic_common.rb +94 -0
- data/app/models/concerns/thredded/topics_search.rb +67 -0
- data/app/models/concerns/thredded/user_topic_read_state_common.rb +42 -0
- data/app/models/thredded/category.rb +18 -0
- data/app/models/thredded/messageboard.rb +120 -0
- data/app/models/thredded/messageboard_group.rb +19 -0
- data/app/models/thredded/messageboard_notifications_for_followed_topics.rb +30 -0
- data/app/models/thredded/messageboard_user.rb +14 -0
- data/app/models/thredded/notifications_for_followed_topics.rb +25 -0
- data/app/models/thredded/notifications_for_private_topics.rb +22 -0
- data/app/models/thredded/null_user.rb +51 -0
- data/app/models/thredded/null_user_topic_read_state.rb +17 -0
- data/app/models/thredded/post.rb +77 -0
- data/app/models/thredded/post_moderation_record.rb +56 -0
- data/app/models/thredded/private_post.rb +63 -0
- data/app/models/thredded/private_topic.rb +89 -0
- data/app/models/thredded/private_user.rb +8 -0
- data/app/models/thredded/stats.rb +25 -0
- data/app/models/thredded/topic.rb +179 -0
- data/app/models/thredded/topic_category.rb +8 -0
- data/app/models/thredded/user_detail.rb +27 -0
- data/app/models/thredded/user_extender.rb +75 -0
- data/app/models/thredded/user_messageboard_preference.rb +45 -0
- data/app/models/thredded/user_permissions/admin/if_admin_column_true.rb +14 -0
- data/app/models/thredded/user_permissions/admin/none.rb +14 -0
- data/app/models/thredded/user_permissions/message/readers_of_writeable_boards.rb +15 -0
- data/app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb +16 -0
- data/app/models/thredded/user_permissions/moderate/none.rb +16 -0
- data/app/models/thredded/user_permissions/read/all.rb +27 -0
- data/app/models/thredded/user_permissions/write/all.rb +16 -0
- data/app/models/thredded/user_permissions/write/none.rb +16 -0
- data/app/models/thredded/user_post_notification.rb +29 -0
- data/app/models/thredded/user_preference.rb +26 -0
- data/app/models/thredded/user_private_topic_read_state.rb +13 -0
- data/app/models/thredded/user_topic_follow.rb +34 -0
- data/app/models/thredded/user_topic_read_state.rb +13 -0
- data/app/notifiers/thredded/email_notifier.rb +25 -0
- data/app/policies/thredded/messageboard_group_policy.rb +16 -0
- data/app/policies/thredded/messageboard_policy.rb +49 -0
- data/app/policies/thredded/post_policy.rb +64 -0
- data/app/policies/thredded/private_post_policy.rb +38 -0
- data/app/policies/thredded/private_topic_policy.rb +24 -0
- data/app/policies/thredded/topic_policy.rb +49 -0
- data/app/view_hooks/thredded/all_view_hooks.rb +125 -0
- data/app/view_models/thredded/base_topic_view.rb +43 -0
- data/app/view_models/thredded/messageboard_group_view.rb +27 -0
- data/app/view_models/thredded/post_view.rb +89 -0
- data/app/view_models/thredded/posts_page_view.rb +27 -0
- data/app/view_models/thredded/private_topic_view.rb +20 -0
- data/app/view_models/thredded/private_topics_page_view.rb +31 -0
- data/app/view_models/thredded/topic_email_view.rb +18 -0
- data/app/view_models/thredded/topic_posts_page_view.rb +17 -0
- data/app/view_models/thredded/topic_view.rb +68 -0
- data/app/view_models/thredded/topics_page_view.rb +38 -0
- data/app/views/layouts/thredded/application.html.erb +18 -0
- data/app/views/thredded/categories/_category.html.erb +1 -0
- data/app/views/thredded/error_pages/forbidden.html.erb +6 -0
- data/app/views/thredded/error_pages/not_found.html.erb +6 -0
- data/app/views/thredded/kaminari/_first_page.html.erb +11 -0
- data/app/views/thredded/kaminari/_gap.html.erb +8 -0
- data/app/views/thredded/kaminari/_last_page.html.erb +11 -0
- data/app/views/thredded/kaminari/_next_page.html.erb +11 -0
- data/app/views/thredded/kaminari/_page.html.erb +12 -0
- data/app/views/thredded/kaminari/_paginator.html.erb +23 -0
- data/app/views/thredded/kaminari/_prev_page.html.erb +11 -0
- data/app/views/thredded/messageboard_groups/new.html.erb +28 -0
- data/app/views/thredded/messageboards/_form.html.erb +30 -0
- data/app/views/thredded/messageboards/_messageboard.html.erb +20 -0
- data/app/views/thredded/messageboards/_messageboard_meta.html.erb +13 -0
- data/app/views/thredded/messageboards/edit.html.erb +15 -0
- data/app/views/thredded/messageboards/index.html.erb +34 -0
- data/app/views/thredded/messageboards/new.html.erb +15 -0
- data/app/views/thredded/moderation/_nav.html.erb +19 -0
- data/app/views/thredded/moderation/_post.html.erb +19 -0
- data/app/views/thredded/moderation/_post_moderation_actions.html.erb +12 -0
- data/app/views/thredded/moderation/_post_moderation_record.html.erb +46 -0
- data/app/views/thredded/moderation/_user_moderation_state.html.erb +3 -0
- data/app/views/thredded/moderation/_user_post.html.erb +12 -0
- data/app/views/thredded/moderation/_users_search_form.html.erb +13 -0
- data/app/views/thredded/moderation/activity.html.erb +20 -0
- data/app/views/thredded/moderation/history.html.erb +13 -0
- data/app/views/thredded/moderation/pending.html.erb +24 -0
- data/app/views/thredded/moderation/user.html.erb +54 -0
- data/app/views/thredded/moderation/users.html.erb +41 -0
- data/app/views/thredded/post_mailer/post_notification.html.erb +26 -0
- data/app/views/thredded/post_mailer/post_notification.text.erb +14 -0
- data/app/views/thredded/post_previews/preview.html.erb +1 -0
- data/app/views/thredded/post_previews/update.html.erb +1 -0
- data/app/views/thredded/posts/_content.html.erb +1 -0
- data/app/views/thredded/posts/_form.html.erb +5 -0
- data/app/views/thredded/posts/_post.html.erb +13 -0
- data/app/views/thredded/posts/_user.html.erb +3 -0
- data/app/views/thredded/posts/edit.html.erb +16 -0
- data/app/views/thredded/posts/new.html.erb +15 -0
- data/app/views/thredded/posts_common/_actions.html.erb +28 -0
- data/app/views/thredded/posts_common/_content.html.erb +3 -0
- data/app/views/thredded/posts_common/_form.html.erb +22 -0
- data/app/views/thredded/posts_common/_header.html.erb +8 -0
- data/app/views/thredded/posts_common/_header_with_topic.html.erb +15 -0
- data/app/views/thredded/posts_common/_header_with_user_and_topic.html.erb +18 -0
- data/app/views/thredded/posts_common/actions/_delete.html.erb +4 -0
- data/app/views/thredded/posts_common/actions/_edit.html.erb +3 -0
- data/app/views/thredded/posts_common/actions/_mark_as_unread.html.erb +2 -0
- data/app/views/thredded/posts_common/actions/_quote.html.erb +4 -0
- data/app/views/thredded/posts_common/form/_after_content.html.erb +8 -0
- data/app/views/thredded/posts_common/form/_before_content.html.erb +8 -0
- data/app/views/thredded/posts_common/form/_content.html.erb +7 -0
- data/app/views/thredded/posts_common/form/_content_field.html.erb +8 -0
- data/app/views/thredded/posts_common/form/_preview_area.html.erb +16 -0
- data/app/views/thredded/preferences/_form.html.erb +95 -0
- data/app/views/thredded/preferences/_messageboards_nav.html.erb +8 -0
- data/app/views/thredded/preferences/_messageboards_nav_item.html.erb +2 -0
- data/app/views/thredded/preferences/edit.html.erb +20 -0
- data/app/views/thredded/private_post_previews/preview.html.erb +1 -0
- data/app/views/thredded/private_post_previews/update.html.erb +1 -0
- data/app/views/thredded/private_posts/_content.html.erb +1 -0
- data/app/views/thredded/private_posts/_form.html.erb +6 -0
- data/app/views/thredded/private_posts/_private_post.html.erb +6 -0
- data/app/views/thredded/private_posts/edit.html.erb +16 -0
- data/app/views/thredded/private_posts/new.html.erb +11 -0
- data/app/views/thredded/private_topic_mailer/message_notification.html.erb +26 -0
- data/app/views/thredded/private_topic_mailer/message_notification.text.erb +15 -0
- data/app/views/thredded/private_topic_previews/preview.html.erb +1 -0
- data/app/views/thredded/private_topics/_breadcrumbs.html.erb +4 -0
- data/app/views/thredded/private_topics/_form.html.erb +39 -0
- data/app/views/thredded/private_topics/_header.html.erb +17 -0
- data/app/views/thredded/private_topics/_no_private_topics.html.erb +6 -0
- data/app/views/thredded/private_topics/_private_topic.html.erb +23 -0
- data/app/views/thredded/private_topics/edit.html.erb +35 -0
- data/app/views/thredded/private_topics/header/_participant.html.erb +1 -0
- data/app/views/thredded/private_topics/index.html.erb +32 -0
- data/app/views/thredded/private_topics/new.html.erb +11 -0
- data/app/views/thredded/private_topics/private_topic/_participant.html.erb +1 -0
- data/app/views/thredded/private_topics/show.html.erb +28 -0
- data/app/views/thredded/search/_form.html.erb +13 -0
- data/app/views/thredded/shared/_breadcrumbs.html.erb +6 -0
- data/app/views/thredded/shared/_content_moderation_blocked_state.html.erb +8 -0
- data/app/views/thredded/shared/_currently_online.html.erb +6 -0
- data/app/views/thredded/shared/_flash_messages.html.erb +7 -0
- data/app/views/thredded/shared/_header.html.erb +3 -0
- data/app/views/thredded/shared/_nav.html.erb +19 -0
- data/app/views/thredded/shared/_page.html.erb +15 -0
- data/app/views/thredded/shared/currently_online/_header.html.erb +5 -0
- data/app/views/thredded/shared/currently_online/_user_list.html.erb +3 -0
- data/app/views/thredded/shared/currently_online/_user_list_item.html.erb +6 -0
- data/app/views/thredded/shared/nav/_moderation.html.erb +14 -0
- data/app/views/thredded/shared/nav/_notification_preferences.html.erb +8 -0
- data/app/views/thredded/shared/nav/_private_topics.html.erb +12 -0
- data/app/views/thredded/shared/nav/_standalone.html.erb +12 -0
- data/app/views/thredded/shared/nav/_standalone_profile.html.erb +3 -0
- data/app/views/thredded/shared/preview.html.erb +10 -0
- data/app/views/thredded/theme_previews/_section_title.html.erb +3 -0
- data/app/views/thredded/theme_previews/show.html.erb +99 -0
- data/app/views/thredded/topic_previews/preview.html.erb +1 -0
- data/app/views/thredded/topics/_followers.html.erb +12 -0
- data/app/views/thredded/topics/_form.html.erb +32 -0
- data/app/views/thredded/topics/_header.html.erb +32 -0
- data/app/views/thredded/topics/_sticky_topics_divider.html.erb +1 -0
- data/app/views/thredded/topics/_topic.html.erb +47 -0
- data/app/views/thredded/topics/_topic_form_admin_options.html.erb +12 -0
- data/app/views/thredded/topics/edit.html.erb +50 -0
- data/app/views/thredded/topics/index.html.erb +35 -0
- data/app/views/thredded/topics/new.html.erb +12 -0
- data/app/views/thredded/topics/search.html.erb +39 -0
- data/app/views/thredded/topics/show.html.erb +46 -0
- data/app/views/thredded/users/_link.html.erb +14 -0
- data/app/views/thredded/users/_post.html.erb +6 -0
- data/app/views/thredded/users/_posts.html.erb +7 -0
- data/bin/rails +6 -0
- data/config/i18n-tasks.yml +16 -0
- data/config/locales/de.yml +257 -0
- data/config/locales/en.yml +253 -0
- data/config/locales/es.yml +257 -0
- data/config/locales/fr.yml +255 -0
- data/config/locales/it.yml +257 -0
- data/config/locales/pl.yml +257 -0
- data/config/locales/pt-BR.yml +258 -0
- data/config/locales/ru.yml +255 -0
- data/config/locales/zh-CN.yml +246 -0
- data/config/routes.rb +87 -0
- data/db/migrate/20160329231848_create_thredded.rb +257 -0
- data/db/seeds.rb +4 -0
- data/db/upgrade_migrations/20160611094616_upgrade_v0_5_to_v0_6.rb +28 -0
- data/db/upgrade_migrations/20160723012349_upgrade_v0_6_to_v0_7.rb +46 -0
- data/db/upgrade_migrations/20161019150201_upgrade_v0_7_to_v0_8.rb +34 -0
- data/db/upgrade_migrations/20161113161801_upgrade_v0_8_to_v0_9.rb +60 -0
- data/db/upgrade_migrations/20170125033319_upgrade_v0_9_to_v0_10.rb +36 -0
- data/db/upgrade_migrations/20170312131417_upgrade_thredded_v0_10_to_v0_11.rb +23 -0
- data/db/upgrade_migrations/20170420163138_upgrade_thredded_v0_11_to_v0_12.rb +28 -0
- data/db/upgrade_migrations/20170811090735_upgrade_thredded_v0_13_to_v_014.rb +21 -0
- data/lib/generators/thredded/install/USAGE +8 -0
- data/lib/generators/thredded/install/install_generator.rb +20 -0
- data/lib/generators/thredded/install/templates/initializer.rb +160 -0
- data/lib/tasks/thredded_tasks.rake +14 -0
- data/lib/thredded.rb +190 -0
- data/lib/thredded/base_migration.rb +14 -0
- data/lib/thredded/base_notifier.rb +28 -0
- data/lib/thredded/collection_to_strings_with_cache_renderer.rb +86 -0
- data/lib/thredded/content_formatter.rb +129 -0
- data/lib/thredded/database_seeder.rb +290 -0
- data/lib/thredded/db_tools.rb +103 -0
- data/lib/thredded/email_transformer.rb +22 -0
- data/lib/thredded/email_transformer/base.rb +47 -0
- data/lib/thredded/email_transformer/onebox.rb +21 -0
- data/lib/thredded/engine.rb +28 -0
- data/lib/thredded/errors.rb +68 -0
- data/lib/thredded/formatting_demo_content.rb +30 -0
- data/lib/thredded/html_pipeline/at_mention_filter.rb +78 -0
- data/lib/thredded/html_pipeline/autolink_filter.rb +15 -0
- data/lib/thredded/html_pipeline/kramdown_filter.rb +39 -0
- data/lib/thredded/html_pipeline/onebox_filter.rb +143 -0
- data/lib/thredded/html_pipeline/wrap_iframes_filter.rb +13 -0
- data/lib/thredded/version.rb +5 -0
- data/lib/thredded/view_hooks/config.rb +37 -0
- data/lib/thredded/view_hooks/renderer.rb +30 -0
- data/vendor/assets/javascripts/autosize.min.js +6 -0
- data/vendor/assets/javascripts/textcomplete.min.js +2 -0
- metadata +1035 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Thredded::Engine.routes.draw do # rubocop:disable Metrics/BlockLength
|
4
|
+
resource :theme_preview, only: [:show], path: 'theme-preview' if %w[development test].include? Rails.env
|
5
|
+
|
6
|
+
page_constraint = { page: /[1-9]\d*/ }
|
7
|
+
|
8
|
+
scope path: 'private-topics' do
|
9
|
+
resource :read_state, only: [:update], as: :mark_all_private_topics_read
|
10
|
+
resource :private_topic, only: [:new], path: '' do
|
11
|
+
post :preview, on: :new, controller: 'private_topic_previews'
|
12
|
+
end
|
13
|
+
resources :private_topics, except: %i[new show], path: '' do
|
14
|
+
member do
|
15
|
+
get '(page-:page)', action: :show, as: '', constraints: page_constraint
|
16
|
+
end
|
17
|
+
resources :private_posts, path: '', except: %i[index show] do
|
18
|
+
post :preview, on: :new, controller: 'private_post_previews'
|
19
|
+
resource :preview, only: [:update], controller: 'private_post_previews'
|
20
|
+
member do
|
21
|
+
get 'quote'
|
22
|
+
post 'mark_as_unread'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
scope only: [:show], constraints: { id: Thredded.routes_id_constraint } do
|
29
|
+
resources :private_post_permalinks, path: 'private-posts'
|
30
|
+
resources :post_permalinks, path: 'posts'
|
31
|
+
end
|
32
|
+
|
33
|
+
resources :autocomplete_users, only: [:index], path: 'autocomplete-users'
|
34
|
+
|
35
|
+
constraints(->(req) { req.env['QUERY_STRING'].include? 'q=' }) do
|
36
|
+
get '/' => 'topics#search', as: :messageboards_search
|
37
|
+
get '/:messageboard_id(.:format)' => 'topics#search', as: :messageboard_search
|
38
|
+
end
|
39
|
+
|
40
|
+
scope path: 'admin' do
|
41
|
+
resources :messageboard_groups, only: %i[new create]
|
42
|
+
scope controller: :moderation, path: 'moderation' do
|
43
|
+
scope constraints: page_constraint do
|
44
|
+
get '(/page-:page)', action: :pending, as: :pending_moderation
|
45
|
+
get '/history(/page-:page)', action: :history, as: :moderation_history
|
46
|
+
get '/users(/page-:page)', action: :users, as: :users_moderation
|
47
|
+
get '/users/:id(/page-:page)', action: :user, as: :user_moderation
|
48
|
+
get '/activity(/page-:page)', action: :activity, as: :moderation_activity
|
49
|
+
end
|
50
|
+
post '', action: :moderate_post, as: :moderate_post
|
51
|
+
post '/user/:id', action: :moderate_user, as: :moderate_user
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
resource :preferences, only: %i[edit update], as: :global_preferences
|
56
|
+
resource :messageboard, path: 'messageboards', only: [:new]
|
57
|
+
resources :messageboards, only: %i[edit update]
|
58
|
+
resources :messageboards, only: %i[index create], path: '' do
|
59
|
+
resource :preferences, only: %i[edit update]
|
60
|
+
resource :topic, path: 'topics', only: [:new] do
|
61
|
+
post :preview, on: :new, controller: 'topic_previews'
|
62
|
+
end
|
63
|
+
resources :topics, path: '', except: %i[index new show] do
|
64
|
+
collection do
|
65
|
+
get '(page-:page)', action: :index, as: '', constraints: page_constraint
|
66
|
+
get '/category/:category_id', action: :category, as: :categories
|
67
|
+
end
|
68
|
+
member do
|
69
|
+
get '(page-:page)', action: :show, as: '', constraints: page_constraint
|
70
|
+
|
71
|
+
# match (un)follow via get as well so that redirecting back to it after sign in works.
|
72
|
+
match 'follow', via: %i[post get]
|
73
|
+
match 'unfollow', via: %i[post get]
|
74
|
+
end
|
75
|
+
resources :posts, except: %i[index show], path: '' do
|
76
|
+
post :preview, on: :new, controller: 'post_previews'
|
77
|
+
resource :preview, only: [:update], controller: 'post_previews'
|
78
|
+
member do
|
79
|
+
get 'quote'
|
80
|
+
post 'mark_as_unread'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
root to: 'messageboards#index'
|
87
|
+
end
|
@@ -0,0 +1,257 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thredded/base_migration'
|
4
|
+
|
5
|
+
# rubocop:disable Metrics/ClassLength
|
6
|
+
# rubocop:disable Metrics/MethodLength
|
7
|
+
class CreateThredded < Thredded::BaseMigration
|
8
|
+
def change
|
9
|
+
unless table_exists?(:friendly_id_slugs)
|
10
|
+
# The user might have installed FriendlyId separately already.
|
11
|
+
create_table :friendly_id_slugs do |t|
|
12
|
+
t.string :slug, null: false
|
13
|
+
t.integer :sluggable_id, null: false
|
14
|
+
t.string :sluggable_type, limit: 50
|
15
|
+
t.string :scope
|
16
|
+
t.datetime :created_at
|
17
|
+
end
|
18
|
+
add_index :friendly_id_slugs, :sluggable_id
|
19
|
+
add_index :friendly_id_slugs, %i[slug sluggable_type], length: { slug: 140, sluggable_type: 50 }
|
20
|
+
add_index :friendly_id_slugs, %i[slug sluggable_type scope],
|
21
|
+
length: { slug: 70, sluggable_type: 50, scope: 70 },
|
22
|
+
unique: true
|
23
|
+
add_index :friendly_id_slugs, :sluggable_type
|
24
|
+
end
|
25
|
+
|
26
|
+
create_table :thredded_categories do |t|
|
27
|
+
t.references :messageboard, null: false, index: false
|
28
|
+
t.string :name, limit: 191, null: false
|
29
|
+
t.string :description, limit: 255
|
30
|
+
t.timestamps null: false
|
31
|
+
t.string :slug, limit: 191, null: false
|
32
|
+
t.index %i[messageboard_id slug], name: :index_thredded_categories_on_messageboard_id_and_slug, unique: true
|
33
|
+
t.index [:messageboard_id], name: :index_thredded_categories_on_messageboard_id
|
34
|
+
end
|
35
|
+
DbTextSearch::CaseInsensitive.add_index connection, :thredded_categories, :name, name: :thredded_categories_name_ci
|
36
|
+
|
37
|
+
create_table :thredded_messageboards do |t|
|
38
|
+
t.string :name, limit: 191, null: false
|
39
|
+
t.string :slug, limit: 191
|
40
|
+
t.text :description
|
41
|
+
t.integer :topics_count, default: 0
|
42
|
+
t.integer :posts_count, default: 0
|
43
|
+
t.integer :position, null: false
|
44
|
+
t.references :last_topic, index: false
|
45
|
+
t.references :messageboard_group, index: false
|
46
|
+
t.timestamps null: false
|
47
|
+
t.boolean :locked, null: false, default: false
|
48
|
+
t.index [:messageboard_group_id], name: :index_thredded_messageboards_on_messageboard_group_id
|
49
|
+
t.index [:slug], name: :index_thredded_messageboards_on_slug
|
50
|
+
end
|
51
|
+
|
52
|
+
create_table :thredded_posts do |t|
|
53
|
+
t.references :user, type: user_id_type, index: false
|
54
|
+
t.text :content, limit: 65_535
|
55
|
+
t.string :ip, limit: 255
|
56
|
+
t.string :source, limit: 255, default: 'web'
|
57
|
+
t.references :postable, null: false, index: false
|
58
|
+
t.references :messageboard, null: false, index: false
|
59
|
+
t.integer :moderation_state, null: false
|
60
|
+
t.timestamps null: false
|
61
|
+
t.index %i[moderation_state updated_at],
|
62
|
+
order: { updated_at: :asc },
|
63
|
+
name: :index_thredded_posts_for_display
|
64
|
+
t.index [:messageboard_id], name: :index_thredded_posts_on_messageboard_id
|
65
|
+
t.index [:postable_id], name: :index_thredded_posts_on_postable_id
|
66
|
+
t.index [:postable_id], name: :index_thredded_posts_on_postable_id_and_postable_type
|
67
|
+
t.index [:user_id], name: :index_thredded_posts_on_user_id
|
68
|
+
end
|
69
|
+
DbTextSearch::FullText.add_index connection, :thredded_posts, :content, name: :thredded_posts_content_fts
|
70
|
+
|
71
|
+
create_table :thredded_private_posts do |t|
|
72
|
+
t.references :user, type: user_id_type, index: false
|
73
|
+
t.text :content, limit: 65_535
|
74
|
+
t.references :postable, null: false, index: false
|
75
|
+
t.string :ip, limit: 255
|
76
|
+
t.timestamps null: false
|
77
|
+
end
|
78
|
+
|
79
|
+
create_table :thredded_private_topics do |t|
|
80
|
+
t.references :user, type: user_id_type, index: false
|
81
|
+
t.references :last_user, index: false
|
82
|
+
t.string :title, limit: 255, null: false
|
83
|
+
t.string :slug, limit: 191, null: false
|
84
|
+
t.integer :posts_count, default: 0
|
85
|
+
t.string :hash_id, limit: 191, null: false
|
86
|
+
t.datetime :last_post_at
|
87
|
+
t.timestamps null: false
|
88
|
+
t.index [:hash_id], name: :index_thredded_private_topics_on_hash_id
|
89
|
+
t.index [:slug], name: :index_thredded_private_topics_on_slug
|
90
|
+
end
|
91
|
+
|
92
|
+
create_table :thredded_private_users do |t|
|
93
|
+
t.references :private_topic, index: false
|
94
|
+
t.references :user, type: user_id_type, index: false
|
95
|
+
t.timestamps null: false
|
96
|
+
t.index [:private_topic_id], name: :index_thredded_private_users_on_private_topic_id
|
97
|
+
t.index [:user_id], name: :index_thredded_private_users_on_user_id
|
98
|
+
end
|
99
|
+
|
100
|
+
create_table :thredded_topic_categories do |t|
|
101
|
+
t.references :topic, null: false, index: false
|
102
|
+
t.references :category, null: false, index: false
|
103
|
+
t.index [:category_id], name: :index_thredded_topic_categories_on_category_id
|
104
|
+
t.index [:topic_id], name: :index_thredded_topic_categories_on_topic_id
|
105
|
+
end
|
106
|
+
|
107
|
+
create_table :thredded_topics do |t|
|
108
|
+
t.references :user, type: user_id_type, index: false
|
109
|
+
t.references :last_user, index: false
|
110
|
+
t.string :title, limit: 255, null: false
|
111
|
+
t.string :slug, limit: 191, null: false
|
112
|
+
t.references :messageboard, null: false, index: false
|
113
|
+
t.integer :posts_count, default: 0, null: false
|
114
|
+
t.boolean :sticky, default: false, null: false
|
115
|
+
t.boolean :locked, default: false, null: false
|
116
|
+
t.string :hash_id, limit: 191, null: false
|
117
|
+
t.string :type, limit: 191
|
118
|
+
t.integer :moderation_state, null: false
|
119
|
+
t.datetime :last_post_at
|
120
|
+
t.timestamps null: false
|
121
|
+
t.index %i[moderation_state sticky updated_at],
|
122
|
+
order: { sticky: :desc, updated_at: :desc },
|
123
|
+
name: :index_thredded_topics_for_display
|
124
|
+
t.index [:hash_id], name: :index_thredded_topics_on_hash_id
|
125
|
+
t.index [:slug], name: :index_thredded_topics_on_slug, unique: true
|
126
|
+
t.index [:messageboard_id], name: :index_thredded_topics_on_messageboard_id
|
127
|
+
t.index [:user_id], name: :index_thredded_topics_on_user_id
|
128
|
+
end
|
129
|
+
DbTextSearch::FullText.add_index connection, :thredded_topics, :title, name: :thredded_topics_title_fts
|
130
|
+
|
131
|
+
create_table :thredded_user_details do |t|
|
132
|
+
t.references :user, type: user_id_type, null: false, index: false
|
133
|
+
t.datetime :latest_activity_at
|
134
|
+
t.integer :posts_count, default: 0
|
135
|
+
t.integer :topics_count, default: 0
|
136
|
+
t.datetime :last_seen_at
|
137
|
+
t.integer :moderation_state, null: false, default: 0 # pending_moderation
|
138
|
+
t.timestamp :moderation_state_changed_at
|
139
|
+
t.timestamps null: false
|
140
|
+
t.index %i[moderation_state moderation_state_changed_at],
|
141
|
+
order: { moderation_state_changed_at: :desc },
|
142
|
+
name: :index_thredded_user_details_for_moderations
|
143
|
+
t.index %i[latest_activity_at], name: :index_thredded_user_details_on_latest_activity_at
|
144
|
+
t.index %i[user_id], name: :index_thredded_user_details_on_user_id, unique: true
|
145
|
+
end
|
146
|
+
|
147
|
+
create_table :thredded_messageboard_users do |t|
|
148
|
+
t.references :thredded_user_detail, null: false, index: false
|
149
|
+
t.references :thredded_messageboard, null: false, index: false
|
150
|
+
t.datetime :last_seen_at, null: false
|
151
|
+
t.index %i[thredded_messageboard_id thredded_user_detail_id],
|
152
|
+
name: :index_thredded_messageboard_users_primary
|
153
|
+
t.index %i[thredded_messageboard_id last_seen_at],
|
154
|
+
name: :index_thredded_messageboard_users_for_recently_active
|
155
|
+
end
|
156
|
+
add_foreign_key :thredded_messageboard_users, :thredded_user_details,
|
157
|
+
column: :thredded_user_detail_id, on_delete: :cascade
|
158
|
+
add_foreign_key :thredded_messageboard_users, :thredded_messageboards,
|
159
|
+
column: :thredded_messageboard_id, on_delete: :cascade
|
160
|
+
|
161
|
+
create_table :thredded_user_preferences do |t|
|
162
|
+
t.references :user, type: user_id_type, null: false, index: false
|
163
|
+
t.boolean :follow_topics_on_mention, default: true, null: false
|
164
|
+
t.boolean :auto_follow_topics, default: false, null: false
|
165
|
+
t.timestamps null: false
|
166
|
+
t.index [:user_id], name: :index_thredded_user_preferences_on_user_id, unique: true
|
167
|
+
end
|
168
|
+
|
169
|
+
create_table :thredded_user_messageboard_preferences do |t|
|
170
|
+
t.references :user, type: user_id_type, null: false, index: false
|
171
|
+
t.references :messageboard, null: false, index: false
|
172
|
+
t.boolean :follow_topics_on_mention, default: true, null: false
|
173
|
+
t.boolean :auto_follow_topics, default: false, null: false
|
174
|
+
t.timestamps null: false
|
175
|
+
t.index %i[user_id messageboard_id],
|
176
|
+
name: :thredded_user_messageboard_preferences_user_id_messageboard_id,
|
177
|
+
unique: true
|
178
|
+
end
|
179
|
+
|
180
|
+
%i[topic private_topic].each do |topics_table|
|
181
|
+
table_name = :"thredded_user_#{topics_table}_read_states"
|
182
|
+
create_table table_name do |t|
|
183
|
+
t.references :user, type: user_id_type, null: false, index: false
|
184
|
+
t.references :postable, null: false, index: false
|
185
|
+
t.integer :page, default: 1, null: false
|
186
|
+
t.timestamp :read_at, null: false
|
187
|
+
t.index %i[user_id postable_id], name: :"#{table_name}_user_postable", unique: true
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
create_table :thredded_messageboard_groups do |t|
|
192
|
+
t.string :name
|
193
|
+
t.integer :position, null: false
|
194
|
+
t.timestamps null: false
|
195
|
+
end
|
196
|
+
|
197
|
+
create_table :thredded_user_topic_follows do |t|
|
198
|
+
t.references :user, type: user_id_type, null: false, index: false
|
199
|
+
t.references :topic, null: false, index: false
|
200
|
+
t.datetime :created_at, null: false
|
201
|
+
t.integer :reason, limit: 1
|
202
|
+
t.index %i[user_id topic_id], name: :thredded_user_topic_follows_user_topic, unique: true
|
203
|
+
end
|
204
|
+
|
205
|
+
create_table :thredded_post_moderation_records do |t|
|
206
|
+
t.references :post, index: false
|
207
|
+
t.references :messageboard, index: false
|
208
|
+
t.text :post_content, limit: 65_535
|
209
|
+
t.references :post_user, index: false
|
210
|
+
t.text :post_user_name
|
211
|
+
t.references :moderator, index: false
|
212
|
+
t.integer :moderation_state, null: false
|
213
|
+
t.integer :previous_moderation_state, null: false
|
214
|
+
t.timestamp :created_at, null: false
|
215
|
+
t.index %i[messageboard_id created_at],
|
216
|
+
order: { created_at: :desc },
|
217
|
+
name: :index_thredded_moderation_records_for_display
|
218
|
+
end
|
219
|
+
|
220
|
+
create_table :thredded_notifications_for_private_topics do |t|
|
221
|
+
t.references :user, null: false, index: false, type: user_id_type
|
222
|
+
t.string :notifier_key, null: false, limit: 90
|
223
|
+
t.boolean :enabled, default: true, null: false
|
224
|
+
t.index %i[user_id notifier_key],
|
225
|
+
name: 'thredded_notifications_for_private_topics_unique', unique: true
|
226
|
+
end
|
227
|
+
create_table :thredded_notifications_for_followed_topics do |t|
|
228
|
+
t.references :user, null: false, index: false, type: user_id_type
|
229
|
+
t.string :notifier_key, null: false, limit: 90
|
230
|
+
t.boolean :enabled, default: true, null: false
|
231
|
+
t.index %i[user_id notifier_key],
|
232
|
+
name: 'thredded_notifications_for_followed_topics_unique', unique: true
|
233
|
+
end
|
234
|
+
create_table :thredded_messageboard_notifications_for_followed_topics do |t|
|
235
|
+
t.references :user, null: false, index: false, type: user_id_type
|
236
|
+
t.references :messageboard, null: false, index: false
|
237
|
+
t.string :notifier_key, null: false, limit: 90
|
238
|
+
t.boolean :enabled, default: true, null: false
|
239
|
+
t.index %i[user_id messageboard_id notifier_key],
|
240
|
+
name: 'thredded_messageboard_notifications_for_followed_topics_unique', unique: true
|
241
|
+
end
|
242
|
+
|
243
|
+
create_table :thredded_user_post_notifications do |t|
|
244
|
+
t.references :user, null: false, index: false, type: user_id_type
|
245
|
+
t.references :post, null: false, index: false
|
246
|
+
t.datetime :notified_at, null: false
|
247
|
+
t.index :post_id, name: :index_thredded_user_post_notifications_on_post_id
|
248
|
+
t.index %i[user_id post_id], name: :index_thredded_user_post_notifications_on_user_id_and_post_id, unique: true
|
249
|
+
end
|
250
|
+
add_foreign_key :thredded_user_post_notifications,
|
251
|
+
Thredded.user_class.table_name, column: :user_id, on_delete: :cascade
|
252
|
+
add_foreign_key :thredded_user_post_notifications,
|
253
|
+
:thredded_posts, column: :post_id, on_delete: :cascade
|
254
|
+
end
|
255
|
+
end
|
256
|
+
# rubocop:enable Metrics/MethodLength
|
257
|
+
# rubocop:enable Metrics/ClassLength
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thredded/base_migration'
|
4
|
+
|
5
|
+
class UpgradeV05ToV06 < Thredded::BaseMigration
|
6
|
+
def up
|
7
|
+
add_column :thredded_messageboards, :last_topic_id, column_type(:thredded_topics, :id)
|
8
|
+
Thredded::Messageboard.reset_column_information
|
9
|
+
Thredded::Messageboard.all.each do |messageboard|
|
10
|
+
messageboard.update_column :last_topic_id, messageboard.topics.order(updated_at: :desc, id: :desc).first.try(:id)
|
11
|
+
end
|
12
|
+
change_column_null :thredded_posts, :postable_id, false
|
13
|
+
# Allow null on user_id and last_user_id because users can get deleted.
|
14
|
+
change_column_null :thredded_topics, :user_id, true
|
15
|
+
change_column_null :thredded_topics, :last_user_id, true
|
16
|
+
change_column_null :thredded_private_topics, :user_id, true
|
17
|
+
change_column_null :thredded_private_topics, :last_user_id, true
|
18
|
+
end
|
19
|
+
|
20
|
+
def down
|
21
|
+
change_column_null :thredded_private_topics, :last_user_id, false
|
22
|
+
change_column_null :thredded_private_topics, :user_id, false
|
23
|
+
change_column_null :thredded_topics, :last_user_id, false
|
24
|
+
change_column_null :thredded_topics, :user_id, false
|
25
|
+
change_column_null :thredded_posts, :postable_id, true
|
26
|
+
remove_column :thredded_messageboards, :last_topic_id
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thredded/base_migration'
|
4
|
+
|
5
|
+
class UpgradeV06ToV07 < Thredded::BaseMigration
|
6
|
+
def up
|
7
|
+
Thredded::MessageboardGroup.transaction do
|
8
|
+
Thredded::MessageboardGroup.where(
|
9
|
+
name: Thredded::MessageboardGroup.group(:name).having('count(id) > 1').select(:name)
|
10
|
+
).group_by(&:name).each_value do |messageboard_groups|
|
11
|
+
messageboard_groups.from(1).each_with_index do |messageboard_group, i|
|
12
|
+
messageboard_group.update!(name: "#{messageboard_group.name}-#{i + 1}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
add_index :thredded_messageboard_groups,
|
18
|
+
:name,
|
19
|
+
unique: true,
|
20
|
+
name: :index_thredded_messageboard_group_on_name
|
21
|
+
|
22
|
+
add_column :thredded_topics, :last_post_at, :datetime
|
23
|
+
add_column :thredded_private_topics, :last_post_at, :datetime
|
24
|
+
# update existing values to pretty accurate match
|
25
|
+
Thredded::Topic.update_all('last_post_at = updated_at')
|
26
|
+
Thredded::PrivateTopic.update_all('last_post_at = updated_at')
|
27
|
+
|
28
|
+
add_column :thredded_messageboards, :position, :integer
|
29
|
+
Thredded::Messageboard.reset_column_information
|
30
|
+
Thredded::Messageboard.all.each { |m| m.update_column(:position, m.created_at.to_i) }
|
31
|
+
change_column :thredded_messageboards, :position, :integer, null: false
|
32
|
+
|
33
|
+
add_column :thredded_messageboard_groups, :position, :integer
|
34
|
+
Thredded::MessageboardGroup.reset_column_information
|
35
|
+
Thredded::MessageboardGroup.all.each { |mg| mg.update_column(:position, mg.created_at.to_i) }
|
36
|
+
change_column :thredded_messageboard_groups, :position, :integer, null: false
|
37
|
+
end
|
38
|
+
|
39
|
+
def down
|
40
|
+
remove_index :thredded_messageboard_groups, name: :index_thredded_messageboard_group_on_name
|
41
|
+
remove_column :thredded_topics, :last_post_at
|
42
|
+
remove_column :thredded_private_topics, :last_post_at
|
43
|
+
remove_column :thredded_messageboards, :position
|
44
|
+
remove_column :thredded_messageboard_groups, :position
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thredded/base_migration'
|
4
|
+
|
5
|
+
class UpgradeV07ToV08 < Thredded::BaseMigration
|
6
|
+
def up
|
7
|
+
closed_messageboards = Thredded::Messageboard.unscoped.where(closed: true).to_a
|
8
|
+
if closed_messageboards.present?
|
9
|
+
fail ActiveRecord::MigrationError, <<-TEXT
|
10
|
+
There are #{closed_messageboards.length} closed Messageboards:
|
11
|
+
#{closed_messageboards.map { |m| "#{m.name} (id=#{m.id})" }.join("\n")}
|
12
|
+
Support for closed messageboards has been removed in thredded v0.8.0.
|
13
|
+
Delete or un-close these messageboards and consider using the "paranoia" gem to support soft deletion instead.
|
14
|
+
TEXT
|
15
|
+
end
|
16
|
+
remove_index :thredded_messageboards, name: :index_thredded_messageboards_on_closed
|
17
|
+
remove_column :thredded_messageboards, :closed
|
18
|
+
add_column :thredded_user_preferences, :followed_topic_emails, :boolean, default: true, null: false
|
19
|
+
add_column :thredded_user_messageboard_preferences, :followed_topic_emails, :boolean, default: true, null: false
|
20
|
+
rename_column :thredded_user_preferences, :notify_on_mention, :follow_topics_on_mention
|
21
|
+
rename_column :thredded_user_messageboard_preferences, :notify_on_mention, :follow_topics_on_mention
|
22
|
+
change_column :thredded_messageboards, :name, :string, limit: 191
|
23
|
+
end
|
24
|
+
|
25
|
+
def down
|
26
|
+
change_column :thredded_messageboards, :name, :string, limit: 255
|
27
|
+
rename_column :thredded_user_messageboard_preferences, :follow_topics_on_mention, :notify_on_mention
|
28
|
+
rename_column :thredded_user_preferences, :follow_topics_on_mention, :notify_on_mention
|
29
|
+
remove_column :thredded_user_messageboard_preferences, :followed_topic_emails
|
30
|
+
remove_column :thredded_user_preferences, :followed_topic_emails
|
31
|
+
add_column :thredded_messageboards, :closed, :boolean, default: false, null: false
|
32
|
+
add_index :thredded_messageboards, :closed, name: :index_thredded_messageboards_on_closed
|
33
|
+
end
|
34
|
+
end
|