mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
Merge pull request #5610 from discourse/pm-tags
FEATURE: Allow staffs to tag PMs
This commit is contained in:
commit
dd26bbe868
33 changed files with 279 additions and 158 deletions
|
@ -140,7 +140,8 @@ export default Ember.Controller.extend({
|
|||
return !this.site.mobileView &&
|
||||
this.site.get('can_tag_topics') &&
|
||||
canEditTitle &&
|
||||
!creatingPrivateMessage;
|
||||
!creatingPrivateMessage &&
|
||||
(!this.get('model.topic.isPrivateMessage') || this.site.get('can_tag_pms'));
|
||||
},
|
||||
|
||||
@computed('model.whisper', 'model.unlistTopic')
|
||||
|
|
|
@ -104,7 +104,7 @@ export default Ember.Controller.extend(BufferedContent, {
|
|||
|
||||
@computed('model.isPrivateMessage')
|
||||
canEditTags(isPrivateMessage) {
|
||||
return !isPrivateMessage && this.site.get('can_tag_topics');
|
||||
return this.site.get('can_tag_topics') && (!isPrivateMessage || this.site.get('can_tag_pms'));
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
|
|
@ -3,7 +3,12 @@ export default function renderTag(tag, params) {
|
|||
tag = Handlebars.Utils.escapeExpression(tag);
|
||||
const classes = ['tag-' + tag, 'discourse-tag'];
|
||||
const tagName = params.tagName || "a";
|
||||
const href = (tagName === "a" && !params.noHref) ? " href='" + Discourse.getURL("/tags/" + tag) + "' " : "";
|
||||
let path;
|
||||
if (tagName === "a" && !params.noHref) {
|
||||
const current_user = Discourse.User.current();
|
||||
path = params.isPrivateMessage ? `/u/${current_user.username}/messages/tag/${tag}` : `/tags/${tag}`;
|
||||
}
|
||||
const href = path ? ` href='${Discourse.getURL(path)}' ` : "";
|
||||
|
||||
if (Discourse.SiteSettings.tag_style || params.style) {
|
||||
classes.push(params.style || Discourse.SiteSettings.tag_style);
|
||||
|
|
|
@ -20,6 +20,7 @@ export function addTagsHtmlCallback(callback, options) {
|
|||
export default function(topic, params){
|
||||
let tags = topic.tags;
|
||||
let buffer = "";
|
||||
const isPrivateMessage = topic.get('isPrivateMessage');
|
||||
|
||||
if (params && params.mode === "list") {
|
||||
tags = topic.get("visibleListTags");
|
||||
|
@ -43,7 +44,7 @@ export default function(topic, params){
|
|||
buffer = "<div class='discourse-tags'>";
|
||||
if (tags) {
|
||||
for(let i=0; i<tags.length; i++){
|
||||
buffer += renderTag(tags[i]) + ' ';
|
||||
buffer += renderTag(tags[i], { isPrivateMessage }) + ' ';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ export default function() {
|
|||
this.route('archive');
|
||||
this.route('group', { path: 'group/:name'});
|
||||
this.route('groupArchive', { path: 'group/:name/archive'});
|
||||
this.route('tag', { path: 'tag/:id'});
|
||||
});
|
||||
|
||||
this.route('preferences', { resetNamespace: true }, function() {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import createPMRoute from "discourse/routes/build-private-messages-route";
|
||||
|
||||
export default createPMRoute('tags', 'private-messages-tags').extend({
|
||||
model(params) {
|
||||
const username = this.modelFor("user").get("username_lower");
|
||||
return this.store.findFiltered("topicList", {
|
||||
filter: `topics/private-messages-tag/${username}/${params.id}`
|
||||
});
|
||||
}
|
||||
});
|
|
@ -1,13 +1,13 @@
|
|||
{{#if topic.category.parentCategory}}
|
||||
{{bound-category-link topic.category.parentCategory}}
|
||||
{{/if}}
|
||||
{{bound-category-link topic.category hideParent=true}}
|
||||
{{#unless topic.isPrivateMessage}}
|
||||
{{#if topic.category.parentCategory}}
|
||||
{{bound-category-link topic.category.parentCategory}}
|
||||
{{/if}}
|
||||
{{bound-category-link topic.category hideParent=true}}
|
||||
{{/unless}}
|
||||
<div class="topic-header-extra">
|
||||
{{#if siteSettings.tagging_enabled}}
|
||||
<div class="list-tags">
|
||||
{{#each topic.tags as |t|}}
|
||||
{{discourse-tag t}}
|
||||
{{/each}}
|
||||
{{discourse-tags topic mode="list"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{#if siteSettings.topic_featured_link_enabled}}
|
||||
|
|
|
@ -63,9 +63,7 @@
|
|||
{{/if}}
|
||||
</h1>
|
||||
|
||||
{{#unless model.isPrivateMessage}}
|
||||
{{topic-category topic=model class="topic-category"}}
|
||||
{{/unless}}
|
||||
{{topic-category topic=model class="topic-category"}}
|
||||
{{/if}}
|
||||
{{/topic-title}}
|
||||
{{/if}}
|
||||
|
|
|
@ -189,7 +189,7 @@
|
|||
.category-input {
|
||||
display: flex;
|
||||
flex: 1 0 35%;
|
||||
margin: 0 0 5px 10px;
|
||||
margin: 0 5px 5px 10px;
|
||||
@media screen and (max-width: 955px) {
|
||||
flex: 1 0 100%;
|
||||
margin-left: 0;
|
||||
|
@ -223,7 +223,7 @@
|
|||
|
||||
.mini-tag-chooser {
|
||||
flex: 1 1 25%;
|
||||
margin: 0 0 5px 5px;
|
||||
margin: 0 0 5px 0;
|
||||
background: $secondary;
|
||||
@media all and (max-width: 900px) {
|
||||
margin: 0;
|
||||
|
|
|
@ -122,6 +122,10 @@ a.badge-category {
|
|||
}
|
||||
}
|
||||
|
||||
.archetype-private_message #topic-title .edit-topic-title .tag-chooser {
|
||||
margin-left: 19px;
|
||||
}
|
||||
|
||||
.private_message {
|
||||
#topic-title {
|
||||
.edit-topic-title {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue