add setting to show threads on a user's submitted stories in 'Your Threads'
closes #231
This commit is contained in:
parent
3850fa7d54
commit
6b636ac8c5
|
@ -81,7 +81,8 @@ private
|
|||
:username, :email, :password, :password_confirmation, :about,
|
||||
:email_replies, :email_messages, :email_mentions,
|
||||
:pushover_replies, :pushover_messages, :pushover_mentions,
|
||||
:mailing_list_mode, :show_avatars, :show_story_previews
|
||||
:mailing_list_mode, :show_avatars, :show_story_previews,
|
||||
:show_submitted_story_threads
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -253,8 +253,18 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def recent_threads(amount)
|
||||
self.comments.group(:thread_id).order('MAX(created_at) DESC').limit(
|
||||
amount).pluck(:thread_id)
|
||||
thread_ids = self.comments.group(:thread_id).order('MAX(created_at) DESC').
|
||||
limit(amount).pluck(:thread_id)
|
||||
|
||||
if self.show_submitted_story_threads
|
||||
thread_ids += Comment.joins(:story).
|
||||
where(:stories => { :user_id => self.id }).group(:thread_id).
|
||||
order("MAX(comments.created_at) DESC").limit(amount).pluck(:thread_id)
|
||||
|
||||
thread_ids = thread_ids.uniq.sort.reverse[0, amount]
|
||||
end
|
||||
|
||||
thread_ids
|
||||
end
|
||||
|
||||
def stories_submitted_count
|
||||
|
|
|
@ -80,7 +80,6 @@
|
|||
|
||||
<br>
|
||||
|
||||
|
||||
<div class="legend">
|
||||
Comment Reply Notification Settings
|
||||
</div>
|
||||
|
@ -141,6 +140,18 @@
|
|||
|
||||
<br>
|
||||
|
||||
<div class="legend">
|
||||
Submitted Story Comment Settings
|
||||
</div>
|
||||
|
||||
<div class="boxline">
|
||||
<%= f.label :show_submitted_story_threads,
|
||||
"Show in Your Threads:", :class => "required" %>
|
||||
<%= f.check_box :show_submitted_story_threads %>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="legend">
|
||||
Mailing List Settings
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
class AddUserSettingPostThreads < ActiveRecord::Migration
|
||||
def change
|
||||
add_column "users", "show_submitted_story_threads", :boolean,
|
||||
:default => true
|
||||
end
|
||||
end
|
47
db/schema.rb
47
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151015143959) do
|
||||
ActiveRecord::Schema.define(version: 20151207180050) do
|
||||
|
||||
create_table "comments", force: true do |t|
|
||||
t.datetime "created_at", null: false
|
||||
|
@ -174,34 +174,35 @@ ActiveRecord::Schema.define(version: 20151015143959) do
|
|||
add_index "tags", ["tag"], name: "tag", unique: true, using: :btree
|
||||
|
||||
create_table "users", force: true do |t|
|
||||
t.string "username", limit: 50
|
||||
t.string "email", limit: 100
|
||||
t.string "password_digest", limit: 75
|
||||
t.string "username", limit: 50
|
||||
t.string "email", limit: 100
|
||||
t.string "password_digest", limit: 75
|
||||
t.datetime "created_at"
|
||||
t.boolean "email_notifications", default: false
|
||||
t.boolean "is_admin", default: false
|
||||
t.string "password_reset_token", limit: 75
|
||||
t.string "session_token", limit: 75, default: "", null: false
|
||||
t.text "about", limit: 16777215
|
||||
t.boolean "email_notifications", default: false
|
||||
t.boolean "is_admin", default: false
|
||||
t.string "password_reset_token", limit: 75
|
||||
t.string "session_token", limit: 75, default: "", null: false
|
||||
t.text "about", limit: 16777215
|
||||
t.integer "invited_by_user_id"
|
||||
t.boolean "email_replies", default: false
|
||||
t.boolean "pushover_replies", default: false
|
||||
t.boolean "email_replies", default: false
|
||||
t.boolean "pushover_replies", default: false
|
||||
t.string "pushover_user_key"
|
||||
t.boolean "email_messages", default: true
|
||||
t.boolean "pushover_messages", default: true
|
||||
t.boolean "is_moderator", default: false
|
||||
t.boolean "email_mentions", default: false
|
||||
t.boolean "pushover_mentions", default: false
|
||||
t.string "rss_token", limit: 75
|
||||
t.string "mailing_list_token", limit: 75
|
||||
t.integer "mailing_list_mode", default: 0
|
||||
t.integer "karma", default: 0, null: false
|
||||
t.boolean "email_messages", default: true
|
||||
t.boolean "pushover_messages", default: true
|
||||
t.boolean "is_moderator", default: false
|
||||
t.boolean "email_mentions", default: false
|
||||
t.boolean "pushover_mentions", default: false
|
||||
t.string "rss_token", limit: 75
|
||||
t.string "mailing_list_token", limit: 75
|
||||
t.integer "mailing_list_mode", default: 0
|
||||
t.integer "karma", default: 0, null: false
|
||||
t.datetime "banned_at"
|
||||
t.integer "banned_by_user_id"
|
||||
t.string "banned_reason", limit: 200
|
||||
t.string "banned_reason", limit: 200
|
||||
t.datetime "deleted_at"
|
||||
t.boolean "show_avatars", default: false
|
||||
t.boolean "show_story_previews", default: false
|
||||
t.boolean "show_avatars", default: false
|
||||
t.boolean "show_story_previews", default: false
|
||||
t.boolean "show_submitted_story_threads", default: true
|
||||
end
|
||||
|
||||
add_index "users", ["mailing_list_mode"], name: "mailing_list_enabled", using: :btree
|
||||
|
|
Loading…
Reference in a new issue