removed unneeded parentheses and text limits
This commit is contained in:
@@ -70,7 +70,7 @@ class Forumthread < ActiveRecord::Base
|
||||
order_phrase = query || [title, content, reply].select(&:present?).join(" ")
|
||||
user_id = user.try(:id).to_i
|
||||
role_value = user.try(:role).to_i
|
||||
can_read = "(COALESCE(forum_role_read.value, 0) <= ? AND COALESCE(forumgroup_role_read.value, 0) <= ?)"
|
||||
can_read = "COALESCE(forum_role_read.value, 0) <= ? AND COALESCE(forumgroup_role_read.value, 0) <= ?"
|
||||
# A user can view sticky threads in write-only forums without read permissions.
|
||||
sticky_can_write = "sticky = true AND (COALESCE(forum_role_write.value, 0) <= ? AND COALESCE(forumgroup_role_write.value, 0) <= ?)"
|
||||
match = ["MATCH (title, forumthreads.content) AGAINST (#{Forumthread.sanitize(order_phrase)})", "MATCH (threadreplies.content) AGAINST (#{Forumthread.sanitize(order_phrase)})", "MATCH (title, forumthreads.content) AGAINST (?) OR MATCH (threadreplies.content) AGAINST (?)", "MATCH (title) AGAINST (?)", "MATCH (forumthreads.content) AGAINST (?)", "MATCH (threadreplies.content) AGAINST (?)"]
|
||||
|
||||
94
db/schema.rb
94
db/schema.rb
@@ -11,24 +11,18 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170710141543) do
|
||||
|
||||
create_table "badgeassociations", force: :cascade do |t|
|
||||
t.integer "badge_id", limit: 4
|
||||
t.integer "forum_id", limit: 4
|
||||
t.integer "forumgroup_id", limit: 4
|
||||
t.integer "permission", limit: 4
|
||||
end
|
||||
ActiveRecord::Schema.define(version: 20170703003647) do
|
||||
|
||||
create_table "badges", force: :cascade do |t|
|
||||
t.string "name", limit: 191
|
||||
t.string "symbol", limit: 191
|
||||
t.string "color", limit: 191
|
||||
t.string "name", limit: 191
|
||||
t.string "symbol", limit: 191
|
||||
t.string "color", limit: 191
|
||||
t.integer "value", limit: 4
|
||||
end
|
||||
|
||||
create_table "blogposts", force: :cascade do |t|
|
||||
t.string "title", limit: 191
|
||||
t.text "content", limit: 65535
|
||||
t.string "title", limit: 255
|
||||
t.text "content", limit: 16777215
|
||||
t.integer "user_author_id", limit: 4
|
||||
t.integer "user_editor_id", limit: 4
|
||||
t.datetime "created_at"
|
||||
@@ -36,7 +30,7 @@ ActiveRecord::Schema.define(version: 20170710141543) do
|
||||
end
|
||||
|
||||
create_table "comments", force: :cascade do |t|
|
||||
t.text "content", limit: 65535
|
||||
t.text "content", limit: 16777215
|
||||
t.integer "user_author_id", limit: 4
|
||||
t.integer "user_editor_id", limit: 4
|
||||
t.integer "blogpost_id", limit: 4
|
||||
@@ -45,14 +39,14 @@ ActiveRecord::Schema.define(version: 20170710141543) do
|
||||
end
|
||||
|
||||
create_table "forumgroups", force: :cascade do |t|
|
||||
t.string "name", limit: 191
|
||||
t.string "name", limit: 255
|
||||
t.integer "position", limit: 4
|
||||
t.integer "role_read_id", limit: 4
|
||||
t.integer "role_write_id", limit: 4
|
||||
end
|
||||
|
||||
create_table "forums", force: :cascade do |t|
|
||||
t.string "name", limit: 191
|
||||
t.string "name", limit: 255
|
||||
t.integer "position", limit: 4
|
||||
t.integer "role_read_id", limit: 4
|
||||
t.integer "role_write_id", limit: 4
|
||||
@@ -66,10 +60,10 @@ ActiveRecord::Schema.define(version: 20170710141543) do
|
||||
end
|
||||
|
||||
create_table "forumthreads", force: :cascade do |t|
|
||||
t.string "title", limit: 191
|
||||
t.text "content", limit: 65535
|
||||
t.boolean "sticky", default: false
|
||||
t.boolean "locked", default: false
|
||||
t.string "title", limit: 255
|
||||
t.text "content", limit: 16777215
|
||||
t.boolean "sticky", default: false
|
||||
t.boolean "locked", default: false
|
||||
t.integer "user_author_id", limit: 4
|
||||
t.integer "user_editor_id", limit: 4
|
||||
t.integer "forum_id", limit: 4
|
||||
@@ -79,57 +73,49 @@ ActiveRecord::Schema.define(version: 20170710141543) do
|
||||
end
|
||||
|
||||
add_index "forumthreads", ["content"], name: "index_forumthreads_on_content", type: :fulltext
|
||||
add_index "forumthreads", ["title", "content"], name: "forumthreads_title_content", type: :fulltext
|
||||
add_index "forumthreads", ["title", "content"], name: "index_forumthreads_on_title_and_content", type: :fulltext
|
||||
add_index "forumthreads", ["title"], name: "index_forumthreads_on_title", type: :fulltext
|
||||
|
||||
create_table "info", force: :cascade do |t|
|
||||
t.string "title", limit: 191
|
||||
t.text "content", limit: 65535
|
||||
t.string "title", limit: 255
|
||||
t.text "content", limit: 16777215
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "labels", force: :cascade do |t|
|
||||
t.string "name", limit: 191
|
||||
t.string "color", limit: 191
|
||||
end
|
||||
|
||||
create_table "notifications", force: :cascade do |t|
|
||||
t.string "user_token", limit: 191
|
||||
t.string "message_type", limit: 191, null: false
|
||||
t.integer "user_message_id", limit: 4
|
||||
t.text "content", limit: 65535
|
||||
t.string "content_path", limit: 191
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "name", limit: 255
|
||||
t.string "color", limit: 255
|
||||
end
|
||||
|
||||
create_table "register_tokens", force: :cascade do |t|
|
||||
t.string "uuid", limit: 32, null: false
|
||||
t.string "token", limit: 6, null: false
|
||||
t.string "email", limit: 191, null: false
|
||||
t.string "email", limit: 191
|
||||
end
|
||||
|
||||
add_index "register_tokens", ["email"], name: "index_register_tokens_on_email", unique: true, using: :btree
|
||||
add_index "register_tokens", ["uuid"], name: "index_register_tokens_on_uuid", unique: true, using: :btree
|
||||
|
||||
create_table "roles", force: :cascade do |t|
|
||||
t.string "name", limit: 191
|
||||
t.string "name", limit: 255
|
||||
t.integer "value", limit: 4
|
||||
t.string "color", limit: 191
|
||||
t.string "color", limit: 255
|
||||
end
|
||||
|
||||
create_table "sessions", force: :cascade do |t|
|
||||
t.string "session_id", limit: 191, null: false
|
||||
t.text "data", limit: 65535
|
||||
t.string "session_id", limit: 255, null: false
|
||||
t.text "data", limit: 16777215
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
|
||||
add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", length: {"session_id"=>191}, using: :btree
|
||||
add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
|
||||
|
||||
create_table "threadreplies", force: :cascade do |t|
|
||||
t.text "content", limit: 65535
|
||||
t.text "content", limit: 16777215
|
||||
t.integer "user_author_id", limit: 4
|
||||
t.integer "user_editor_id", limit: 4
|
||||
t.integer "forumthread_id", limit: 4
|
||||
@@ -141,19 +127,19 @@ ActiveRecord::Schema.define(version: 20170710141543) do
|
||||
add_index "threadreplies", ["forumthread_id"], name: "index_threadreplies_on_forumthread_id", using: :btree
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "uuid", limit: 191, null: false
|
||||
t.string "name", limit: 191, null: false
|
||||
t.string "password_digest", limit: 191, null: false
|
||||
t.string "ign", limit: 191, null: false
|
||||
t.string "email", limit: 191, null: false
|
||||
t.string "uuid", limit: 255, null: false
|
||||
t.string "name", limit: 191
|
||||
t.string "password_digest", limit: 255, null: false
|
||||
t.string "ign", limit: 255, null: false
|
||||
t.string "email", limit: 191
|
||||
t.text "about", limit: 65535
|
||||
t.string "last_ip", limit: 191
|
||||
t.string "skype", limit: 191
|
||||
t.string "last_ip", limit: 255
|
||||
t.string "skype", limit: 255
|
||||
t.boolean "skype_public", default: false
|
||||
t.string "youtube", limit: 191
|
||||
t.string "youtube_channelname", limit: 191
|
||||
t.string "twitter", limit: 191
|
||||
t.string "email_token", limit: 191
|
||||
t.string "youtube", limit: 255
|
||||
t.string "youtube_channelname", limit: 255
|
||||
t.string "twitter", limit: 255
|
||||
t.string "email_token", limit: 255
|
||||
t.boolean "confirmed", default: false
|
||||
t.datetime "last_seen"
|
||||
t.integer "role_id", limit: 4, null: false
|
||||
@@ -164,12 +150,10 @@ ActiveRecord::Schema.define(version: 20170710141543) do
|
||||
t.boolean "mail_own_blogpost_comment", default: true
|
||||
t.boolean "mail_other_blogpost_comment", default: true
|
||||
t.boolean "mail_mention", default: true
|
||||
t.integer "badge_id", limit: 4, default: 1
|
||||
t.integer "badge_id", limit: 4, default: 0
|
||||
t.boolean "utc_time", default: false
|
||||
t.boolean "header_scroll", default: false
|
||||
t.boolean "dark", default: false
|
||||
t.string "notification_token", limit: 191, null: false
|
||||
t.integer "notification_type", limit: 4, default: 1, null: false
|
||||
end
|
||||
|
||||
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
|
||||
|
||||
Reference in New Issue
Block a user