Пример #1
0
  public void reportSpam(JiveObject jiveObject, User reporter, String comment, Date reportDate) {
    // Similar to MessageAbuseAction#execute()
    AbuseReport abuseReport = new AbuseReport();
    abuseReport.setAbuseType(AbuseType.spam);
    abuseReport.setObjectID(jiveObject.getID());
    abuseReport.setObjectType(jiveObject.getObjectType());
    abuseReport.setUser(reporter);
    abuseReport.setReportDate(reportDate);
    abuseReport.setComment(comment);
    abuseReport.setJiveObject(jiveObject);

    abuseManager.reportAbuse(abuseReport);
  }
Пример #2
0
  @Audit
  @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
  @Override
  public void resolveContentAsSpam(User spammer, User moderator) {
    if (log.isInfoEnabled()) {
      log.info("Resolve SPAM reports on all content of of this user: "******"Resolve Documents");
    Iterable<Document> docs = documentManager.getUserDocuments(spammer, documentStatesToResolve);
    for (Document document : docs) {
      if (log.isTraceEnabled()) {
        log.trace("Resolve Report spam of document: " + document.getDocumentID());
      }
      resolveSpamReport(document, moderator);
    }

    log.debug("Resolve Threads");
    ThreadResultFilter moderationFilter = ThreadResultFilter.createDefaultUserMessagesFilter();
    moderationFilter.setStatus(JiveContentObject.Status.ABUSE_HIDDEN);

    Iterable<ForumMessage> messages = forumManager.getUserMessages(spammer, moderationFilter);
    List<Long> resolvedThreads = new ArrayList<Long>();

    for (ForumMessage message : messages) {
      if (log.isTraceEnabled()) {
        log.trace(
            "Resolve Report spam of message: "
                + message.getID()
                + ", threadId: "
                + message.getForumThreadID());
      }
      ForumThread thread = message.getForumThread();
      if (!resolvedThreads.contains(thread.getID())) {
        resolvedThreads.add(thread.getID());
        if (thread.getUser().getUsername().equals(spammer.getUsername())) {
          if (log.isTraceEnabled()) {
            log.trace("Resolve Report spam of thread: " + thread.getID());
          }
          resolveSpamReport(thread, moderator);
        }
      }
      resolveSpamReport(message, moderator);
    }

    log.debug("Resolve Blogs");
    Iterable<Blog> blogs = blogManager.getExplicitlyEntitledBlogs(spammer);
    for (Blog blog : blogs) {
      if (log.isTraceEnabled()) {
        log.trace("Processing blog: " + blog.getName());
      }
      if (blog.isUserBlog()) {
        Iterator<BlogPost> blogPosts = getBlogPosts(blog, JiveContentObject.Status.ABUSE_HIDDEN);
        while (blogPosts.hasNext()) {
          BlogPost blogPost = blogPosts.next();
          if (log.isTraceEnabled()) {
            log.trace("Resolve Report spam Blog post: " + blogPost.getID());
          }
          resolveSpamReport(blogPost, moderator);
        }
      }
    }

    log.trace("Resolve Bookmarks");
    Iterator<Favorite> favorites =
        favoriteManager.getUserFavorites(spammer, Sets.newHashSet(externalUrlObjectType));
    while (favorites.hasNext()) {
      Favorite favorite = favorites.next();
      JiveObject favoritedObject = favorite.getObjectFavorite().getFavoritedObject();
      if (log.isTraceEnabled()) {
        log.trace("Resolve Report spam Favorite (Bookmark) to external URL: " + favorite.getID());
        log.trace(
            "Favorited object, id: "
                + favoritedObject.getID()
                + ", type: "
                + favoritedObject.getObjectType());
      }
      resolveSpamReport(favoritedObject, moderator);
    }
  }