Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Merge branch 'fix/comment-mention' into 'next'
Browse files Browse the repository at this point in the history
from pull-request 1513

* refs/heads/fix/comment-mention:
  MyIssues: Fix mentioning issues contain unsuitable items
  Rename Mention.add() to Mention.update()

Reviewed-by: 채수원 <sw.chae@navercorp.com>
  • Loading branch information
doortts committed Mar 12, 2015
2 parents 162dd32 + 9e67caf commit ae715e3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/AbstractPosting.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public Set<User> getWatchers(Set<User> baseWatchers) {

protected void updateMention() {
if (this.body != null) {
Mention.add(this.asResource(), NotificationEvent.getMentionedUsers(this.body));
Mention.update(this.asResource(), NotificationEvent.getMentionedUsers(this.body));
}
}

Expand Down
8 changes: 7 additions & 1 deletion app/models/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,14 @@ public void save() {
getParent().update();
}

@Transactional
public void update() {
super.update();
updateMention();
}

protected void updateMention() {
Mention.add(this.asResource(), NotificationEvent.getMentionedUsers(this.contents));
Mention.update(this.asResource(), NotificationEvent.getMentionedUsers(this.contents));
}

public void delete() {
Expand Down
2 changes: 1 addition & 1 deletion app/models/Mention.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class Mention extends Model {
* @param resource the resource mentioning the users
* @param mentionedUsers the users mentioned by the resource
*/
public static void add(Resource resource, Set<User> mentionedUsers) {
public static void update(Resource resource, Set<User> mentionedUsers) {
for (Mention mention : find.where().eq("resourceType", resource.getType()).eq("resourceId",
resource.getId()).findList()) {
if (mentionedUsers.contains(mention.user)) {
Expand Down

0 comments on commit ae715e3

Please sign in to comment.