Merge branch 'master' into vdom
This commit is contained in:
commit
b878598418
7 changed files with 35 additions and 20 deletions
app
assets/stylesheets/mobile
jobs/scheduled
mailers
lib
spec
|
@ -126,6 +126,7 @@ h2#site-text-logo
|
||||||
padding: 8px 10px;
|
padding: 8px 10px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
.fa-caret-down {
|
.fa-caret-down {
|
||||||
|
@ -142,16 +143,16 @@ h2#site-text-logo
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 10000000;
|
z-index: 10000000;
|
||||||
background-color: $secondary;
|
background-color: $secondary;
|
||||||
width: 98%;
|
width: 100%;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
border: 1px solid #eaeaea;
|
border: 1px solid #eaeaea;
|
||||||
|
box-sizing: border-box;
|
||||||
li {
|
li {
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
a {
|
a {
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: block;
|
display: block;
|
||||||
padding: 5px 8px;
|
padding: 5px 8px;
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Jobs
|
||||||
def execute(args)
|
def execute(args)
|
||||||
if SiteSetting.notify_about_flags_after > 0 &&
|
if SiteSetting.notify_about_flags_after > 0 &&
|
||||||
PostAction.flagged_posts_count > 0 &&
|
PostAction.flagged_posts_count > 0 &&
|
||||||
FlagQuery.flagged_post_actions('active').where('post_actions.created_at < ?', 48.hours.ago).pluck(:id).count > 0
|
FlagQuery.flagged_post_actions('active').where('post_actions.created_at < ?', SiteSetting.notify_about_flags_after.to_i.hours.ago).pluck(:id).count > 0
|
||||||
|
|
||||||
message = PendingFlagsMailer.notify
|
message = PendingFlagsMailer.notify
|
||||||
Email::Sender.new(message, :pending_flags_reminder).send
|
Email::Sender.new(message, :pending_flags_reminder).send
|
||||||
|
|
|
@ -186,11 +186,14 @@ class UserNotifications < ActionMailer::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_context_posts(post, topic_user)
|
def self.get_context_posts(post, topic_user)
|
||||||
|
allowed_post_types = [Post.types[:regular]]
|
||||||
|
allowed_post_types << Post.types[:whisper] if topic_user.try(:user).try(:staff?)
|
||||||
|
|
||||||
context_posts = Post.where(topic_id: post.topic_id)
|
context_posts = Post.where(topic_id: post.topic_id)
|
||||||
.where("post_number < ?", post.post_number)
|
.where("post_number < ?", post.post_number)
|
||||||
.where(user_deleted: false)
|
.where(user_deleted: false)
|
||||||
.where(hidden: false)
|
.where(hidden: false)
|
||||||
.where(post_type: Topic.visible_post_types)
|
.where(post_type: allowed_post_types)
|
||||||
.order('created_at desc')
|
.order('created_at desc')
|
||||||
.limit(SiteSetting.email_posts_context)
|
.limit(SiteSetting.email_posts_context)
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ module BackupRestore
|
||||||
DatabaseConfiguration = Struct.new(:host, :port, :username, :password, :database)
|
DatabaseConfiguration = Struct.new(:host, :port, :username, :password, :database)
|
||||||
|
|
||||||
def self.database_configuration
|
def self.database_configuration
|
||||||
config = Rails.env.production? ? ActiveRecord::Base.connection_pool.spec.config : Rails.configuration.database_configuration[Rails.env]
|
config = ActiveRecord::Base.connection_pool.spec.config
|
||||||
config = config.with_indifferent_access
|
config = config.with_indifferent_access
|
||||||
|
|
||||||
DatabaseConfiguration.new(
|
DatabaseConfiguration.new(
|
||||||
|
|
|
@ -121,7 +121,7 @@ module SiteSettingExtension
|
||||||
# exists it will be used instead of the setting and the setting will be hidden.
|
# exists it will be used instead of the setting and the setting will be hidden.
|
||||||
# Useful for things like API keys on multisite.
|
# Useful for things like API keys on multisite.
|
||||||
if opts[:shadowed_by_global] && GlobalSetting.respond_to?(name)
|
if opts[:shadowed_by_global] && GlobalSetting.respond_to?(name)
|
||||||
if (val = GlobalSetting.send(name)).present?
|
unless (val = GlobalSetting.send(name)) == ''.freeze
|
||||||
hidden_settings << name
|
hidden_settings << name
|
||||||
shadowed_settings << name
|
shadowed_settings << name
|
||||||
current_value = val
|
current_value = val
|
||||||
|
|
|
@ -470,6 +470,18 @@ describe SiteSettingExtension do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with a false override" do
|
||||||
|
before do
|
||||||
|
GlobalSetting.stubs(:bool).returns(false)
|
||||||
|
settings.setting(:bool, true, shadowed_by_global: true)
|
||||||
|
settings.refresh!
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should return default cause nothing is set" do
|
||||||
|
expect(settings.bool).to eq(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "with global setting" do
|
context "with global setting" do
|
||||||
before do
|
before do
|
||||||
GlobalSetting.stubs(:trout_api_key).returns('purringcat')
|
GlobalSetting.stubs(:trout_api_key).returns('purringcat')
|
||||||
|
|
|
@ -6,21 +6,20 @@ describe UserNotifications do
|
||||||
|
|
||||||
describe "#get_context_posts" do
|
describe "#get_context_posts" do
|
||||||
it "does not include hidden/deleted/user_deleted posts in context" do
|
it "does not include hidden/deleted/user_deleted posts in context" do
|
||||||
post = create_post
|
post1 = create_post
|
||||||
reply1 = create_post(topic: post.topic)
|
post2 = Fabricate(:post, topic: post1.topic, deleted_at: 1.day.ago)
|
||||||
reply2 = create_post(topic: post.topic)
|
post3 = Fabricate(:post, topic: post1.topic, user_deleted: true)
|
||||||
reply3 = create_post(topic: post.topic)
|
post4 = Fabricate(:post, topic: post1.topic, hidden: true)
|
||||||
reply4 = create_post(topic: post.topic)
|
post5 = Fabricate(:post, topic: post1.topic, post_type: Post.types[:moderator_action])
|
||||||
|
post6 = Fabricate(:post, topic: post1.topic, post_type: Post.types[:small_action])
|
||||||
|
post7 = Fabricate(:post, topic: post1.topic, post_type: Post.types[:whisper])
|
||||||
|
last = Fabricate(:post, topic: post1.topic)
|
||||||
|
|
||||||
reply1.trash!
|
# default is only post #1
|
||||||
|
expect(UserNotifications.get_context_posts(last, nil).count).to eq(1)
|
||||||
reply2.user_deleted = true
|
# staff members can also see the whisper
|
||||||
reply2.save
|
tu = TopicUser.new(topic: post1.topic, user: build(:moderator))
|
||||||
|
expect(UserNotifications.get_context_posts(last, tu).count).to eq(2)
|
||||||
reply3.hidden = true
|
|
||||||
reply3.save
|
|
||||||
|
|
||||||
expect(UserNotifications.get_context_posts(reply4, nil).count).to eq(1)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Reference in a new issue