~singpolyma/sgx-jmp

257d02635972758ee35b4e9beeabd67f6b61bdd4 — Stephen Paul Weber 1 year, 24 days ago b9c4c2c
Only count billable messages

Not typing indicators, etc.
1 files changed, 5 insertions(+), 1 deletions(-)

M sgx_jmp.rb
M sgx_jmp.rb => sgx_jmp.rb +5 -1
@@ 167,6 167,10 @@ end
# Especially if we have the component join MUC for notifications
message(to: /\A#{CONFIG[:component][:jid]}\Z/) {}

def billable_message(m)
	!m.body.empty? || m.find("ns:x", ns: OOB.registered_ns).first
end

message do |m|
	sentry_hub = new_sentry_hub(m, name: "message")
	today = Time.now.utc.to_date


@@ 177,7 181,7 @@ message do |m|
		)
		EMPromise.all([
			customer,
			customer.incr_message_usage,
			(customer.incr_message_usage if billable_message(m)),
			REDIS.exists("jmp_usage_notify-#{customer.customer_id}"),
			customer.stanza_from(m)
		])