1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

bug fixes

- [bug] credits not reset on new plan subscription
- [bug] admin notification (user merged his account) never sent
This commit is contained in:
Sylvain 2016-03-30 15:37:33 +02:00
parent d83e44d26f
commit 232bdbd102
3 changed files with 6 additions and 4 deletions

View File

@ -19,6 +19,7 @@
<span class="btn btn-default btn-file"
ng-click="user.profile.user_avatar._destory = false"
ng-hide="preventField['profile.avatar'] && user.profile.user_avatar.attachment_url && !userForm['user[profile_attributes][user_avatar_attributes]'].$dirty">
<!-- FIXME: still able to add an avatar if none is present when SSO is activated -->
<span class="fileinput-new" translate>{{ 'add_an_avatar' }}</span>
<span class="fileinput-exists" translate>{{ 'change' }}</span>
<input type="file" name="user[profile_attributes][user_avatar_attributes][attachment]">

View File

@ -29,7 +29,7 @@ class Subscription < ActiveRecord::Base
reset_users_credits if expired_date_changed
# generate directement invoice
# generate invoice
stp_invoice = Stripe::Invoice.all(customer: user.stp_customer_id, limit: 1).data.first
generate_invoice(stp_invoice.id).save if invoice
# cancel subscription after create
@ -209,8 +209,9 @@ class Subscription < ActiveRecord::Base
end
def expired_date_changed
return true if expired_at_was.nil?
expired_at_was.to_date != expired_at.to_date and expired_at > expired_at_was
p_value = self.previous_changes[:expired_at][0]
return true if p_value.nil?
p_value.to_date != expired_at.to_date and expired_at > p_value
end
def reset_users_credits

View File

@ -2,7 +2,7 @@ json.title notification.notification_type
json.description _t('.user_NAME_has_merged_his_account_with_the_one_imported_from_PROVIDER_(UID)_html',
{
NAME: notification.attached_object.profile.full_name,
GENDER: notification.attached_object.profile.gender,
GENDER: bool_to_sym(notification.attached_object.profile.gender),
PROVIDER: notification.attached_object.provider,
UID: notification.attached_object.uid
}) # messageFormat