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
|
||||
|
||||
unless Rails.env.development?
|
||||
unless false#Rails.env.development?
|
||||
rescue_from Exception, with: :render_500
|
||||
rescue_from ActiveRecord::RecordNotFound,
|
||||
# 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
|
||||
@activity_feeds = current_user.activity_feeds
|
||||
@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
|
||||
|
||||
respond_to do |format|
|
||||
|
|
|
@ -20,7 +20,7 @@ module Feed::BuildList
|
|||
)
|
||||
|
||||
updater = publisher || user
|
||||
(project.admins | [publisher].compact).each do |recipient|
|
||||
(project.all_members | [publisher].compact).each do |recipient|
|
||||
ActivityFeed.create(
|
||||
user: recipient,
|
||||
kind: 'build_list_notification',
|
||||
|
|
|
@ -14,7 +14,7 @@ module Feed::Comment
|
|||
|
||||
if issue_comment?
|
||||
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
|
||||
ActivityFeed.create(
|
||||
{
|
||||
|
@ -38,8 +38,8 @@ module Feed::Comment
|
|||
end
|
||||
elsif commit_comment?
|
||||
Subscribe.comment_subscribes(self).where(status: true).each do |subscribe|
|
||||
next if !subscribe.user_id || own_comment?(subscribe.user)
|
||||
if subscribe.user.notifier.can_notify &&
|
||||
next if !subscribe.user_id
|
||||
if subscribe.user.notifier.can_notify && !own_comment?(subscribe.user)
|
||||
( (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.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
|
||||
|
||||
record.project.admins.each do |recipient|
|
||||
next if record.user && record.user.id == recipient.id
|
||||
ActivityFeed.create!(
|
||||
user: recipient,
|
||||
kind: kind,
|
||||
data: options
|
||||
)
|
||||
next if record.user && record.user.id == recipient.id
|
||||
if recipient.notifier.can_notify && recipient.notifier.update_code
|
||||
UserMailer.send(kind, recipient, options).deliver
|
||||
end
|
||||
|
@ -63,8 +63,6 @@ module Feed::Git
|
|||
project = Project.find record[:project_id]
|
||||
|
||||
project.admins.each do |recipient|
|
||||
next if actor && actor.id == recipient.id
|
||||
|
||||
ActivityFeed.create!(
|
||||
user: recipient,
|
||||
kind: 'wiki_new_commit_notification',
|
||||
|
|
|
@ -15,8 +15,8 @@ module Feed::Issue
|
|||
|
||||
def new_issue_notifications
|
||||
collect_recipients.each do |recipient|
|
||||
next if user_id == recipient.id
|
||||
if recipient.notifier.can_notify && recipient.notifier.new_issue && assignee_id != recipient.id
|
||||
if user_id != recipient.id && recipient.notifier.can_notify &&
|
||||
recipient.notifier.new_issue && assignee_id != recipient.id
|
||||
UserMailer.new_issue_notification(id, recipient.id).deliver
|
||||
end
|
||||
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,
|
||||
class: 'btn btn-primary btn-small', role: 'button'
|
||||
%hr
|
||||
%h5= t('layout.activity_feed.my_last_projects')
|
||||
hr
|
||||
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|
|
||||
%li
|
||||
li
|
||||
= link_to project_path(project) do
|
||||
= fa_visibility_icon project
|
||||
= project.name_with_owner
|
||||
%li
|
||||
li
|
||||
= link_to t('layout.activity_feed.all_my_projects'), projects_path
|
||||
|
||||
%hr
|
||||
hr
|
||||
- midnight = Time.now.utc.to_date
|
||||
%h5= t 'layout.activity_feed.my_builds_by_day'
|
||||
%ul.nav.nav-pills.nav-stacked
|
||||
h5= t 'layout.activity_feed.my_builds_by_day'
|
||||
ul.nav.nav-pills.nav-stacked
|
||||
- ['BuildList::BUILD_PUBLISHED', 'BuildList::SUCCESS', 'BuildList::BUILD_STARTED',
|
||||
'BuildList::BUILD_PENDING', 'BuildList::BUILD_ERROR'].each do |state|
|
||||
%li
|
||||
%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}) }
|
||||
%span.badge.pull-right
|
||||
li
|
||||
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}) ]
|
||||
span.badge.pull-right
|
||||
= BuildList.for_status(state.constantize).for_user(current_user).for_notified_date_period(midnight, nil).count
|
||||
= t "layout.build_lists.statuses.#{state.demodulize.downcase}"
|
||||
%li
|
||||
%a{ href: build_lists_path }=t 'layout.activity_feed.all_my_builds'
|
||||
li
|
||||
a[ href = build_lists_path ]=t 'layout.activity_feed.all_my_builds'
|
|
@ -9,6 +9,10 @@ en:
|
|||
new_project: Create project
|
||||
load_messages: show previous messages
|
||||
atom_title: Activity Feed
|
||||
filters:
|
||||
all: All
|
||||
my: Mine
|
||||
others: Others
|
||||
|
||||
notifications:
|
||||
subjects:
|
||||
|
|
|
@ -9,6 +9,10 @@ ru:
|
|||
new_project: Создать проект
|
||||
load_messages: показать предыдущие сообщения
|
||||
atom_title: Лента активности
|
||||
filters:
|
||||
all: Вся
|
||||
my: Моя
|
||||
others: Чужая
|
||||
|
||||
notifications:
|
||||
subjects:
|
||||
|
|
Loading…
Reference in New Issue