Skip to content

Commit

Permalink
Merge pull request #830 from support-project/feature/issue812_658_upd…
Browse files Browse the repository at this point in the history
…ate_at

#812 #658 Add a checkbox on form to not update timeline
  • Loading branch information
koda-masaru authored Aug 18, 2017
2 parents 035116b + 977acf7 commit 820492b
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,16 @@ private Boundary update(KnowledgesEntity entity) throws Exception {
return sendValidateError(errors);
}

// 明示的にユーザが、タイムラインの上にもっていきたくないと指定した
if ("true".equals(super.getAttribute("notUpdateTimeline", "false"))) {
data.setDonotUpdateTimeline(true);
}
if (!StringUtils.isEmpty(getParam("updateContent")) && getParam("updateContent").toLowerCase().equals("true")) {
// コンテンツの内容が更新されている
data.setUpdateContent(true);
if (!data.isDonotUpdateTimeline()) {
data.setNotifyUpdate(true);
}
LOG.debug("コンテンツを更新した");
} else {
// メタデータのみ更新
Expand All @@ -290,13 +298,12 @@ private Boundary update(KnowledgesEntity entity) throws Exception {
if (check.getPublicFlag().intValue() == KnowledgeLogic.PUBLIC_FLAG_PRIVATE &&
check.getPublicFlag().intValue() != data.getKnowledge().getPublicFlag().intValue()) {
// まだ通知を一度も出しておらず、かつ、「非公開」になっていたものを、それ以外の区分に変更した場合は、通知を出す
data.setUpdateContent(true);
data.setNotifyUpdate(true);
LOG.debug("メタデータのみ更新であったが、非公開から公開などへ変更した");
}
}
}


KnowledgesEntity updatedEntity = knowledgeLogic.update(data, super.getLoginedUser());

if (data.isUpdateContent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,21 @@ public KnowledgesEntity update(KnowledgeData data, LoginedUser loginedUser) thro
if (data.isUpdateContent()) {
// 履歴登録
insertHistory(updatedEntity);
// 通知
NotifyLogic.get().notifyOnKnowledgeUpdate(updatedEntity);
} else {
// 更新ユーザ&更新日付を戻す
updatedEntity.setUpdateUser(db.getUpdateUser());
updatedEntity.setUpdateDatetime(db.getUpdateDatetime());
knowledgesDao.physicalUpdate(updatedEntity);
}
if (data.isNotifyUpdate()) {
// 通知
NotifyLogic.get().notifyOnKnowledgeUpdate(updatedEntity);
}
if (data.isDonotUpdateTimeline()) {
// タイムラインの上に表示しないと明示的に指定があれば、全文検索エンジン上の更新日は更新しない(検索エンジンのインデックスでタイムラインを作っているため)
updatedEntity.setUpdateDatetime(db.getUpdateDatetime());
}

// 全文検索エンジンへ登録
saveIndex(updatedEntity, data.getTags(), data.getViewers(), data.getTemplate(), updatedEntity.getInsertUser());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ public class KnowledgeData {
private List<Long> fileNos;
private TemplateMastersEntity template;
private Long draftId;
private boolean updateContent;

private boolean updateContent = false;
private boolean notifyUpdate = false;
private boolean donotUpdateTimeline = false;

private String viewersStr;
private String editorsStr;
Expand Down Expand Up @@ -246,6 +249,26 @@ public boolean isUpdateContent() {
public void setUpdateContent(boolean updateContent) {
this.updateContent = updateContent;
}


public boolean isNotifyUpdate() {
return notifyUpdate;
}


public void setNotifyUpdate(boolean notifyUpdate) {
this.notifyUpdate = notifyUpdate;
}


public boolean isDonotUpdateTimeline() {
return donotUpdateTimeline;
}


public void setDonotUpdateTimeline(boolean donotUpdateTimeline) {
this.donotUpdateTimeline = donotUpdateTimeline;
}



Expand Down
1 change: 1 addition & 0 deletions src/main/resources/appresource.properties
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ knowledge.edit.set.slide.path=SlideShow
knowledge.edit.update.content=updated a content
knowledge.edit.update.meta=Only meta information was updated (update notification is not sent)
knowledge.edit.image.upload=Upload a image width preview
knowledge.edit.do.not.update.timeline=Don't update timeline
knowledge.delete.none=Knowledge to be deleted is not specified

knowledge.likes.title=User list that was me press the "Like"
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/appresource_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ knowledge.edit.set.slide.path=スライドショー
knowledge.edit.update.content=内容を更新しました
knowledge.edit.update.meta=属性情報のみ更新しました(更新の通知は送られません)
knowledge.edit.image.upload=画像をアップロード
knowledge.edit.do.not.update.timeline=タイムラインを更新しない(軽微な修正)
knowledge.delete.none=削除するナレッジが指定されていません

knowledge.likes.title=「いいね!」を押してくれたユーザ一覧
Expand Down
6 changes: 5 additions & 1 deletion src/main/webapp/WEB-INF/views/admin/database/connection.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@
</label>
</div>
<div class="form-group">
<label for="uRL"><%=jspUtil.label("knowledge.connection.label.URL")%></label> <input type="text" class="form-control" name="uRL"
<label for="uRL">
<%=jspUtil.label("knowledge.connection.label.URL")%>
<span class="small">(<%=jspUtil.label("knowledge.connection.msg.info.url")%>)</span>
</label>
<input type="text" class="form-control" name="uRL"
id="uRL" placeholder="<%=jspUtil.label("knowledge.connection.msg.info.url")%>" value="<%=jspUtil.out("uRL")%>" />
</div>
<div class="form-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
}
%>
<div class="article_buttons">
<div class="checkbox">
<label>
<input type="checkbox" name="notUpdateTimeline" value="true">
<%= jspUtil.label("knowledge.edit.do.not.update.timeline") %>
</label>
</div>
<div>
<button type="button" class="btn btn-primary btn_1" id="releasebutton">
<i class="fa fa-rocket"></i>&nbsp;<%= jspUtil.label("label.release") %>
Expand Down

0 comments on commit 820492b

Please sign in to comment.