Skip to content

Commit

Permalink
b3log#607
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Apr 6, 2018
1 parent 588967e commit a65441d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/main/java/org/b3log/symphony/model/UserExt.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author Bill Ho
* @version 2.10.0.0, Apr 1, 2018
* @version 2.11.0.0, Apr 6, 2018
* @see org.b3log.latke.model.User
* @since 0.2.0
*/
Expand Down Expand Up @@ -57,6 +57,11 @@ public final class UserExt {
*/
public static final String USER_SUB_MAIL_STATUS = "userSubMailStatus";

/**
* Key of user auto watch article after reply status.
*/
public static final String USER_REPLY_WATCH_ARTICLE_STATUS = "userReplyWatchArticleStatus";

/**
* Key of user subscription mail send time.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author Bill Ho
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @version 2.26.9.3, Apr 1, 2018
* @version 2.26.9.4, Apr 6, 2018
* @since 1.1.0
*/
@RequestProcessor
Expand Down Expand Up @@ -1307,6 +1307,7 @@ public void updateUser(final HTTPRequestContext context, final HttpServletReques
case UserExt.USER_NOTIFY_STATUS:
case UserExt.USER_SUB_MAIL_STATUS:
case UserExt.USER_KEYBOARD_SHORTCUTS_STATUS:
case UserExt.USER_REPLY_WATCH_ARTICLE_STATUS
case UserExt.USER_GEO_STATUS:
case UserExt.USER_ARTICLE_STATUS:
case UserExt.USER_COMMENT_STATUS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
* </p>
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.7.3.1, Nov 11, 2017
* @version 1.7.3.2, Apr 6, 2018
* @since 0.2.0
*/
@RequestProcessor
Expand Down Expand Up @@ -485,7 +485,8 @@ public void addComment(final HTTPRequestContext context, final HttpServletReques

commentMgmtService.addComment(comment);

if (!commentAuthorId.equals(articleAuthorId)) {
if (!commentAuthorId.equals(articleAuthorId) &&
UserExt.USER_XXX_STATUS_C_ENABLED == currentUser.optInt(UserExt.USER_REPLY_WATCH_ARTICLE_STATUS)) {
followMgmtService.watchArticle(commentAuthorId, articleId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
* </ul>
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.1.3, Apr 1, 2018
* @version 1.0.1.4, Apr 6, 2018
* @since 2.4.0
*/
@RequestProcessor
Expand Down Expand Up @@ -451,6 +451,7 @@ public void updateFunction(final HTTPRequestContext context, final HttpServletRe
final boolean notifyStatus = requestJSONObject.optBoolean(UserExt.USER_NOTIFY_STATUS);
final boolean subMailStatus = requestJSONObject.optBoolean(UserExt.USER_SUB_MAIL_STATUS);
final boolean keyboardShortcutsStatus = requestJSONObject.optBoolean(UserExt.USER_KEYBOARD_SHORTCUTS_STATUS);
final boolean userReplyWatchArticleStatus = requestJSONObject.optBoolean(UserExt.USER_REPLY_WATCH_ARTICLE_STATUS);

int userListPageSize;
try {
Expand Down Expand Up @@ -479,6 +480,8 @@ public void updateFunction(final HTTPRequestContext context, final HttpServletRe
? UserExt.USER_XXX_STATUS_C_ENABLED : UserExt.USER_XXX_STATUS_C_DISABLED);
user.put(UserExt.USER_KEYBOARD_SHORTCUTS_STATUS, keyboardShortcutsStatus
? UserExt.USER_XXX_STATUS_C_ENABLED : UserExt.USER_XXX_STATUS_C_DISABLED);
user.put(UserExt.USER_REPLY_WATCH_ARTICLE_STATUS, userReplyWatchArticleStatus
? UserExt.USER_XXX_STATUS_C_ENABLED : UserExt.USER_XXX_STATUS_C_DISABLED);

try {
userMgmtService.updateUser(user.optString(Keys.OBJECT_ID), user);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author Bill Ho
* @version 1.15.22.0, Apr 5, 2018
* @version 1.15.22.1, Apr 6, 2018
* @since 0.2.0
*/
@Service
Expand Down Expand Up @@ -505,6 +505,7 @@ public synchronized String addUser(final JSONObject requestJSONObject) throws Se
user.put(UserExt.USER_AVATAR_VIEW_MODE, UserExt.USER_AVATAR_VIEW_MODE_C_ORIGINAL);
user.put(UserExt.USER_SUB_MAIL_SEND_TIME, System.currentTimeMillis());
user.put(UserExt.USER_KEYBOARD_SHORTCUTS_STATUS, UserExt.USER_XXX_STATUS_C_DISABLED);
user.put(UserExt.USER_REPLY_WATCH_ARTICLE_STATUS, UserExt.USER_XXX_STATUS_C_ENABLED);

final JSONObject optionLanguage = optionRepository.get(Option.ID_C_MISC_LANGUAGE);
final String adminSpecifiedLang = optionLanguage.optString(Option.OPTION_VALUE);
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/repository.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"description": "Description of repository structures, for generation of the relational database table and persistence validation.",
"version": "4.37.8.27, Apr 1, 2018",
"version": "4.37.8.28, Apr 6, 2018",
"authors": [
"Liang Ding",
"Zephyr",
Expand Down Expand Up @@ -1586,6 +1586,11 @@
"type": "int",
"description": "0:启用键盘快捷键,1:禁用键盘快捷键"
},
{
"name": "userReplyWatchArticleStatus",
"type": "int",
"description": "0:回帖后自动关注帖子,1:回帖后不自动关注帖子"
},
{
"name": "userLanguage",
"type": "String",
Expand Down

0 comments on commit a65441d

Please sign in to comment.