From d9c3f9ddc8b7d8a53a441f934b9122759aa8dbb4 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 14 Mar 2012 20:33:16 +0600 Subject: [PATCH 1/7] [refs #265] fixed comment to commit feed --- app/models/activity_feed_observer.rb | 7 ++++++- app/models/subscribe.rb | 5 +---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/models/activity_feed_observer.rb b/app/models/activity_feed_observer.rb index bd245fba4..255152bef 100644 --- a/app/models/activity_feed_observer.rb +++ b/app/models/activity_feed_observer.rb @@ -51,7 +51,12 @@ class ActivityFeedObserver < ActiveRecord::Observer subscribes = Subscribe.comment_subscribes(record).where(:status => true) subscribes.each do |subscribe| next if record.own_comment?(subscribe.user) - UserMailer.delay.new_comment_notification(record, subscribe.user) if subscribe.user.notifier.can_notify + if subscribe.user.notifier.can_notify and + ( (subscribe.project.owner?(subscribe.user) && subscribe.user.notifier.new_comment_commit_repo_owner) or + (subscribe.user.commentor?(record.commentable) && subscribe.user.notifier.new_comment_commit_commentor) or + (subscribe.user.committer?(record.commentable) && subscribe.user.notifier.new_comment_commit_owner) ) + UserMailer.delay.new_comment_notification(record, subscribe.user) + end ActivityFeed.create( :user => subscribe.user, :kind => 'new_comment_commit_notification', diff --git a/app/models/subscribe.rb b/app/models/subscribe.rb index 0ed6e71df..dfd8965e0 100644 --- a/app/models/subscribe.rb +++ b/app/models/subscribe.rb @@ -21,10 +21,7 @@ class Subscribe < ActiveRecord::Base def self.subscribed_to_commit?(project, user, commit) subscribe = user.subscribes.where(:subscribeable_id => commit.id.hex, :subscribeable_type => commit.class.name, :project_id => project.id).first return subscribe.subscribed? if subscribe # return status if already subscribe present - # return status by settings - (project.owner?(user) && user.notifier.new_comment_commit_repo_owner) or - (user.commentor?(commit) && user.notifier.new_comment_commit_commentor) or - (user.committer?(commit) && user.notifier.new_comment_commit_owner) + true end def self.subscribe_to_commit(options) From ffc1c6d0b770b0650411ff67d4bf0ee9a5175ecc Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 14 Mar 2012 20:33:51 +0600 Subject: [PATCH 2/7] [refs #265] fixed new issue feed --- app/views/activity_feeds/partials/_new_issue_notification.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/activity_feeds/partials/_new_issue_notification.haml b/app/views/activity_feeds/partials/_new_issue_notification.haml index 8a002ebe6..c96ce3ed0 100644 --- a/app/views/activity_feeds/partials/_new_issue_notification.haml +++ b/app/views/activity_feeds/partials/_new_issue_notification.haml @@ -3,7 +3,7 @@ = image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar') .text %span - = raw t("notifications.bodies.new_issue_notification", { :user_link => link_to(activity_feed.user.uname, user_path(activity_feed.user.uname))}) + = raw t("notifications.bodies.new_issue_notification", { :user_link => link_to(user_name, user_path(user_id))}) = raw t("notifications.bodies.project", :project_link => link_to(project_name, project_path(project_id))) .both %span.date= activity_feed.created_at From 20079d4fc588035fb8abcb118bdcf8395a4c775e Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 14 Mar 2012 20:40:41 +0600 Subject: [PATCH 3/7] [refs #265] changed comments feed --- app/models/activity_feed_observer.rb | 10 ++++++---- .../partials/_new_comment_commit_notification.haml | 1 + .../partials/_new_comment_notification.haml | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/models/activity_feed_observer.rb b/app/models/activity_feed_observer.rb index 255152bef..d4116bebf 100644 --- a/app/models/activity_feed_observer.rb +++ b/app/models/activity_feed_observer.rb @@ -42,8 +42,9 @@ class ActivityFeedObserver < ActiveRecord::Observer ActivityFeed.create( :user => subscribe.user, :kind => 'new_comment_notification', - :data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :comment_body => record.body, :issue_title => record.commentable.title, - :issue_serial_id => record.commentable.serial_id, :project_id => record.commentable.project.id, :comment_id => record.id} + :data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :comment_body => record.body, + :issue_title => record.commentable.title, :issue_serial_id => record.commentable.serial_id, :project_id => record.commentable.project.id, + :comment_id => record.id, :project_name => record.project.name} ) end end @@ -60,8 +61,9 @@ class ActivityFeedObserver < ActiveRecord::Observer ActivityFeed.create( :user => subscribe.user, :kind => 'new_comment_commit_notification', - :data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :comment_body => record.body, :commit_message => record.commentable.message.encode_to_default, - :commit_id => record.commentable.id, :project_id => record.project.id, :comment_id => record.id} + :data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :comment_body => record.body, + :commit_message => record.commentable.message.encode_to_default, :commit_id => record.commentable.id, + :project_id => record.project.id, :comment_id => record.id, :project_name => record.project.name} ) end end diff --git a/app/views/activity_feeds/partials/_new_comment_commit_notification.haml b/app/views/activity_feeds/partials/_new_comment_commit_notification.haml index b72ab2b38..cf86342b8 100644 --- a/app/views/activity_feeds/partials/_new_comment_commit_notification.haml +++ b/app/views/activity_feeds/partials/_new_comment_commit_notification.haml @@ -5,6 +5,7 @@ %span = raw t("notifications.bodies.new_comment_notification.title", :user_link => link_to(user_name, user_path(user_id)) ) = raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_id, commit_id))}) + = raw t("notifications.bodies.project", :project_link => link_to(project_name, project_path(project_id))) if defined?(project_name) .both %span.date= activity_feed.created_at .both diff --git a/app/views/activity_feeds/partials/_new_comment_notification.haml b/app/views/activity_feeds/partials/_new_comment_notification.haml index 7ea321ee6..972d52fdd 100644 --- a/app/views/activity_feeds/partials/_new_comment_notification.haml +++ b/app/views/activity_feeds/partials/_new_comment_notification.haml @@ -5,6 +5,7 @@ %span = raw t("notifications.bodies.new_comment_notification.title", {:user_link => link_to(user_name, user_path(user_id))}) = raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id))}) + = raw t("notifications.bodies.project", :project_link => link_to(project_name, project_path(project_id))) if defined?(project_name) .both %span.date= activity_feed.created_at .both From f11fc179d3bf73e4cc34b92690a8c0a0c89d9ccd Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 14 Mar 2012 21:50:58 +0600 Subject: [PATCH 4/7] [refs #194] fixed executor bug --- app/views/issues/_manage_sidebar.html.haml | 4 ++-- app/views/issues/show.html.haml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/issues/_manage_sidebar.html.haml b/app/views/issues/_manage_sidebar.html.haml index bd70ac04c..17a8ce1be 100644 --- a/app/views/issues/_manage_sidebar.html.haml +++ b/app/views/issues/_manage_sidebar.html.haml @@ -1,5 +1,5 @@ -content_for :sidebar do - - can_manage = can? :write, @issue.project + - can_manage = can?(:update, @issue) && @issue.persisted? || can?(:create, @project.issues.new) && @issue.new_record? - if @issue.persisted? .bordered.nopadding %h3=t('activerecord.attributes.issue.status') @@ -21,7 +21,7 @@ .name="#{@issue.user.uname} (#{@issue.user.name})" =hidden_field_tag "user-0", @issue.user.id, :name => 'issue[user_id]' .both - - else + - elsif @issue.user .people.nopointer .avatar=image_tag avatar_url(@issue.user), :alt => 'avatar' .name="#{@issue.user.uname} (#{@issue.user.name})" diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index d382b3279..97e39954e 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -16,7 +16,7 @@ .fulltext.view.issue_body=@issue.body .both %br -- if can? :write, @issue.project +- if can? :update, @issue =link_to t('layout.edit'), '#', :id => 'edit_issue_content', :class => 'button' =form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_form issue', :style => 'display:none;' } do |f| .leftlist= t('activerecord.attributes.issue.title') + ':' From 3642163fd771923d32d16ef4e1d8ed7b4ec993c7 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 14 Mar 2012 23:00:26 +0600 Subject: [PATCH 5/7] [refs #265] changed feed messages --- app/controllers/comments_controller.rb | 2 +- app/models/activity_feed_observer.rb | 20 +++++++++++-------- .../_git_delete_branch_notification.haml | 10 ++++++---- .../partials/_git_new_push_notification.haml | 5 ++--- .../partials/_issue_assign_notification.haml | 4 +--- .../_new_comment_commit_notification.haml | 6 +++--- .../partials/_new_comment_notification.haml | 6 +++--- .../partials/_new_issue_notification.haml | 6 +++--- .../_wiki_new_commit_notification.haml | 2 +- config/locales/models/activity_feed.en.yml | 15 +++++++------- config/locales/models/activity_feed.ru.yml | 15 +++++++------- .../20120314151558_truncate_activity_feed.rb | 8 ++++++++ 12 files changed, 56 insertions(+), 43 deletions(-) create mode 100644 db/migrate/20120314151558_truncate_activity_feed.rb diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index ce54bab7e..098167d2e 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -15,8 +15,8 @@ class CommentsController < ApplicationController @comment = @commentable.comments.build(params[:comment]) if @commentable.class == Issue if @commentable.class == Grit::Commit @comment = Comment.new(params[:comment].merge(:commentable_id => @commentable.id.hex, :commentable_type => @commentable.class.name)) - @comment.project = @project end + @comment.project = @project @comment.user_id = current_user.id if @comment.save flash[:notice] = I18n.t("flash.comment.saved") diff --git a/app/models/activity_feed_observer.rb b/app/models/activity_feed_observer.rb index d4116bebf..61f0e160a 100644 --- a/app/models/activity_feed_observer.rb +++ b/app/models/activity_feed_observer.rb @@ -19,7 +19,7 @@ class ActivityFeedObserver < ActiveRecord::Observer :user => recipient, :kind => 'new_issue_notification', :data => {:user_name => record.creator.name, :user_email => record.creator.email, :user_id => record.creator_id,:issue_serial_id => record.serial_id, - :issue_title => record.title, :project_id => record.project.id, :project_name => record.project.name} + :issue_title => record.title, :project_id => record.project.id, :project_name => record.project.name, :project_owner => record.project.owner.uname} ) end @@ -29,7 +29,7 @@ class ActivityFeedObserver < ActiveRecord::Observer :user => record.user, :kind => 'issue_assign_notification', :data => {:user_name => record.creator.name, :user_email => record.creator.email, :user_id => record.creator_id, :issue_serial_id => record.serial_id, - :project_id => record.project.id, :issue_title => record.title, :project_name => record.project.name} + :project_id => record.project.id, :issue_title => record.title, :project_name => record.project.name, :project_owner => record.project.owner.uname} ) end @@ -44,7 +44,7 @@ class ActivityFeedObserver < ActiveRecord::Observer :kind => 'new_comment_notification', :data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :comment_body => record.body, :issue_title => record.commentable.title, :issue_serial_id => record.commentable.serial_id, :project_id => record.commentable.project.id, - :comment_id => record.id, :project_name => record.project.name} + :comment_id => record.id, :project_name => record.project.name, :project_owner => record.project.owner.uname} ) end end @@ -63,7 +63,7 @@ class ActivityFeedObserver < ActiveRecord::Observer :kind => 'new_comment_commit_notification', :data => {:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id, :comment_body => record.body, :commit_message => record.commentable.message.encode_to_default, :commit_id => record.commentable.id, - :project_id => record.project.id, :comment_id => record.id, :project_name => record.project.name} + :project_id => record.project.id, :comment_id => record.id, :project_name => record.project.name, :project_owner => record.project.owner.uname} ) end end @@ -80,11 +80,13 @@ class ActivityFeedObserver < ActiveRecord::Observer if change_type == 'delete' kind = 'git_delete_branch_notification' - options = {:project_id => record.project.id, :project_name => record.project.name, :branch_name => branch_name, :change_type => change_type} + options = {:project_id => record.project.id, :project_name => record.project.name, :branch_name => branch_name, + :change_type => change_type, :project_owner => record.project.owner.uname} else kind = 'git_new_push_notification' options = {:project_id => record.project.id, :project_name => record.project.name, :last_commits => last_commits, :branch_name => branch_name, - :change_type => change_type, :user_email => record.project.git_repository.repo.log(branch_name, nil).first.author.email} + :change_type => change_type, :user_email => record.project.git_repository.repo.log(branch_name, nil).first.author.email, + :project_owner => record.project.owner.uname} options.merge!({:user_id => first_commiter.id, :user_name => first_commiter.name}) if first_commiter end @@ -107,7 +109,8 @@ class ActivityFeedObserver < ActiveRecord::Observer ActivityFeed.create( :user => User.find(recipient),#record.user, :kind => 'wiki_new_commit_notification', - :data => {:user_id => actor.id, :user_name => actor.name, :user_email => actor.email, :project_id => project.id, :project_name => project_name, :commit_sha => commit_sha} + :data => {:user_id => actor.id, :user_name => actor.name, :user_email => actor.email, :project_id => project.id, + :project_name => project_name, :commit_sha => commit_sha, :project_owner => project.owner.uname} ) end end @@ -121,7 +124,8 @@ class ActivityFeedObserver < ActiveRecord::Observer ActivityFeed.create( :user => record.user, :kind => 'issue_assign_notification', - :data => {:user_name => record.user.name, :user_email => record.user.email, :issue_serial_id => record.serial_id, :project_id => record.project.id, :issue_title => record.title} + :data => {:user_name => record.user.name, :user_email => record.user.email, :issue_serial_id => record.serial_id, :issue_title => record.title, + :project_id => record.project.id, :project_name => record.project.name, :project_owner => record.project.owner.uname} ) end end diff --git a/app/views/activity_feeds/partials/_git_delete_branch_notification.haml b/app/views/activity_feeds/partials/_git_delete_branch_notification.haml index 95914ac76..1b5ff12f0 100644 --- a/app/views/activity_feeds/partials/_git_delete_branch_notification.haml +++ b/app/views/activity_feeds/partials/_git_delete_branch_notification.haml @@ -1,6 +1,8 @@ .top - %span= t('notifications.bodies.delete_branch', {:branch_name => branch_name, :project_name => project_name}) - = activity_feed.created_at + .text + %span + = t('notifications.bodies.delete_branch', :branch_name => branch_name) + = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) ) + .both + %span.date= activity_feed.created_at .both -.fulltext - = link_to(project_name, project_path(project_id)) diff --git a/app/views/activity_feeds/partials/_git_new_push_notification.haml b/app/views/activity_feeds/partials/_git_new_push_notification.haml index 9c5aa611a..43948fcb0 100644 --- a/app/views/activity_feeds/partials/_git_new_push_notification.haml +++ b/app/views/activity_feeds/partials/_git_new_push_notification.haml @@ -4,12 +4,11 @@ = image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar') .text %span - = raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name}) - = raw t("notifications.bodies.project", :project_link => link_to(project_name, project_path(project_id))) + = raw t("notifications.bodies.#{change_type}_branch", {:branch_name => branch_name, :user_link => defined?(user_name) ? link_to(user_name, user_path(user_id)) : user_email}) + = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) ) .both %span.date= activity_feed.created_at .both - %br %span.subject - last_commits.each do |commit| = link_to commit[0], commit_path(project_id, commit[0]) diff --git a/app/views/activity_feeds/partials/_issue_assign_notification.haml b/app/views/activity_feeds/partials/_issue_assign_notification.haml index b09eb8c9c..89b44c1fb 100644 --- a/app/views/activity_feeds/partials/_issue_assign_notification.haml +++ b/app/views/activity_feeds/partials/_issue_assign_notification.haml @@ -1,10 +1,8 @@ .top - .image - = image_tag(avatar_url_by_email(activity_feed.user.email, :small), :alt => 'avatar') .text %span = raw t("notifications.bodies.issue_assign_notification", { :issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id))}) - = raw t("notifications.bodies.project", :project_link => link_to(project_name, project_path(project_id))) if defined? project_name + = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) ) .both %span.date= activity_feed.created_at .both diff --git a/app/views/activity_feeds/partials/_new_comment_commit_notification.haml b/app/views/activity_feeds/partials/_new_comment_commit_notification.haml index cf86342b8..3044f396c 100644 --- a/app/views/activity_feeds/partials/_new_comment_commit_notification.haml +++ b/app/views/activity_feeds/partials/_new_comment_commit_notification.haml @@ -4,9 +4,9 @@ .text %span = raw t("notifications.bodies.new_comment_notification.title", :user_link => link_to(user_name, user_path(user_id)) ) - = raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_id, commit_id))}) - = raw t("notifications.bodies.project", :project_link => link_to(project_name, project_path(project_id))) if defined?(project_name) + = raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_id, commit_id) + (defined?(comment_id) ? "#comment##{comment_id}" : ''))}) + = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) ) .both %span.date= activity_feed.created_at .both - %span.subject= link_to comment_body, commit_path(project_id, commit_id) + (defined?(comment_id) ? "#comment##{comment_id}" : '') + %span.subject= comment_body diff --git a/app/views/activity_feeds/partials/_new_comment_notification.haml b/app/views/activity_feeds/partials/_new_comment_notification.haml index 972d52fdd..1c87a8bd9 100644 --- a/app/views/activity_feeds/partials/_new_comment_notification.haml +++ b/app/views/activity_feeds/partials/_new_comment_notification.haml @@ -4,9 +4,9 @@ .text %span = raw t("notifications.bodies.new_comment_notification.title", {:user_link => link_to(user_name, user_path(user_id))}) - = raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id))}) - = raw t("notifications.bodies.project", :project_link => link_to(project_name, project_path(project_id))) if defined?(project_name) + = raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id) + (defined?(comment_id) ? "#comment##{comment_id}" : ''))}) + = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) ) .both %span.date= activity_feed.created_at .both - %span.subject= link_to comment_body, project_issue_path(project_id, issue_serial_id) + (defined?(comment_id) ? "#comment##{comment_id}" : '') + %span.subject= comment_body diff --git a/app/views/activity_feeds/partials/_new_issue_notification.haml b/app/views/activity_feeds/partials/_new_issue_notification.haml index c96ce3ed0..dc82e2961 100644 --- a/app/views/activity_feeds/partials/_new_issue_notification.haml +++ b/app/views/activity_feeds/partials/_new_issue_notification.haml @@ -3,9 +3,9 @@ = image_tag(avatar_url_by_email(user_email, :small), :alt => 'avatar') .text %span - = raw t("notifications.bodies.new_issue_notification", { :user_link => link_to(user_name, user_path(user_id))}) - = raw t("notifications.bodies.project", :project_link => link_to(project_name, project_path(project_id))) + = raw t("notifications.bodies.new_issue_notification", { :user_link => link_to(user_name, user_path(user_id)), :issue_link => project_issue_path(project_id, issue_serial_id)}) + = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) ) .both %span.date= activity_feed.created_at .both - %span.subject= link_to(issue_title, project_issue_path(project_id, issue_serial_id)) + %span.subject= issue_title diff --git a/app/views/activity_feeds/partials/_wiki_new_commit_notification.haml b/app/views/activity_feeds/partials/_wiki_new_commit_notification.haml index 3ce49bd9d..69b61f326 100644 --- a/app/views/activity_feeds/partials/_wiki_new_commit_notification.haml +++ b/app/views/activity_feeds/partials/_wiki_new_commit_notification.haml @@ -4,7 +4,7 @@ .text %span = raw t("notifications.bodies.wiki_new_commit_notification", {:user_link => user_name, :history_link => link_to("wiki", history_project_wiki_index_path(project_id))}) - = raw t("notifications.bodies.project", :project_link => link_to(project_name, project_path(project_id))) + = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) ) .both %span.date= activity_feed.created_at .both diff --git a/config/locales/models/activity_feed.en.yml b/config/locales/models/activity_feed.en.yml index 3fa5f6da1..474ee3feb 100644 --- a/config/locales/models/activity_feed.en.yml +++ b/config/locales/models/activity_feed.en.yml @@ -20,19 +20,20 @@ en: bodies: new_comment_notification: title: '%{user_link} has been added a new comment' - content: in issue %{issue_link}. - commit_content: in commit %{commit_link}. - new_issue_notification: '%{user_link} has been added an issue' + content: in issue %{issue_link} + commit_content: in commit %{commit_link} + new_issue_notification: '%{user_link} has been added a new issue' + ussue: issue new_user_notification: title: Hello, %{user_name}. content: You have been sign up to project «ROSA Build System» and now can sign in. email: ==Your email %{user_email} password: ==Your password %{user_password} issue_assign_notification: You have been assigned to issue %{issue_link} - wiki_new_commit_notification: '%{user_link} has been updated wiki %{history_link}' + wiki_new_commit_notification: '%{user_link} has been updated %{history_link}' invite_approve_notification: Invite to ABF - project: in project %{project_link}. + project: in project %{project_link} delete_branch: Branch %{branch_name} has been deleted - create_branch: created new branch %{branch_name} - update_branch: pushed to branch %{branch_name} \ No newline at end of file + create_branch: '%{user_link} has been created a new branch %{branch_name}' + update_branch: '%{user_link} has been pushed to branch %{branch_name}' \ No newline at end of file diff --git a/config/locales/models/activity_feed.ru.yml b/config/locales/models/activity_feed.ru.yml index 15ef69fc9..b912d2266 100644 --- a/config/locales/models/activity_feed.ru.yml +++ b/config/locales/models/activity_feed.ru.yml @@ -20,19 +20,20 @@ ru: bodies: new_comment_notification: title: '%{user_link} добавил новый комментарий' - content: в задаче %{issue_link}. - commit_content: в коммите %{commit_link}. - new_issue_notification: '%{user_link} добавил новую задачу' + content: в задаче %{issue_link} + commit_content: в коммите %{commit_link} + new_issue_notification: '%{user_link} добавил новую задачу' + issue: задачу new_user_notification: title: Здравствуйте, %{user_name}. content: Вы зарегистрированы на проекте «ROSA Build System» и теперь можете войти в систему. email: ==Ваш email %{user_email} password: ==Ваш пароль %{user_password} issue_assign_notification: Вам была назначена задача %{issue_link} - wiki_new_commit_notification: '%{user_link} обновил wiki %{history_link}' + wiki_new_commit_notification: '%{user_link} обновил %{history_link}' invite_approve_notification: Приглашение в ABF - project: в проекте %{project_link}. + project: в проекте %{project_link} delete_branch: Удалена ветка %{branch_name} - create_branch: создал новую ветку %{branch_name} - update_branch: внес изменения в ветку %{branch_name} \ No newline at end of file + create_branch: '%{user_link} создал новую ветку %{branch_name}' + update_branch: '%{user_link} внес изменения в ветку %{branch_name}' \ No newline at end of file diff --git a/db/migrate/20120314151558_truncate_activity_feed.rb b/db/migrate/20120314151558_truncate_activity_feed.rb new file mode 100644 index 000000000..aea3a87fd --- /dev/null +++ b/db/migrate/20120314151558_truncate_activity_feed.rb @@ -0,0 +1,8 @@ +class TruncateActivityFeed < ActiveRecord::Migration + def up + ActivityFeed.destroy_all + end + + def down + end +end From 51e4cafe4c9a95c08b88666494cfc00cc01a0ef5 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 14 Mar 2012 23:18:37 +0600 Subject: [PATCH 6/7] Revert "[refs #194] fixed executor bug" This reverts commit 9f5176fb9990e61e3ca7a14fe0a5346f042d36d6. --- app/views/issues/_manage_sidebar.html.haml | 4 ++-- app/views/issues/show.html.haml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/issues/_manage_sidebar.html.haml b/app/views/issues/_manage_sidebar.html.haml index 17a8ce1be..bd70ac04c 100644 --- a/app/views/issues/_manage_sidebar.html.haml +++ b/app/views/issues/_manage_sidebar.html.haml @@ -1,5 +1,5 @@ -content_for :sidebar do - - can_manage = can?(:update, @issue) && @issue.persisted? || can?(:create, @project.issues.new) && @issue.new_record? + - can_manage = can? :write, @issue.project - if @issue.persisted? .bordered.nopadding %h3=t('activerecord.attributes.issue.status') @@ -21,7 +21,7 @@ .name="#{@issue.user.uname} (#{@issue.user.name})" =hidden_field_tag "user-0", @issue.user.id, :name => 'issue[user_id]' .both - - elsif @issue.user + - else .people.nopointer .avatar=image_tag avatar_url(@issue.user), :alt => 'avatar' .name="#{@issue.user.uname} (#{@issue.user.name})" diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 97e39954e..d382b3279 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -16,7 +16,7 @@ .fulltext.view.issue_body=@issue.body .both %br -- if can? :update, @issue +- if can? :write, @issue.project =link_to t('layout.edit'), '#', :id => 'edit_issue_content', :class => 'button' =form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_form issue', :style => 'display:none;' } do |f| .leftlist= t('activerecord.attributes.issue.title') + ':' From e30cc7072866a1e8d6694f0556b265b3eaa38517 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Wed, 14 Mar 2012 23:23:55 +0600 Subject: [PATCH 7/7] [refs #265] some refactoring --- .../partials/_new_comment_commit_notification.haml | 2 +- .../activity_feeds/partials/_new_comment_notification.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/activity_feeds/partials/_new_comment_commit_notification.haml b/app/views/activity_feeds/partials/_new_comment_commit_notification.haml index 3044f396c..fc55dca15 100644 --- a/app/views/activity_feeds/partials/_new_comment_commit_notification.haml +++ b/app/views/activity_feeds/partials/_new_comment_commit_notification.haml @@ -4,7 +4,7 @@ .text %span = raw t("notifications.bodies.new_comment_notification.title", :user_link => link_to(user_name, user_path(user_id)) ) - = raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_id, commit_id) + (defined?(comment_id) ? "#comment##{comment_id}" : ''))}) + = raw t("notifications.bodies.new_comment_notification.commit_content", {:commit_link => link_to(commit_message, commit_path(project_id, commit_id) + "#comment##{comment_id}")}) = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) ) .both %span.date= activity_feed.created_at diff --git a/app/views/activity_feeds/partials/_new_comment_notification.haml b/app/views/activity_feeds/partials/_new_comment_notification.haml index 1c87a8bd9..1f85c39e2 100644 --- a/app/views/activity_feeds/partials/_new_comment_notification.haml +++ b/app/views/activity_feeds/partials/_new_comment_notification.haml @@ -4,7 +4,7 @@ .text %span = raw t("notifications.bodies.new_comment_notification.title", {:user_link => link_to(user_name, user_path(user_id))}) - = raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id) + (defined?(comment_id) ? "#comment##{comment_id}" : ''))}) + = raw t("notifications.bodies.new_comment_notification.content", {:issue_link => link_to(issue_title, project_issue_path(project_id, issue_serial_id) + "#comment##{comment_id}")}) = raw t("notifications.bodies.project", :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_id)) ) .both %span.date= activity_feed.created_at