New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
notification #607
notification #607
Conversation
@career_member = Career::MemberMutator.create(resource_career, career_member_params) | ||
if @career_member.persisted? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а это как связано с уведомлениями?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Уведомление с kind: new_career_member создается когда создается новый career_member то есть назначается карерный трек
td = notification.aasm(:state).human_state | ||
td = l notification.created_at, format: :short | ||
td | ||
.text-center |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в соседнем ПРе решили что текст центр это не очень для кнопок
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не хватает БОЛЬШОЙ ОГРОМНОЙ КНОПКНИ ОТМЕТИТЬ ВСЕ УВЕДОМЛЕНИЯ КАК ПРОЧИТАННЫЕ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Вроде выглядит всё ок.
Для приличия оставил небольшой коммент по именованию )
app/presenters/user_presenter.rb
Outdated
@@ -7,5 +7,9 @@ def full_name | |||
"#{first_name} #{last_name}" | |||
end | |||
|
|||
def unread_notifications? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
я бы в название добавил has
has_unread_nifications?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
рубокоп будет ругаться - типа в рельсе так не принято методы делать has_ и is_. так что тут норм
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Про is знаю что не юзаем, а вот про has не знал.
Смотрел по аналогии как у нас сделано, а там мы используем has_ в названиях.
Например:
https://github.com/Hexlet/hexlet/blob/ab6a7cae6338b48a257c0bcbf88869020d85be8f/app/controllers/concerns/redirect_back_concern.rb#L8
https://github.com/Hexlet/hexlet/blob/ab6a7cae6338b48a257c0bcbf88869020d85be8f/app/models/lesson.rb#L254
и много где есть в принципе
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ага ты прав, чет мне приведлось значит
app/presenters/user_presenter.rb
Outdated
@@ -7,5 +7,9 @@ def full_name | |||
"#{first_name} #{last_name}" | |||
end | |||
|
|||
def unread_notifications? | |||
notifications.unread.any? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
но мы обычно не пишем такие методы а добавляем связь
has_many :unread_notifications, -> { unread }, class_name: 'Notification', inverse_of..., dependent...
и потом где нужно просто его дергаем current_user.unread_notifications.any?
490d3d3
to
a9cabfc
Compare
Поправил работу уведомлений