Skip to content

Commit c89dbfc

Browse files
committed
feat: add plugin private-replies
1 parent 67520cb commit c89dbfc

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

misc/all.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.restricted > svg { display: none; }
2+
.alert-too-few-topics { display: none; }

misc/desktop.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
var re = /^\/c\/site-feedback\/2$/i
2+
var re = /\/c\/course\/programming\/10/i
33
setInterval(function () {
44
var $ = function (sel) { return document.querySelector(sel) }
55
if (re.test(location.pathname)) setTimeout(function () {
@@ -12,22 +12,22 @@
1212
$('#create-pm').onclick = function () {
1313
require('discourse/mixins/open-composer').default.mixins[0].properties.openComposerWithMessageParams.call(
1414
{ controllerFor: function () { return Discourse.__container__.lookup('controller:composer') } },
15-
{ recipients: 'moderators', hasGroups: true },
15+
{ recipients: 'Programming-TAs', hasGroups: true },
1616
)
1717
}
1818
}
1919
}, 100)
20-
var msgLink = $('[href=\\/messages]')
21-
if (msgLink) msgLink.href = '/u/' + Discourse.currentUser.username + '/messages/sent'
20+
if (!Discourse.currentUser.groups.some(function (x) { return x.name === 'Programming-TAs' })) return
2221
if ($('#ta-convert-public')) return
2322
var aRP = $('.add-remove-participant-btn')
2423
if (aRP) {
2524
var wrapper = document.createElement('div')
2625
wrapper.innerHTML = '<button id="ta-convert-public" class="btn-default btn btn-icon-text ember-view" type="button"><span class="d-button-label">设为公开话题</span></button>'
2726
aRP.parentElement.insertBefore(wrapper, aRP)
2827
$('#ta-convert-public').onclick = function () {
28+
$('#ta-convert-public').disabled = true
2929
var id = $('h1[data-topic-id]').getAttribute('data-topic-id')
30-
fetch('http://localhost/t/' + id + '/convert-topic/public', {
30+
fetch('/t/' + id + '/convert-topic/public', {
3131
credentials: "include",
3232
headers: {
3333
'X-CSRF-Token': require('discourse/models/session').default.current().csrfToken,
@@ -36,10 +36,9 @@
3636
"Discourse-Present": "true",
3737
'X-Requested-With': 'XMLHttpRequest',
3838
},
39-
"body": "category_id=2",
39+
"body": "category_id=10",
4040
"method": "PUT",
41-
});
42-
location.reload()
41+
}).then(() => location.reload())
4342
}
4443
}
4544
}, 500)

misc/mobile.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
<script>
2-
var re = /^\/c\/site-feedback\/2$/i
2+
var re = /\/c\/course\/programming\/10/i
33

44
api.modifyClass("component:discovery-topics-list", {
55
didInsertElement() {
6-
var msgLink = $('[href=\\/messages]')
7-
if (msgLink) msgLink.href = '/u/' + Discourse.currentUser.username + '/messages/sent'
86
if (re.test(location.pathname)) setTimeout(function () {
97
var $ = function (sel) { return document.querySelector(sel) }
108
var cT = $('#create-topic')
@@ -15,7 +13,7 @@
1513
$('#create-pm').onclick = function () {
1614
require('discourse/mixins/open-composer').default.mixins[0].properties.openComposerWithMessageParams.call(
1715
{ controllerFor: function () { return Discourse.__container__.lookup('controller:composer') } },
18-
{ recipients: 'moderators', hasGroups: true },
16+
{ recipients: 'Programming-TAs', hasGroups: true },
1917
)
2018
}
2119
}

samples/acm2021.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ hooks:
115115
- git clone https://github.com/acm-21/discourse-onebox-acmoj.git
116116
- git clone https://github.com/acm-21/discourse-onebox-bilibili.git
117117
- git clone https://github.com/acm-21/discourse-shadow-inherit-groups.git
118+
- git clone https://github.com/acm-21/discourse-private-replies.git
118119
# - git clone https://github.com/discourse/sticky-avatars.git
119120
# - git clone https://github.com/discourse/unformatted-code-detector.git
120121
# - git clone https://github.com/discourse/Discourse-nav-links-component.git

0 commit comments

Comments
 (0)