aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2024-05-12 14:58:27 +0300
committerGravatar Vitaly Takmazov2024-05-12 15:08:24 +0300
commit986cdeb72a6d433b43c990293b8a9d5689e3584b (patch)
treedcdf449747d642b7aa5595c6ac5b8359834263ee /src/main/java/com/juick/service
parent917744962bfa182345e2c743b2bdce97811e82f9 (diff)
StringUtils.abbreviate
Diffstat (limited to 'src/main/java/com/juick/service')
-rw-r--r--src/main/java/com/juick/service/TwitterService.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/main/java/com/juick/service/TwitterService.java b/src/main/java/com/juick/service/TwitterService.java
index ffcaca13..1cb3ffa1 100644
--- a/src/main/java/com/juick/service/TwitterService.java
+++ b/src/main/java/com/juick/service/TwitterService.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008-2023, Juick
+ * Copyright (C) 2008-2024, Juick
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -17,7 +17,6 @@
package com.juick.service;
-import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.scribejava.apis.TwitterApi20;
import com.github.scribejava.core.builder.ServiceBuilder;
@@ -27,7 +26,6 @@ import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth.OAuth20Service;
import com.juick.model.Message;
import com.juick.util.MessageUtils;
-import com.juick.util.formatters.PlainTextFormatter;
import jakarta.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -68,7 +66,7 @@ public class TwitterService {
userService.getTwitterToken(jmsg.getUser().getUid()).ifPresent(t -> {
String status = MessageUtils.getMessageHashTags(jmsg) + StringUtils.defaultString(jmsg.getText());
if (status.length() > 253) {
- status = PlainTextFormatter.truncateText(status, 252) + "…";
+ status = StringUtils.abbreviate(status, "…", 252);
}
status += " http://juick.com/" + jmsg.getMid();
try {