mirror of
https://github.com/tildeverse/lobsters
synced 2024-06-17 22:27:08 +00:00
parent
835f6cabe0
commit
8fbdc02078
2
Gemfile
2
Gemfile
|
@ -26,6 +26,8 @@ gem "nokogiri", "= 1.6.1"
|
||||||
gem "htmlentities"
|
gem "htmlentities"
|
||||||
gem "rdiscount"
|
gem "rdiscount"
|
||||||
|
|
||||||
|
gem "activerecord-typedstore"
|
||||||
|
|
||||||
# for twitter-posting bot
|
# for twitter-posting bot
|
||||||
gem "oauth"
|
gem "oauth"
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ GEM
|
||||||
activemodel (= 4.1.12)
|
activemodel (= 4.1.12)
|
||||||
activesupport (= 4.1.12)
|
activesupport (= 4.1.12)
|
||||||
arel (~> 5.0.0)
|
arel (~> 5.0.0)
|
||||||
|
activerecord-typedstore (0.6.1)
|
||||||
|
activerecord (>= 3.2, < 5)
|
||||||
activesupport (4.1.12)
|
activesupport (4.1.12)
|
||||||
i18n (~> 0.6, >= 0.6.9)
|
i18n (~> 0.6, >= 0.6.9)
|
||||||
json (~> 1.7, >= 1.7.7)
|
json (~> 1.7, >= 1.7.7)
|
||||||
|
@ -127,6 +129,7 @@ PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
|
activerecord-typedstore
|
||||||
bcrypt (~> 3.1.2)
|
bcrypt (~> 3.1.2)
|
||||||
dynamic_form
|
dynamic_form
|
||||||
exception_notification
|
exception_notification
|
||||||
|
@ -147,4 +150,4 @@ DEPENDENCIES
|
||||||
unicorn
|
unicorn
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.11.2
|
1.13.6
|
||||||
|
|
|
@ -33,6 +33,19 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
has_secure_password
|
has_secure_password
|
||||||
|
|
||||||
|
typed_store :settings do |s|
|
||||||
|
s.boolean :email_notifications, :default => false
|
||||||
|
s.boolean :email_replies, :default => false
|
||||||
|
s.boolean :pushover_replies, :default => false
|
||||||
|
s.string :pushover_user_key
|
||||||
|
s.boolean :email_messages, :default => false
|
||||||
|
s.boolean :pushover_messages, :default => false
|
||||||
|
s.boolean :email_mentions, :default => false
|
||||||
|
s.boolean :show_avatars, :default => true
|
||||||
|
s.boolean :show_story_previews, :default => false
|
||||||
|
s.boolean :show_submitted_story_threads, :default => false
|
||||||
|
end
|
||||||
|
|
||||||
validates :email, :format => { :with => /\A[^@ ]+@[^@ ]+\.[^@ ]+\Z/ },
|
validates :email, :format => { :with => /\A[^@ ]+@[^@ ]+\.[^@ ]+\Z/ },
|
||||||
:uniqueness => { :case_sensitive => false }
|
:uniqueness => { :case_sensitive => false }
|
||||||
|
|
||||||
|
|
58
db/migrate/20170119172852_move_user_settings.rb
Normal file
58
db/migrate/20170119172852_move_user_settings.rb
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
class MoveUserSettings < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :users, :settings, :text
|
||||||
|
|
||||||
|
[
|
||||||
|
:email_notifications,
|
||||||
|
:email_replies,
|
||||||
|
:pushover_replies,
|
||||||
|
:pushover_user_key,
|
||||||
|
:email_messages,
|
||||||
|
:pushover_messages,
|
||||||
|
:email_mentions,
|
||||||
|
:show_avatars,
|
||||||
|
:show_story_previews,
|
||||||
|
:show_submitted_story_threads,
|
||||||
|
].each do |col|
|
||||||
|
rename_column :users, col, "old_#{col}"
|
||||||
|
end
|
||||||
|
|
||||||
|
User.find_each do |u|
|
||||||
|
[
|
||||||
|
:email_notifications,
|
||||||
|
:email_replies,
|
||||||
|
:pushover_replies,
|
||||||
|
:pushover_user_key,
|
||||||
|
:email_messages,
|
||||||
|
:pushover_messages,
|
||||||
|
:email_mentions,
|
||||||
|
:show_avatars,
|
||||||
|
:show_story_previews,
|
||||||
|
:show_submitted_story_threads,
|
||||||
|
].each do |k|
|
||||||
|
u.settings[k] = u.send("old_#{k}")
|
||||||
|
end
|
||||||
|
|
||||||
|
u.save(:validate => false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :users, :settings
|
||||||
|
|
||||||
|
[
|
||||||
|
:email_notifications,
|
||||||
|
:email_replies,
|
||||||
|
:pushover_replies,
|
||||||
|
:pushover_user_key,
|
||||||
|
:email_messages,
|
||||||
|
:pushover_messages,
|
||||||
|
:email_mentions,
|
||||||
|
:show_avatars,
|
||||||
|
:show_story_previews,
|
||||||
|
:show_submitted_story_threads,
|
||||||
|
].each do |col|
|
||||||
|
rename_column :users, "old#{col}", col
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
53
db/schema.rb
53
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20160704022756) do
|
ActiveRecord::Schema.define(version: 20170119172852) do
|
||||||
|
|
||||||
create_table "comments", force: true do |t|
|
create_table "comments", force: true do |t|
|
||||||
t.datetime "created_at", null: false
|
t.datetime "created_at", null: false
|
||||||
|
@ -183,38 +183,39 @@ ActiveRecord::Schema.define(version: 20160704022756) do
|
||||||
add_index "tags", ["tag"], name: "tag", unique: true, using: :btree
|
add_index "tags", ["tag"], name: "tag", unique: true, using: :btree
|
||||||
|
|
||||||
create_table "users", force: true do |t|
|
create_table "users", force: true do |t|
|
||||||
t.string "username", limit: 50
|
t.string "username", limit: 50
|
||||||
t.string "email", limit: 100
|
t.string "email", limit: 100
|
||||||
t.string "password_digest", limit: 75
|
t.string "password_digest", limit: 75
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.boolean "email_notifications", default: false
|
t.boolean "old_email_notifications", default: false
|
||||||
t.boolean "is_admin", default: false
|
t.boolean "is_admin", default: false
|
||||||
t.string "password_reset_token", limit: 75
|
t.string "password_reset_token", limit: 75
|
||||||
t.string "session_token", limit: 75, default: "", null: false
|
t.string "session_token", limit: 75, default: "", null: false
|
||||||
t.text "about", limit: 16777215
|
t.text "about", limit: 16777215
|
||||||
t.integer "invited_by_user_id"
|
t.integer "invited_by_user_id"
|
||||||
t.boolean "email_replies", default: false
|
t.boolean "old_email_replies", default: false
|
||||||
t.boolean "pushover_replies", default: false
|
t.boolean "old_pushover_replies", default: false
|
||||||
t.string "pushover_user_key"
|
t.string "old_pushover_user_key"
|
||||||
t.boolean "email_messages", default: true
|
t.boolean "old_email_messages", default: true
|
||||||
t.boolean "pushover_messages", default: true
|
t.boolean "old_pushover_messages", default: true
|
||||||
t.boolean "is_moderator", default: false
|
t.boolean "is_moderator", default: false
|
||||||
t.boolean "email_mentions", default: false
|
t.boolean "old_email_mentions", default: false
|
||||||
t.boolean "pushover_mentions", default: false
|
t.boolean "pushover_mentions", default: false
|
||||||
t.string "rss_token", limit: 75
|
t.string "rss_token", limit: 75
|
||||||
t.string "mailing_list_token", limit: 75
|
t.string "mailing_list_token", limit: 75
|
||||||
t.integer "mailing_list_mode", default: 0
|
t.integer "mailing_list_mode", default: 0
|
||||||
t.integer "karma", default: 0, null: false
|
t.integer "karma", default: 0, null: false
|
||||||
t.datetime "banned_at"
|
t.datetime "banned_at"
|
||||||
t.integer "banned_by_user_id"
|
t.integer "banned_by_user_id"
|
||||||
t.string "banned_reason", limit: 200
|
t.string "banned_reason", limit: 200
|
||||||
t.datetime "deleted_at"
|
t.datetime "deleted_at"
|
||||||
t.boolean "show_avatars", default: false
|
t.boolean "old_show_avatars", default: true
|
||||||
t.boolean "show_story_previews", default: false
|
t.boolean "old_show_story_previews", default: false
|
||||||
t.boolean "show_submitted_story_threads", default: true
|
t.boolean "old_show_submitted_story_threads", default: true
|
||||||
t.datetime "disabled_invite_at"
|
t.datetime "disabled_invite_at"
|
||||||
t.integer "disabled_invite_by_user_id"
|
t.integer "disabled_invite_by_user_id"
|
||||||
t.string "disabled_invite_reason", limit: 200
|
t.string "disabled_invite_reason", limit: 200
|
||||||
|
t.text "settings"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "users", ["mailing_list_mode"], name: "mailing_list_enabled", using: :btree
|
add_index "users", ["mailing_list_mode"], name: "mailing_list_enabled", using: :btree
|
||||||
|
|
Loading…
Reference in New Issue
Block a user