code climate
This commit is contained in:
parent
95671010eb
commit
4324ba31c5
7 changed files with 20 additions and 17 deletions
|
@ -38,7 +38,9 @@ class AccessController < ApplicationController
|
|||
# who we then send an email to
|
||||
user = User.find(user_id)
|
||||
mail = MapMailer.invite_to_edit_email(@map, current_user, user)
|
||||
user.notify(mail.subject, 'invite to edit', UserMap.find_by(user: user, map: @map), true, MAILBOXER_CODE_INVITED_TO_EDIT)
|
||||
user.notify(mail.subject, 'invite to edit',
|
||||
UserMap.find_by(user: user, map: @map),
|
||||
true, MAILBOXER_CODE_INVITED_TO_EDIT)
|
||||
end
|
||||
@map.remove_old_collaborators(user_ids)
|
||||
|
||||
|
|
|
@ -95,6 +95,8 @@ class UsersController < ApplicationController
|
|||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:name, :email, :image, :password, :password_confirmation, :emails_allowed)
|
||||
params.require(:user).permit(
|
||||
:name, :email, :image, :password, :password_confirmation, :emails_allowed
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,7 @@ module ApplicationHelper
|
|||
|
||||
def user_unread_notification_count
|
||||
return 0 if current_user.nil?
|
||||
@user_unread_notification_count ||= current_user.mailboxer_notification_receipts.reduce(0) do |total, receipt|
|
||||
@uunc ||= current_user.mailboxer_notification_receipts.reduce(0) do |total, receipt|
|
||||
receipt.is_read ? total : total + 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,10 +7,10 @@ class AccessRequest < ApplicationRecord
|
|||
self.answered = true
|
||||
self.save
|
||||
|
||||
Mailboxer::Notification.where(notified_object: self).each do |notification|
|
||||
Mailboxer::Notification.where(notified_object: self).find_each do |notification|
|
||||
Mailboxer::Receipt.where(notification: notification).update_all(is_read: true)
|
||||
end
|
||||
|
||||
|
||||
user_map = UserMap.create(user: user, map: map)
|
||||
mail = MapMailer.invite_to_edit_email(map, map.user, user)
|
||||
user.notify(mail.subject, 'invite to edit', user_map, true, MAILBOXER_CODE_INVITED_TO_EDIT)
|
||||
|
@ -21,7 +21,7 @@ class AccessRequest < ApplicationRecord
|
|||
self.answered = true
|
||||
self.save
|
||||
|
||||
Mailboxer::Notification.where(notified_object: self).each do |notification|
|
||||
Mailboxer::Notification.where(notified_object: self).find_each do |notification|
|
||||
Mailboxer::Receipt.where(notification: notification).update_all(is_read: true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ class UserMap < ApplicationRecord
|
|||
belongs_to :user
|
||||
|
||||
def mark_invite_notifications_as_read
|
||||
Mailboxer::Notification.where(notified_object: self).each do |notification|
|
||||
Mailboxer::Notification.where(notified_object: self).find_each do |notification|
|
||||
Mailboxer::Receipt.where(notification: notification).update_all(is_read: true)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ import NotificationIconComponent from '../../components/NotificationIcon'
|
|||
|
||||
const NotificationIcon = {
|
||||
unreadNotificationsCount: null,
|
||||
|
||||
|
||||
init: function(serverData) {
|
||||
const self = NotificationIcon
|
||||
self.unreadNotificationsCount = serverData.unreadNotificationsCount
|
||||
|
@ -18,7 +18,7 @@ const NotificationIcon = {
|
|||
if (newUnreadCount !== null) {
|
||||
NotificationIcon.unreadNotificationsCount = newUnreadCount
|
||||
}
|
||||
|
||||
|
||||
if (Active.Mapper !== null) {
|
||||
ReactDOM.render(React.createElement(NotificationIconComponent, {
|
||||
unreadNotificationsCount: NotificationIcon.unreadNotificationsCount
|
||||
|
@ -27,4 +27,4 @@ const NotificationIcon = {
|
|||
}
|
||||
}
|
||||
|
||||
export default NotificationIcon
|
||||
export default NotificationIcon
|
||||
|
|
|
@ -9,14 +9,14 @@ class NotificationIcon extends Component {
|
|||
}
|
||||
|
||||
render = () => {
|
||||
var linkClasses = "notificationsIcon upperRightEl upperRightIcon "
|
||||
|
||||
let linkClasses = 'notificationsIcon upperRightEl upperRightIcon '
|
||||
|
||||
if (this.props.unreadNotificationsCount > 0) {
|
||||
linkClasses += "unread"
|
||||
linkClasses += 'unread'
|
||||
} else {
|
||||
linkClasses += "read"
|
||||
linkClasses += 'read'
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<a className={linkClasses} href="/notifications">
|
||||
<div className="tooltipsUnder">
|
||||
|
@ -26,8 +26,7 @@ class NotificationIcon extends Component {
|
|||
<div className="unread-notifications-dot"></div>
|
||||
)}
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue