wansoon 2013-10-14
pull-request: remove commit changed notification event
@2a3bb58d882f125861257bcbafd9264411b37da4
app/actors/PullRequestEventActor.java
--- app/actors/PullRequestEventActor.java
+++ app/actors/PullRequestEventActor.java
@@ -34,11 +34,10 @@
             PullRequestMergeResult mergeResult = pullRequest.attemptMerge();
             
             if (mergeResult.commitChanged()) {
-                
+            
                 mergeResult.saveCommits();
                 
                 if (!mergeResult.getNewCommits().isEmpty()) {
-                    NotificationEvent.addCommitChange(message.getSender(), pullRequest, message.getRequest(), mergeResult);
                     PullRequestEvent.addCommitEvents(message.getSender(), pullRequest, mergeResult.getNewCommits());                
                 }
             }
app/models/NotificationEvent.java
--- app/models/NotificationEvent.java
+++ app/models/NotificationEvent.java
@@ -352,55 +352,4 @@
         
         return notiEvent;
     }
-    
-    /**
-     * 보낸 코드의 커밋 변경시 알림 설정
-     * @param sender
-     * @param pullRequest
-     * @param request
-     * @param mergeResult
-     * @return
-     */
-    public static NotificationEvent addCommitChange(User sender, PullRequest pullRequest, Request request,
-            PullRequestMergeResult mergeResult) {
-            
-        String title = NotificationEvent.formatReplyTitle(pullRequest);
-        Resource resource = pullRequest.asResource();
-        Set<User> watchers = pullRequest.getWatchers();
-        watchers.addAll(NotificationEvent.getMentionedUsers(pullRequest.body));
-        watchers.remove(pullRequest.contributor);
-        
-        Project toProject = pullRequest.toProject;
-
-        NotificationEvent notiEvent = new NotificationEvent();
-        notiEvent.created = new Date();
-        notiEvent.title = title;
-        notiEvent.senderId = sender.id;
-        notiEvent.receivers = watchers;
-        notiEvent.urlToView = routes.PullRequestApp.pullRequest(
-                toProject.owner, toProject.name, pullRequest.number).absoluteURL(
-                request);
-        notiEvent.resourceId = resource.getId();
-        notiEvent.resourceType = resource.getType();
-        notiEvent.eventType = EventType.PULL_REQUEST_COMMIT_CHANGED;
-        notiEvent.oldValue = makeCommitMessage(pullRequest.pullRequestCommits);
-        notiEvent.newValue = makeCommitMessage(mergeResult.getNewCommits());
-        
-        add(notiEvent);
-        
-        return notiEvent;
-    }
-
-    /**
-     * 알림용 커밋메세지를 생성
-     * @param commits
-     * @return
-     */
-    private static String makeCommitMessage(List<PullRequestCommit> commits) {
-        StringBuilder sb = new StringBuilder();
-        for (PullRequestCommit commit : commits) {
-            sb.append(commit.commitShortId).append(": ").append(commit.commitMessage).append("\n");
-        }
-        return sb.toString();
-    }
 }
Add a comment
List