Commit 1eec69ba authored by Liang Ding's avatar Liang Ding

🎨 Fix #12778

parent 984b0267
......@@ -17,6 +17,7 @@
*/
package org.b3log.solo.processor;
import com.vdurmont.emoji.EmojiParser;
import org.b3log.latke.Keys;
import org.b3log.latke.Latkes;
import org.b3log.latke.ioc.Inject;
......@@ -43,7 +44,6 @@ import org.b3log.solo.model.rss.Item;
import org.b3log.solo.repository.ArticleRepository;
import org.b3log.solo.service.ArticleQueryService;
import org.b3log.solo.service.OptionQueryService;
import org.b3log.solo.util.Emotions;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -59,7 +59,7 @@ import java.util.List;
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://github.com/feroozkhanchintu">feroozkhanchintu</a>
* @author <a href="https://github.com/nanolikeyou">nanolikeyou</a>
* @version 2.0.0.1, Dec 3, 2018
* @version 2.0.0.2, May 15, 2019
* @since 0.3.1
*/
@RequestProcessor
......@@ -228,12 +228,12 @@ public class FeedProcessor {
final JSONObject article = articles.getJSONObject(i);
final Item ret = new Item();
String title = article.getString(Article.ARTICLE_TITLE);
title = Emotions.toAliases(title);
title = EmojiParser.parseToAliases(title);
ret.setTitle(title);
String description = isFullContent
? article.getString(Article.ARTICLE_CONTENT)
: article.optString(Article.ARTICLE_ABSTRACT);
description = Emotions.toAliases(description);
description = EmojiParser.parseToAliases(description);
ret.setDescription(description);
final long pubDate = article.getLong(Article.ARTICLE_UPDATED);
ret.setPubDate(new Date(pubDate));
......
......@@ -48,7 +48,7 @@ import java.util.Date;
* Comment management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.0.1, Apr 19, 2019
* @version 1.4.0.2, May 15, 2019
* @since 0.3.5
*/
@Service
......@@ -210,8 +210,6 @@ public class CommentMgmtService {
}
ret.put(Keys.STATUS_CODE, true);
commentContent = Emotions.toAliases(commentContent);
requestJSONObject.put(Comment.COMMENT_CONTENT, commentContent);
return ret;
......
......@@ -17,7 +17,6 @@
*/
package org.b3log.solo.util;
import com.vdurmont.emoji.EmojiParser;
import org.b3log.latke.Latkes;
import java.util.regex.Pattern;
......@@ -26,7 +25,7 @@ import java.util.regex.Pattern;
* Emotions utilities.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.2, Mar 5, 2019
* @version 1.1.0.0, Mar 15, 2019
* @since 1.4.0
*/
public final class Emotions {
......@@ -36,16 +35,6 @@ public final class Emotions {
*/
public static final Pattern EMOJI_PATTERN = Pattern.compile(":.+:");
/**
* Replaces the emoji's unicode occurrences by one of their alias (between 2 ':'). Example: "😄" gives ":smile:".
*
* @param content the string to parse
* @return the string with the emojis replaced by their alias.
*/
public static String toAliases(final String content) {
return EmojiParser.parseToAliases(content, EmojiParser.FitzpatrickAction.IGNORE);
}
/**
* Converts the specified content with emotions.
* <p>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment