only staff can view raw email

This commit is contained in:
Arpit Jalan 2014-10-17 22:58:23 +05:30
parent 2131a37811
commit 3854c0a29e
6 changed files with 20 additions and 5 deletions

View File

@ -64,6 +64,10 @@ Discourse.Post = Discourse.Model.extend({
hasHistory: Em.computed.gt('version', 1),
postElementId: Discourse.computed.fmt('post_number', 'post_%@'),
canViewRawEmail: function() {
return Discourse.User.currentProp('staff');
}.property(),
bookmarkedChanged: function() {
Discourse.Post.bookmark(this.get('id'), this.get('bookmarked'))
.then(null, function (error) {

View File

@ -2,6 +2,6 @@
{{#if raw_email}}
<pre><code>{{raw_email}}</code></pre>
{{else}}
Not Available!
{{i18n raw_email.not_available}}
{{/if}}
</div>

View File

@ -53,7 +53,11 @@
<div class="post-info wiki" title="{{i18n post.wiki.about}}" {{action "editPost" this}}><i class="fa fa-pencil-square-o"></i></div>
{{/if}}
{{#if via_email}}
<div class="post-info via-email" title="{{i18n post.via_email}}" {{action "showRawEmail" this}}><i class="fa fa-envelope-o"></i></div>
{{#if canViewRawEmail}}
<div class="post-info via-email raw-email" title="{{i18n post.via_email}}" {{action "showRawEmail" this}}><i class="fa fa-envelope-o"></i></div>
{{else}}
<div class="post-info via-email" title="{{i18n post.via_email}}"><i class="fa fa-envelope-o"></i></div>
{{/if}}
{{/if}}
<div {{bind-attr class=":read-state read"}} title="{{i18n post.unread}}"><i class='fa fa-circle'></i></div>
</div>

View File

@ -1,6 +1,6 @@
export default Discourse.ModalBodyView.extend({
templateName: 'modal/raw_email',
title: I18n.t('raw_email'),
title: I18n.t('raw_email.title'),
resizeModal: function(){
var viewPortHeight = $(window).height();

View File

@ -122,18 +122,21 @@ aside.quote {
.post-info {
&.wiki, &.via-email {
cursor: pointer;
margin-right: 5px;
i.fa {
font-size: 14px;
}
}
&.wiki {
cursor: pointer;
color: $wiki;
}
&.via-email {
color: scale-color($primary, $lightness: 70%);
}
&.raw-email {
cursor: pointer;
}
}

View File

@ -1382,9 +1382,13 @@ en:
users_lowercase: "users"
category_title: "Category"
history: "History"
raw_email: "Raw Email"
changed_by: "by {{author}}"
raw_email:
title: "Raw Email"
not_available: "Not available!"
categories_list: "Categories List"
filters: