diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 1044876d7..933c6dac2 100755
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1732,6 +1732,9 @@ issues.attachment.open_tab = `Click to see "%s" in a new tab`
issues.attachment.download = `Click to download "%s"`
issues.subscribe = Subscribe
issues.unsubscribe = Unsubscribe
+issues.top_task=Top issue
+issues.top = Top
+issues.cancel_topping = Cancel topping
issues.lock = Lock conversation
issues.unlock = Unlock conversation
issues.lock.unknown_reason = Cannot lock an issue with an unknown reason.
diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index 5cef94087..e9953d22c 100755
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -1749,6 +1749,9 @@ issues.attachment.open_tab=`在新的标签页中查看 '%s'`
issues.attachment.download=`点击下载 '%s'`
issues.subscribe=订阅
issues.unsubscribe=取消订阅
+issues.top_task=置顶任务
+issues.top=置顶
+issues.cancel_topping=取消置顶
issues.lock=锁定对话
issues.unlock=解锁对话
issues.lock.unknown_reason=由于未知原因无法锁定。
diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl
index 1e29b6512..777859a7b 100644
--- a/templates/repo/issue/list.tmpl
+++ b/templates/repo/issue/list.tmpl
@@ -246,7 +246,9 @@
{{end}}
#{{.Index}}
{{RenderEmoji .Title}}
-
+ {{if eq .StayTop 1}}
+ {{$.i18n.Tr "repo.issues.top"}}
+ {{end}}
{{if .IsPull }}
{{if (index $.CommitStatus .PullRequest.ID)}}
{{template "repo/commit_status" (index $.CommitStatus .PullRequest.ID)}}
@@ -264,7 +266,7 @@
{{if .TotalTrackedTime}}
{{end}}
-
+
{{ $timeStr := TimeSinceUnix .GetLastEventTimestamp $.Lang }}
{{if .OriginalAuthor }}
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index e6a61a567..772efb251 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -325,6 +325,25 @@
{{end}}
+
+ {{if and $.IssueWatch (not .Repository.IsArchived)}}
+
+
+
+
{{.i18n.Tr "repo.issues.top_task"}}
+
+
+
+
+
+ {{end}}
+
{{if .Repository.IsTimetrackerEnabled }}
{{if and .CanUseTimetracker (not .Repository.IsArchived)}}
@@ -646,4 +665,3 @@
{{end}}
{{end}}
-
diff --git a/web_src/js/index.js b/web_src/js/index.js
index 62eeaebd8..6666d78cf 100755
--- a/web_src/js/index.js
+++ b/web_src/js/index.js
@@ -56,6 +56,7 @@ import { Message } from "element-ui";
import { i18nVue } from "./features/i18nVue.js";
import './features/ad.js';
import { Fancybox } from "./vendor/fancybox.esm.js";
+import { resolveProjectReferencePath } from "typescript";
Vue.prototype.$axios = axios;
@@ -263,7 +264,20 @@ function updateIssuesMeta(url, action, issueIds, elementId, isAdd) {
});
});
}
-
+function updateIssueTop(url,param) {
+ return new Promise((resolve,reject) => {
+ $.ajax({
+ type: "POST",
+ url,
+ data: {
+ _csrf: csrf,
+ isStayTop:param,
+ },
+ success: resolve,
+ error:reject,
+ });
+ });
+}
function initRepoStatusChecker() {
const migrating = $("#repo_migrating");
$("#repo_migrating_failed").hide();
@@ -824,7 +838,19 @@ function initIssueComments() {
event.preventDefault();
updateIssuesMeta(url, "", issueId, id, isChecked).then(reload);
});
-
+ $("#stayTopIssue").on("click", function (event){
+ const url = $(this).data("update-url");
+ const isIssueTop = $(this).data("issue-top");
+ updateIssueTop(url, isIssueTop).then((res, rej) => {
+ console.log(res)
+ if (res.code === 0){
+ reload()
+ }
+ }).catch((err) => {
+ console.log(err)
+ })
+ event.preventDefault();
+ })
$(document).on("click", (event) => {
const urlTarget = $(":target");
if (urlTarget.length === 0) return;