FIX: Clicking users in Private Messages Map should show card
This commit is contained in:
parent
901380224b
commit
0a78cdbd83
|
@ -1,5 +1,5 @@
|
||||||
import { iconHTML } from 'discourse/helpers/fa-icon';
|
import { iconHTML } from 'discourse/helpers/fa-icon';
|
||||||
import computed from 'ember-addons/ember-computed-decorators';
|
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
tagName: 'button',
|
tagName: 'button',
|
||||||
|
@ -18,6 +18,11 @@ export default Ember.Component.extend({
|
||||||
if (label) return I18n.t(label);
|
if (label) return I18n.t(label);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@observes('icon')
|
||||||
|
iconChanged() {
|
||||||
|
this.rerender();
|
||||||
|
},
|
||||||
|
|
||||||
render(buffer) {
|
render(buffer) {
|
||||||
const label = this.get('translatedLabel'),
|
const label = this.get('translatedLabel'),
|
||||||
icon = this.get('icon');
|
icon = this.get('icon');
|
||||||
|
|
|
@ -1,12 +1,3 @@
|
||||||
/**
|
|
||||||
The topic map underneath the first post of a topic.
|
|
||||||
|
|
||||||
@class TopicMapComponent
|
|
||||||
@extends Ember.Component
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
|
|
||||||
var LINKS_SHOWN = 5;
|
var LINKS_SHOWN = 5;
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
export default Ember.Component.extend({
|
||||||
|
@ -25,7 +16,7 @@ export default Ember.Component.extend({
|
||||||
showPosterAvatar: Em.computed.gt('topic.posts_count', 2),
|
showPosterAvatar: Em.computed.gt('topic.posts_count', 2),
|
||||||
|
|
||||||
toggleMapClass: function() {
|
toggleMapClass: function() {
|
||||||
return this.get('mapCollapsed') ? 'fa fa-chevron-down' : 'fa fa-chevron-up';
|
return this.get('mapCollapsed') ? 'chevron-down' : 'chevron-up';
|
||||||
}.property('mapCollapsed'),
|
}.property('mapCollapsed'),
|
||||||
|
|
||||||
showAllLinksControls: function() {
|
showAllLinksControls: function() {
|
||||||
|
|
|
@ -8,8 +8,8 @@ export default Ember.Component.extend({
|
||||||
}.property('postStream.userFilters.[]'),
|
}.property('postStream.userFilters.[]'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
toggle: function() {
|
toggle() {
|
||||||
var postStream = this.get('postStream');
|
const postStream = this.get('postStream');
|
||||||
if (postStream) {
|
if (postStream) {
|
||||||
postStream.toggleParticipant(this.get('participant.username'));
|
postStream.toggleParticipant(this.get('participant.username'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ export default Ember.Component.extend(StringBuffer, {
|
||||||
});
|
});
|
||||||
buffer.push(I18n.t('post.actions.people.like',{icons: iconsHtml}));
|
buffer.push(I18n.t('post.actions.people.like',{icons: iconsHtml}));
|
||||||
buffer.push("</div>");
|
buffer.push("</div>");
|
||||||
|
} else {
|
||||||
|
buffer.push("<span></span>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,7 +37,7 @@ const DiscourseURL = Ember.Object.createWithMixins({
|
||||||
const lockon = new LockOn(holderId, {offsetCalculator: offset});
|
const lockon = new LockOn(holderId, {offsetCalculator: offset});
|
||||||
const holder = $(holderId);
|
const holder = $(holderId);
|
||||||
|
|
||||||
if(holder.length > 0 && opts && opts.skipIfOnScreen){
|
if (holder.length > 0 && opts && opts.skipIfOnScreen){
|
||||||
|
|
||||||
// if we are on screen skip
|
// if we are on screen skip
|
||||||
const elementTop = lockon.elementTop(),
|
const elementTop = lockon.elementTop(),
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<h3><i class='fa fa-envelope'></i> {{i18n 'private_message_info.title'}}</h3>
|
<h3>{{fa-icon "envelope"}} {{i18n 'private_message_info.title'}}</h3>
|
||||||
<div class='participants clearfix'>
|
<div class='participants clearfix'>
|
||||||
{{#each ag in details.allowed_groups}}
|
{{#each details.allowed_groups as |ag|}}
|
||||||
<div class='user group'>
|
<div class='user group'>
|
||||||
#{{unbound ag.name}}
|
#{{unbound ag.name}}
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{#each au in details.allowed_users}}
|
{{#each details.allowed_users as |au|}}
|
||||||
<div class='user'>
|
<div class='user'>
|
||||||
{{#link-to 'user' au}}
|
{{#user-link user=au}}
|
||||||
{{avatar au imageSize="small"}}
|
{{avatar au imageSize="small"}}
|
||||||
{{/link-to}}
|
{{/user-link}}
|
||||||
{{#link-to 'user' au}}
|
{{#user-link user=au}}
|
||||||
{{unbound au.username}}
|
{{unbound au.username}}
|
||||||
{{/link-to}}
|
{{/user-link}}
|
||||||
{{#if au.details.can_remove_allowed_users}}
|
{{#if details.can_remove_allowed_users}}
|
||||||
<a class='remove-invited' {{action "removeAllowedUser" au}}><i class="fa fa-times"></i></a>
|
<a href class='remove-invited' {{action "removeAllowedUser" au}}>{{fa-icon "times"}}</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<nav class='buttons'>
|
<nav class='buttons'>
|
||||||
<button class='btn' {{action "toggleMap"}} title="{{i18n 'topic.toggle_information'}}">
|
{{d-button action="toggleMap" title="topic.toggle_information" icon=toggleMapClass}}
|
||||||
<i {{bind-attr class=":fa toggleMapClass"}}></i>
|
|
||||||
</button>
|
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<section {{bind-attr class=":map mapCollapsed"}}>
|
<section class="map {{if mapCollapsed 'map-collapsed'}}">
|
||||||
<ul class="clearfix">
|
<ul class="clearfix">
|
||||||
<li>
|
<li>
|
||||||
<a href='{{unbound topic.url}}'>
|
<a href='{{unbound topic.url}}'>
|
||||||
|
@ -45,8 +43,8 @@
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if showPosterAvatar}}
|
{{#if showPosterAvatar}}
|
||||||
<li {{bind-attr class=":avatars mapCollapsed::hidden"}}>
|
<li class="avatars {{unless mapCollapsed 'hidden'}}">
|
||||||
{{#each p in details.fewParticipants}}
|
{{#each details.fewParticipants as |p|}}
|
||||||
{{topic-participant participant=p}}
|
{{topic-participant participant=p}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</li>
|
</li>
|
||||||
|
@ -57,35 +55,35 @@
|
||||||
{{#unless mapCollapsed}}
|
{{#unless mapCollapsed}}
|
||||||
<section class='avatars clearfix'>
|
<section class='avatars clearfix'>
|
||||||
<h3>{{i18n 'topic_map.participants_title'}}</h3>
|
<h3>{{i18n 'topic_map.participants_title'}}</h3>
|
||||||
{{#each p in details.participants}}
|
{{#each details.participants as |p|}}
|
||||||
{{topic-participant participant=p}}
|
{{topic-participant participant=p}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{{#if infoLinks}}
|
{{#if infoLinks}}
|
||||||
<section class='links'>
|
<section class='links'>
|
||||||
<h3>{{i18n 'topic_map.links_title'}}</h3>
|
<h3>{{i18n 'topic_map.links_title'}}</h3>
|
||||||
<table class='topic-links'>
|
<table class='topic-links'>
|
||||||
{{#each infoLinks as |link|}}
|
{{#each infoLinks as |link|}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<span class='badge badge-notification clicks' title='{{i18n 'topic_map.clicks' count=link.clicks}}'>{{link.clicks}}</span>
|
<span class='badge badge-notification clicks' title='{{i18n 'topic_map.clicks' count=link.clicks}}'>{{link.clicks}}</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{unbound link.url}}" target="_blank" class='topic-link track-link {{if link.attachment "attachment"}}' data-user-id="{{unbound link.user_id}}" data-ignore-post-id="true" title="{{unbound link.url}}">
|
<a href="{{unbound link.url}}" target="_blank" class='topic-link track-link {{if link.attachment "attachment"}}' data-user-id="{{unbound link.user_id}}" data-ignore-post-id="true" title="{{unbound link.url}}">
|
||||||
{{#if link.title}}{{link.title}}{{else}}{{shorten-url link.url}}{{/if}}
|
{{#if link.title}}{{link.title}}{{else}}{{shorten-url link.url}}{{/if}}
|
||||||
</a>
|
</a>
|
||||||
{{link-domain link}}
|
{{link-domain link}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{{#if showAllLinksControls}}
|
{{#if showAllLinksControls}}
|
||||||
<div class='link-summary'>
|
<div class='link-summary'>
|
||||||
<a href {{action "showAllLinks"}}>{{i18n 'topic_map.links_shown' totalLinks=details.links.length}}</a>
|
<a href {{action "showAllLinks"}}>{{i18n 'topic_map.links_shown' totalLinks=details.links.length}}</a>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<a href {{bind-attr class=":poster toggled"}} {{action "toggle"}} title="{{unbound participant.username}}">
|
<a href {{bind-attr class=":poster toggled"}} {{action "toggle"}} title={{unbound participant.username}}>
|
||||||
{{#if showPostCount}}
|
{{#if showPostCount}}
|
||||||
<span class='post-count'>{{unbound participant.post_count}}</span>
|
<span class='post-count'>{{unbound participant.post_count}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -1,57 +1,46 @@
|
||||||
import PrivateMessageMapComponent from 'discourse/components/private-message-map';
|
import ContainerView from 'discourse/views/container';
|
||||||
import TopicMapComponent from 'discourse/components/topic-map';
|
import { default as property, observes, on } from 'ember-addons/ember-computed-decorators';
|
||||||
import ToggleSummaryComponent from 'discourse/components/toggle-summary';
|
|
||||||
import ToggleDeletedComponent from 'discourse/components/toggle-deleted';
|
|
||||||
import DiscourseContainerView from 'discourse/views/container';
|
|
||||||
|
|
||||||
export default DiscourseContainerView.extend({
|
export default ContainerView.extend({
|
||||||
classNameBindings: ['hidden', ':topic-map'],
|
classNameBindings: ['hidden', ':topic-map'],
|
||||||
|
|
||||||
_postsChanged: function() {
|
@observes('topic.posts_count')
|
||||||
|
_postsChanged() {
|
||||||
Ember.run.once(this, 'rerender');
|
Ember.run.once(this, 'rerender');
|
||||||
}.observes('topic.posts_count'),
|
},
|
||||||
|
|
||||||
hidden: function() {
|
@property
|
||||||
|
hidden() {
|
||||||
if (!this.get('post.firstPost')) return true;
|
if (!this.get('post.firstPost')) return true;
|
||||||
|
|
||||||
var topic = this.get('topic');
|
const topic = this.get('topic');
|
||||||
if (topic.get('archetype') === 'private_message') return false;
|
if (topic.get('archetype') === 'private_message') return false;
|
||||||
if (topic.get('archetype') !== 'regular') return true;
|
if (topic.get('archetype') !== 'regular') return true;
|
||||||
return topic.get('posts_count') < 2;
|
return topic.get('posts_count') < 2;
|
||||||
}.property(),
|
},
|
||||||
|
|
||||||
init: function() {
|
@on('init')
|
||||||
this._super();
|
startAppending() {
|
||||||
if (this.get('hidden')) return;
|
if (this.get('hidden')) return;
|
||||||
|
|
||||||
this.attachViewWithArgs({ topic: this.get('topic') }, TopicMapComponent);
|
this.attachViewWithArgs({ topic: this.get('topic') }, 'topic-map');
|
||||||
this.trigger('appendMapInformation', this);
|
this.trigger('appendMapInformation', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
appendMapInformation: function(container) {
|
appendMapInformation(view) {
|
||||||
var topic = this.get('topic');
|
const topic = this.get('topic');
|
||||||
|
|
||||||
// If we have a summary capability
|
|
||||||
if (topic.get('has_summary')) {
|
if (topic.get('has_summary')) {
|
||||||
container.attachViewWithArgs({
|
view.attachViewWithArgs({ topic, filterBinding: 'controller.filter' }, 'toggle-summary');
|
||||||
topic: topic,
|
|
||||||
filterBinding: 'controller.filter'
|
|
||||||
}, ToggleSummaryComponent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Discourse.User.currentProp('staff')) {
|
const currentUser = this.get('controller.currentUser');
|
||||||
// If we have deleted post filtering
|
if (currentUser && currentUser.get('staff') && topic.get('has_deleted')) {
|
||||||
if (topic.get('has_deleted')) {
|
view.attachViewWithArgs({ topic, filterBinding: 'controller.filter' }, 'topic-deleted');
|
||||||
container.attachViewWithArgs({
|
|
||||||
topic: topic,
|
|
||||||
filterBinding: 'controller.filter'
|
|
||||||
}, ToggleDeletedComponent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have a private message
|
|
||||||
if (this.get('topic.isPrivateMessage')) {
|
if (this.get('topic.isPrivateMessage')) {
|
||||||
container.attachViewWithArgs({ topic: topic, showPrivateInviteAction: 'showInvite' }, PrivateMessageMapComponent);
|
view.attachViewWithArgs({ topic, showPrivateInviteAction: 'showInvite' }, 'private-message-map');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue