feed improvements: in progress
This commit is contained in:
parent
9e73646f91
commit
d29fb8f39a
|
@ -18,7 +18,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
helper_method :get_owner
|
helper_method :get_owner
|
||||||
|
|
||||||
unless Rails.env.development?
|
unless false#Rails.env.development?
|
||||||
rescue_from Exception, with: :render_500
|
rescue_from Exception, with: :render_500
|
||||||
rescue_from ActiveRecord::RecordNotFound,
|
rescue_from ActiveRecord::RecordNotFound,
|
||||||
# ActionController::RoutingError, # see: config/routes.rb:<last line>
|
# ActionController::RoutingError, # see: config/routes.rb:<last line>
|
||||||
|
|
|
@ -9,6 +9,8 @@ class HomeController < ApplicationController
|
||||||
@filter = t('feed_menu').has_key?(params[:filter].try(:to_sym)) ? params[:filter].to_sym : :all
|
@filter = t('feed_menu').has_key?(params[:filter].try(:to_sym)) ? params[:filter].to_sym : :all
|
||||||
@activity_feeds = current_user.activity_feeds
|
@activity_feeds = current_user.activity_feeds
|
||||||
@activity_feeds = @activity_feeds.where(kind: "ActivityFeed::#{@filter.upcase}".constantize) unless @filter == :all
|
@activity_feeds = @activity_feeds.where(kind: "ActivityFeed::#{@filter.upcase}".constantize) unless @filter == :all
|
||||||
|
@activity_feeds = @activity_feeds.where(user_id: current_user) if @own_filter == :created
|
||||||
|
@activity_feeds = @activity_feeds.where.not(user_id: current_user) if @own_filter == :not_created
|
||||||
@activity_feeds = @activity_feeds.paginate page: current_page
|
@activity_feeds = @activity_feeds.paginate page: current_page
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
@ -20,7 +20,7 @@ module Feed::BuildList
|
||||||
)
|
)
|
||||||
|
|
||||||
updater = publisher || user
|
updater = publisher || user
|
||||||
(project.admins | [publisher].compact).each do |recipient|
|
(project.all_members | [publisher].compact).each do |recipient|
|
||||||
ActivityFeed.create(
|
ActivityFeed.create(
|
||||||
user: recipient,
|
user: recipient,
|
||||||
kind: 'build_list_notification',
|
kind: 'build_list_notification',
|
||||||
|
|
|
@ -14,7 +14,7 @@ module Feed::Comment
|
||||||
|
|
||||||
if issue_comment?
|
if issue_comment?
|
||||||
commentable.subscribes.each do |subscribe|
|
commentable.subscribes.each do |subscribe|
|
||||||
if user_id != subscribe.user_id && can_notify_on_new_comment?(subscribe)
|
if user_id == subscribe.user_id || can_notify_on_new_comment?(subscribe)
|
||||||
UserMailer.new_comment_notification(self, subscribe.user_id).deliver
|
UserMailer.new_comment_notification(self, subscribe.user_id).deliver
|
||||||
ActivityFeed.create(
|
ActivityFeed.create(
|
||||||
{
|
{
|
||||||
|
@ -38,8 +38,8 @@ module Feed::Comment
|
||||||
end
|
end
|
||||||
elsif commit_comment?
|
elsif commit_comment?
|
||||||
Subscribe.comment_subscribes(self).where(status: true).each do |subscribe|
|
Subscribe.comment_subscribes(self).where(status: true).each do |subscribe|
|
||||||
next if !subscribe.user_id || own_comment?(subscribe.user)
|
next if !subscribe.user_id
|
||||||
if subscribe.user.notifier.can_notify &&
|
if subscribe.user.notifier.can_notify && !own_comment?(subscribe.user)
|
||||||
( (subscribe.project.owner?(subscribe.user) && subscribe.user.notifier.new_comment_commit_repo_owner) ||
|
( (subscribe.project.owner?(subscribe.user) && subscribe.user.notifier.new_comment_commit_repo_owner) ||
|
||||||
(subscribe.user.commentor?(self.commentable) && subscribe.user.notifier.new_comment_commit_commentor) ||
|
(subscribe.user.commentor?(self.commentable) && subscribe.user.notifier.new_comment_commit_commentor) ||
|
||||||
(subscribe.user.committer?(self.commentable) && subscribe.user.notifier.new_comment_commit_owner) )
|
(subscribe.user.committer?(self.commentable) && subscribe.user.notifier.new_comment_commit_owner) )
|
||||||
|
|
|
@ -47,12 +47,12 @@ module Feed::Git
|
||||||
options.merge!({user_id: record.user.id, user_name: record.user.name, user_email: record.user.email}) if record.user
|
options.merge!({user_id: record.user.id, user_name: record.user.name, user_email: record.user.email}) if record.user
|
||||||
|
|
||||||
record.project.admins.each do |recipient|
|
record.project.admins.each do |recipient|
|
||||||
next if record.user && record.user.id == recipient.id
|
|
||||||
ActivityFeed.create!(
|
ActivityFeed.create!(
|
||||||
user: recipient,
|
user: recipient,
|
||||||
kind: kind,
|
kind: kind,
|
||||||
data: options
|
data: options
|
||||||
)
|
)
|
||||||
|
next if record.user && record.user.id == recipient.id
|
||||||
if recipient.notifier.can_notify && recipient.notifier.update_code
|
if recipient.notifier.can_notify && recipient.notifier.update_code
|
||||||
UserMailer.send(kind, recipient, options).deliver
|
UserMailer.send(kind, recipient, options).deliver
|
||||||
end
|
end
|
||||||
|
@ -63,8 +63,6 @@ module Feed::Git
|
||||||
project = Project.find record[:project_id]
|
project = Project.find record[:project_id]
|
||||||
|
|
||||||
project.admins.each do |recipient|
|
project.admins.each do |recipient|
|
||||||
next if actor && actor.id == recipient.id
|
|
||||||
|
|
||||||
ActivityFeed.create!(
|
ActivityFeed.create!(
|
||||||
user: recipient,
|
user: recipient,
|
||||||
kind: 'wiki_new_commit_notification',
|
kind: 'wiki_new_commit_notification',
|
||||||
|
|
|
@ -15,8 +15,8 @@ module Feed::Issue
|
||||||
|
|
||||||
def new_issue_notifications
|
def new_issue_notifications
|
||||||
collect_recipients.each do |recipient|
|
collect_recipients.each do |recipient|
|
||||||
next if user_id == recipient.id
|
if user_id != recipient.id && recipient.notifier.can_notify &&
|
||||||
if recipient.notifier.can_notify && recipient.notifier.new_issue && assignee_id != recipient.id
|
recipient.notifier.new_issue && assignee_id != recipient.id
|
||||||
UserMailer.new_issue_notification(id, recipient.id).deliver
|
UserMailer.new_issue_notification(id, recipient.id).deliver
|
||||||
end
|
end
|
||||||
ActivityFeed.create(
|
ActivityFeed.create(
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
hr.offset10
|
||||||
|
h3=t('layout.relations.filters')
|
||||||
|
|
||||||
|
input.form-control[ name = 'search'
|
||||||
|
size = 30
|
||||||
|
type = 'text'
|
||||||
|
ng-model = 'search'
|
||||||
|
placeholder = t('layout.find_project')
|
||||||
|
ng-change = 'filterProjects()' ]
|
||||||
|
|
||||||
|
ul.nav.nav-pills.nav-stacked
|
||||||
|
- options_for_filters(@projects, @groups, @owners).each do |options|
|
||||||
|
li{ 'ng-class' => "{active: #{options[:class_name]}_filter_#{options[:id]}_class}" }
|
||||||
|
a{ href: '#', 'ng-click' => "change_#{options[:class_name]}_filter(#{options[:id]})" }
|
||||||
|
= options[:uname]
|
|
@ -1,29 +1,29 @@
|
||||||
%p
|
p
|
||||||
= link_to t('layout.activity_feed.new_project'), new_project_path,
|
= link_to t('layout.activity_feed.new_project'), new_project_path,
|
||||||
class: 'btn btn-primary btn-small', role: 'button'
|
class: 'btn btn-primary btn-small', role: 'button'
|
||||||
%hr
|
hr
|
||||||
%h5= t('layout.activity_feed.my_last_projects')
|
h5= t('layout.activity_feed.my_last_projects')
|
||||||
|
|
||||||
%ul.nav.nav-pills.nav-stacked
|
ul.nav.nav-pills.nav-stacked
|
||||||
- current_user.projects.order(updated_at: :desc).limit(5).each do |project|
|
- current_user.projects.order(updated_at: :desc).limit(5).each do |project|
|
||||||
%li
|
li
|
||||||
= link_to project_path(project) do
|
= link_to project_path(project) do
|
||||||
= fa_visibility_icon project
|
= fa_visibility_icon project
|
||||||
= project.name_with_owner
|
= project.name_with_owner
|
||||||
%li
|
li
|
||||||
= link_to t('layout.activity_feed.all_my_projects'), projects_path
|
= link_to t('layout.activity_feed.all_my_projects'), projects_path
|
||||||
|
|
||||||
%hr
|
hr
|
||||||
- midnight = Time.now.utc.to_date
|
- midnight = Time.now.utc.to_date
|
||||||
%h5= t 'layout.activity_feed.my_builds_by_day'
|
h5= t 'layout.activity_feed.my_builds_by_day'
|
||||||
%ul.nav.nav-pills.nav-stacked
|
ul.nav.nav-pills.nav-stacked
|
||||||
- ['BuildList::BUILD_PUBLISHED', 'BuildList::SUCCESS', 'BuildList::BUILD_STARTED',
|
- ['BuildList::BUILD_PUBLISHED', 'BuildList::SUCCESS', 'BuildList::BUILD_STARTED',
|
||||||
'BuildList::BUILD_PENDING', 'BuildList::BUILD_ERROR'].each do |state|
|
'BuildList::BUILD_PENDING', 'BuildList::BUILD_ERROR'].each do |state|
|
||||||
%li
|
li
|
||||||
%a{ href: build_lists_path(filter: {status: state.constantize, 'updated_at_start(1i)' => midnight.year,
|
a[ href = build_lists_path(filter: {status: state.constantize, 'updated_at_start(1i)' => midnight.year,
|
||||||
'updated_at_start(2i)' => midnight.month, 'updated_at_start(3i)' => midnight.day}) }
|
'updated_at_start(2i)' => midnight.month, 'updated_at_start(3i)' => midnight.day}) ]
|
||||||
%span.badge.pull-right
|
span.badge.pull-right
|
||||||
= BuildList.for_status(state.constantize).for_user(current_user).for_notified_date_period(midnight, nil).count
|
= BuildList.for_status(state.constantize).for_user(current_user).for_notified_date_period(midnight, nil).count
|
||||||
= t "layout.build_lists.statuses.#{state.demodulize.downcase}"
|
= t "layout.build_lists.statuses.#{state.demodulize.downcase}"
|
||||||
%li
|
li
|
||||||
%a{ href: build_lists_path }=t 'layout.activity_feed.all_my_builds'
|
a[ href = build_lists_path ]=t 'layout.activity_feed.all_my_builds'
|
|
@ -1,6 +1,6 @@
|
||||||
en:
|
en:
|
||||||
layout:
|
layout:
|
||||||
activity_feed:
|
activity_feed:
|
||||||
header: Activity Feed
|
header: Activity Feed
|
||||||
my_last_projects: My last projects
|
my_last_projects: My last projects
|
||||||
all_my_projects: All my projects
|
all_my_projects: All my projects
|
||||||
|
@ -9,6 +9,10 @@ en:
|
||||||
new_project: Create project
|
new_project: Create project
|
||||||
load_messages: show previous messages
|
load_messages: show previous messages
|
||||||
atom_title: Activity Feed
|
atom_title: Activity Feed
|
||||||
|
filters:
|
||||||
|
all: All
|
||||||
|
my: Mine
|
||||||
|
others: Others
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
subjects:
|
subjects:
|
||||||
|
@ -24,12 +28,12 @@ en:
|
||||||
|
|
||||||
bodies:
|
bodies:
|
||||||
view_it_on: View it on
|
view_it_on: View it on
|
||||||
new_comment_notification:
|
new_comment_notification:
|
||||||
title: '%{user_link} added a new comment'
|
title: '%{user_link} added a new comment'
|
||||||
content: in issue %{issue_link}
|
content: in issue %{issue_link}
|
||||||
commit_content: in commit %{commit_link}
|
commit_content: in commit %{commit_link}
|
||||||
new_issue_notification: '%{user_link} added a new <a href="%{issue_link}">issue</a>'
|
new_issue_notification: '%{user_link} added a new <a href="%{issue_link}">issue</a>'
|
||||||
new_user_notification:
|
new_user_notification:
|
||||||
title: Hello, %{user_name}.
|
title: Hello, %{user_name}.
|
||||||
content: You have registered in project «ROSA ABF» and now you can sign in.
|
content: You have registered in project «ROSA ABF» and now you can sign in.
|
||||||
email: ==Your email %{user_email}
|
email: ==Your email %{user_email}
|
||||||
|
|
|
@ -9,6 +9,10 @@ ru:
|
||||||
new_project: Создать проект
|
new_project: Создать проект
|
||||||
load_messages: показать предыдущие сообщения
|
load_messages: показать предыдущие сообщения
|
||||||
atom_title: Лента активности
|
atom_title: Лента активности
|
||||||
|
filters:
|
||||||
|
all: Вся
|
||||||
|
my: Моя
|
||||||
|
others: Чужая
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
subjects:
|
subjects:
|
||||||
|
|
Loading…
Reference in New Issue