Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions sql/20260723_external_point_request_scope.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ALTER TABLE `symphony_external_point_request`
ADD COLUMN `sourceAppId` VARCHAR(64) NOT NULL DEFAULT '' AFTER `oId`;

UPDATE `symphony_external_point_request` e
INNER JOIN `symphony_pointtransfer` p ON p.`oId` = e.`transferId`
SET e.`sourceAppId` = p.`sourceAppId`
WHERE e.`transferId` <> '' AND p.`sourceAppId` IS NOT NULL;

ALTER TABLE `symphony_external_point_request`
DROP INDEX `uk_external_point_request_id`,
ADD UNIQUE KEY `uk_external_point_request_scope` (`sourceAppId`, `requestId`);
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
public final class ExternalPointRequest {

public static final String EXTERNAL_POINT_REQUEST = "external_point_request";
public static final String SOURCE_APP_ID = "sourceAppId";
public static final String REQUEST_ID = "requestId";
public static final String REQUEST_HASH = "requestHash";
public static final String TRANSFER_ID = "transferId";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
package org.b3log.symphony.repository;

import org.b3log.latke.repository.AbstractRepository;
import org.b3log.latke.repository.CompositeFilterOperator;
import org.b3log.latke.repository.FilterOperator;
import org.b3log.latke.repository.PropertyFilter;
import org.b3log.latke.repository.Query;
Expand All @@ -31,15 +32,19 @@ public ExternalPointRequestRepository() {
}

/**
* Gets a request by the specified id.
* Gets a request by the specified source application and request id.
*
* @param sourceAppId source application id
* @param requestId request id
* @return request, returns {@code null} if not found
* @throws RepositoryException repository exception
*/
public JSONObject getByRequestId(final String requestId) throws RepositoryException {
public JSONObject getBySourceAppIdAndRequestId(final String sourceAppId, final String requestId)
throws RepositoryException {
final Query query = new Query().setPage(1, 1).setFilter(
new PropertyFilter(ExternalPointRequest.REQUEST_ID, FilterOperator.EQUAL, requestId));
CompositeFilterOperator.and(
new PropertyFilter(ExternalPointRequest.SOURCE_APP_ID, FilterOperator.EQUAL, sourceAppId),
new PropertyFilter(ExternalPointRequest.REQUEST_ID, FilterOperator.EQUAL, requestId)));
final List<JSONObject> requests = getList(query);
return requests.isEmpty() ? null : requests.get(0);
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/b3log/symphony/service/ArticleMgmtService.java
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,8 @@ public void updateArticleByAdmin(final String articleId, final JSONObject articl
article.put(Article.ARTICLE_STATEMENT, Integer.valueOf(article.optInt(Article.ARTICLE_STATEMENT, 0)));

final JSONObject oldArticle = articleRepository.get(articleId);
final int oldArticleType = oldArticle.optInt(Article.ARTICLE_TYPE);
final String oldContent = oldArticle.optString(Article.ARTICLE_CONTENT);

if (Article.ARTICLE_STATUS_C_INVALID == article.optInt(Article.ARTICLE_STATUS)) {
article.put(Article.ARTICLE_TAGS, "回收站");
Expand Down Expand Up @@ -1117,6 +1119,15 @@ public void updateArticleByAdmin(final String articleId, final JSONObject articl
userRepository.update(authorId, author);
articleRepository.update(articleId, article);

final int articleType = article.optInt(Article.ARTICLE_TYPE);
final String articleContent = article.optString(Article.ARTICLE_CONTENT);
final boolean contentChanged = !oldContent.replaceAll("\\s+", "")
.equals(articleContent.replaceAll("\\s+", ""));
if (contentChanged && (Article.ARTICLE_TYPE_C_LONG == articleType
|| Article.ARTICLE_TYPE_C_LONG == oldArticleType)) {
longArticleParagraphService.migrateCommentsInCurrentTransaction(articleId, oldContent, articleContent);
}

if (null != longArticleColumnRequest) {
article.put(Keys.OBJECT_ID, articleId);
longArticleColumnMgmtService.syncChapterInCurrentTransaction(article, longArticleColumnRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ public String adjust(final RequestContext context, final String userId, final St
final int point, final String memo, final PointtransferSource source)
throws ServiceException {
final String requestHash = requestHash(userId, point, memo, source);
final ReentrantLock requestLock = REQUEST_LOCKS[Math.floorMod(source.requestId().hashCode(), LOCK_STRIPE_COUNT)];
final int requestLockIndex = Math.floorMod(31 * source.appId().hashCode() + source.requestId().hashCode(),
LOCK_STRIPE_COUNT);
final ReentrantLock requestLock = REQUEST_LOCKS[requestLockIndex];
requestLock.lock();
try {
final JSONObject existing = getExisting(source.requestId());
final JSONObject existing = getExisting(source.appId(), source.requestId());
if (null != existing) {
return resolveExisting(existing, requestHash);
}
Expand Down Expand Up @@ -100,6 +102,7 @@ private String execute(final RequestContext context, final String userId, final
JSONObject publicLog = null;
try {
final JSONObject request = new JSONObject();
request.put(ExternalPointRequest.SOURCE_APP_ID, source.appId());
request.put(ExternalPointRequest.REQUEST_ID, source.requestId());
request.put(ExternalPointRequest.REQUEST_HASH, requestHash);
request.put(ExternalPointRequest.TRANSFER_ID, "");
Expand All @@ -125,7 +128,7 @@ private String execute(final RequestContext context, final String userId, final
transaction.rollback();
}

final JSONObject existing = getExisting(source.requestId());
final JSONObject existing = getExisting(source.appId(), source.requestId());
if (null != existing) {
return resolveExisting(existing, requestHash);
}
Expand Down Expand Up @@ -157,9 +160,9 @@ private void publishPostCommitActions(final String fromId, final String toId,
}
}

private JSONObject getExisting(final String requestId) throws ServiceException {
private JSONObject getExisting(final String sourceAppId, final String requestId) throws ServiceException {
try {
return externalPointRequestRepository.getByRequestId(requestId);
return externalPointRequestRepository.getBySourceAppIdAndRequestId(sourceAppId, requestId);
} catch (final RepositoryException e) {
throw new ServiceException("请求记录查询失败。");
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/css/index.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main/resources/css/mobile-base.css

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion src/main/resources/js/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,22 @@ var Comment = {
return ' data-thread-depth="' + depth +
'" style="--comment-thread-indent:' + (depth * 28) + 'px"'
},
renderThreadReplyParagraphAttributes: function (data) {
var paragraphId = data.commentParagraphId || ''
if (!paragraphId) {
return ''
}
var paragraphStatus = parseInt(data.commentParagraphStatus, 10)
paragraphStatus = isNaN(paragraphStatus) ? 0 : paragraphStatus
return ' data-comment-paragraph-id="' + Comment.escapeHTML(paragraphId) +
'" data-comment-paragraph-status="' + paragraphStatus + '"'
},
renderThreadReply: function (data) {
var depth = Comment.getThreadReplyDepth(data)
return '<div id="' + Comment.escapeHTML(data.oId) + '" class="' +
Comment.renderThreadReplyClass(depth) + '"' +
Comment.renderThreadReplyStyle(depth) + '>'
Comment.renderThreadReplyStyle(depth) +
Comment.renderThreadReplyParagraphAttributes(data) + '>'
+ '<a rel="nofollow" href="' + Label.servePath + '/member/'
+ Comment.escapeHTML(data.commentAuthorName) + '" class="comment-thread__avatar" aria-label="'
+ Comment.escapeHTML(data.commentAuthorName) + '" style="background-image:url(\''
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/js/article.min.js

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion src/main/resources/js/m-article.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,22 @@ var Comment = {
return ' data-thread-depth="' + depth +
'" style="--comment-thread-indent:' + (depth * 16) + 'px"'
},
renderThreadReplyParagraphAttributes: function (data) {
var paragraphId = data.commentParagraphId || ''
if (!paragraphId) {
return ''
}
var paragraphStatus = parseInt(data.commentParagraphStatus, 10)
paragraphStatus = isNaN(paragraphStatus) ? 0 : paragraphStatus
return ' data-comment-paragraph-id="' + Comment.escapeHTML(paragraphId) +
'" data-comment-paragraph-status="' + paragraphStatus + '"'
},
renderThreadReply: function (data) {
var depth = Comment.getThreadReplyDepth(data)
return '<div id="' + Comment.escapeHTML(data.oId) + '" class="' +
Comment.renderThreadReplyClass(depth) + '"' +
Comment.renderThreadReplyStyle(depth) + '>'
Comment.renderThreadReplyStyle(depth) +
Comment.renderThreadReplyParagraphAttributes(data) + '>'
+ '<a rel="nofollow" href="' + Label.servePath + '/member/'
+ Comment.escapeHTML(data.commentAuthorName) + '" class="comment-thread__avatar" aria-label="'
+ Comment.escapeHTML(data.commentAuthorName) + '" style="background-image:url(\''
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/js/m-article.min.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/main/resources/repository.json
Original file line number Diff line number Diff line change
Expand Up @@ -1026,6 +1026,12 @@
"length": 19,
"description": "主键"
},
{
"name": "sourceAppId",
"type": "String",
"length": 64,
"description": "来源应用编号"
},
{
"name": "requestId",
"type": "String",
Expand Down
64 changes: 1 addition & 63 deletions src/main/resources/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6332,57 +6332,6 @@ body.night .long-article-paragraph-comments {
text-overflow: ellipsis;
}

.article-column-card {
margin: 16px 0;
padding: 12px;
border: 1px solid #b7cfba;
border-radius: 8px;
background: #cfe2d0;
}

.article-column-card__title {
color: #2d4935;
font-weight: 600;

a {
color: inherit;
text-decoration: none;
}
}

.article-column-card__meta {
margin-top: 4px;
color: #718078;
font-size: 12px;
}

.article-column-card__chapters {
margin-top: 10px;
max-height: 260px;
overflow: auto;
padding-top: 8px;
border-top: 1px dashed #b8d0bb;
}

.article-column-card__chapter {
display: block;
padding: 6px 8px;
border-radius: 8px;
color: #3b5743;
text-decoration: none;

&:hover {
background: #c1d9c4;
text-decoration: none;
}
}

.article-column-card__chapter--active {
background: #b2d0b5;
color: #28593a;
font-weight: 600;
}

.article-nav-list-card {
margin: 12px 0 0;
padding: 12px;
Expand Down Expand Up @@ -6753,7 +6702,6 @@ body.night {
}

.article-adjacent-nav__link,
.article-column-card,
.article-nav-list-card {
border-color: rgba(255, 255, 255, 0.1);
background: #1f2937;
Expand All @@ -6766,29 +6714,19 @@ body.night {
}

.article-adjacent-nav__label,
.article-adjacent-nav__preview,
.article-column-card__meta {
.article-adjacent-nav__preview {
color: #94a3b8;
}

.article-column-card__title,
.article-column-card__chapter,
.article-nav-list-card__title,
.article-nav-list-card__item {
color: #e5e7eb;
}

.article-column-card__chapters,
.article-nav-list-card__items {
border-color: rgba(255, 255, 255, 0.1);
}

.article-column-card__chapter:hover,
.article-column-card__chapter--active {
background: rgba(95, 149, 109, 0.24);
color: #c9edcf;
}

.article-nav-list-card__item:hover,
.article-nav-list-card__item--active {
background: rgba(59, 130, 246, 0.18);
Expand Down
58 changes: 1 addition & 57 deletions src/main/resources/scss/mobile-base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6414,52 +6414,6 @@ body.long-article-page {
font-size: 13px;
}

.article-column-card {
margin: 12px 0;
padding: 10px;
border: 1px solid #b7cfba;
border-radius: 8px;
background: #cfe2d0;
}

.article-column-card__title {
color: #2d4935;
font-weight: 600;

a {
color: inherit;
text-decoration: none;
}
}

.article-column-card__meta {
margin-top: 4px;
color: #718078;
font-size: 12px;
}

.article-column-card__chapters {
margin-top: 8px;
max-height: 220px;
overflow: auto;
padding-top: 6px;
border-top: 1px dashed #b8d0bb;
}

.article-column-card__chapter {
display: block;
padding: 6px 8px;
border-radius: 8px;
color: #3b5743;
text-decoration: none;
}

.article-column-card__chapter--active {
background: #b2d0b5;
color: #28593a;
font-weight: 600;
}

.article-nav-list-card {
margin: 10px 0 0;
padding: 10px;
Expand Down Expand Up @@ -6800,36 +6754,26 @@ body.night {
}

.article-adjacent-nav__link,
.article-column-card,
.article-nav-list-card {
border-color: rgba(255, 255, 255, 0.1);
background: #1f2937;
color: #e5e7eb;
}

.article-adjacent-nav__label,
.article-adjacent-nav__preview,
.article-column-card__meta {
.article-adjacent-nav__preview {
color: #94a3b8;
}

.article-column-card__title,
.article-column-card__chapter,
.article-nav-list-card__title,
.article-nav-list-card__item {
color: #e5e7eb;
}

.article-column-card__chapters,
.article-nav-list-card__items {
border-color: rgba(255, 255, 255, 0.1);
}

.article-column-card__chapter--active {
background: rgba(95, 149, 109, 0.24);
color: #c9edcf;
}

.article-nav-list-card__item--active {
background: rgba(59, 130, 246, 0.18);
color: #bfdbfe;
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/skins/classic/mobile/common/comment.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@
<#if threadOriginalAuthorLabel == ''><#assign threadOriginalAuthorLabel = threadReply.commentOriginalAuthorName!'原评论'></#if>
<#assign threadDepth = threadReply.commentThreadDepth!0>
<div id="${threadReply.oId}" class="comment-thread__reply<#if threadDepth gt 0> comment-thread__reply--nested</#if>"
data-thread-depth="${threadDepth}" style="--comment-thread-indent:${threadDepth * 16}px">
data-thread-depth="${threadDepth}" style="--comment-thread-indent:${threadDepth * 16}px"
<#if (threadReply.commentParagraphId!'') != ''>data-comment-paragraph-id="${threadReply.commentParagraphId?html}"
data-comment-paragraph-status="${threadReply.commentParagraphStatus!0}"</#if>>
<a rel="nofollow" href="${servePath}/member/${threadReply.commentAuthorName}" class="comment-thread__avatar"
aria-label="${threadReply.commentAuthorName}"
style="background-image:url('${threadReply.commentAuthorThumbnailURL}')"></a>
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/skins/classic/pc/common/comment.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@
<#if threadOriginalAuthorLabel == ''><#assign threadOriginalAuthorLabel = threadReply.commentOriginalAuthorName!'原评论'></#if>
<#assign threadDepth = threadReply.commentThreadDepth!0>
<div id="${threadReply.oId}" class="comment-thread__reply<#if threadDepth gt 0> comment-thread__reply--nested</#if>"
data-thread-depth="${threadDepth}" style="--comment-thread-indent:${threadDepth * 28}px">
data-thread-depth="${threadDepth}" style="--comment-thread-indent:${threadDepth * 28}px"
<#if (threadReply.commentParagraphId!'') != ''>data-comment-paragraph-id="${threadReply.commentParagraphId?html}"
data-comment-paragraph-status="${threadReply.commentParagraphStatus!0}"</#if>>
<a rel="nofollow" href="${servePath}/member/${threadReply.commentAuthorName}" class="comment-thread__avatar"
aria-label="${threadReply.commentAuthorName}"
style="background-image:url('${threadReply.commentAuthorThumbnailURL}')"></a>
Expand Down
Loading