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), hasHistory: Em.computed.gt('version', 1),
postElementId: Discourse.computed.fmt('post_number', 'post_%@'), postElementId: Discourse.computed.fmt('post_number', 'post_%@'),
canViewRawEmail: function() {
return Discourse.User.currentProp('staff');
}.property(),
bookmarkedChanged: function() { bookmarkedChanged: function() {
Discourse.Post.bookmark(this.get('id'), this.get('bookmarked')) Discourse.Post.bookmark(this.get('id'), this.get('bookmarked'))
.then(null, function (error) { .then(null, function (error) {

View File

@ -2,6 +2,6 @@
{{#if raw_email}} {{#if raw_email}}
<pre><code>{{raw_email}}</code></pre> <pre><code>{{raw_email}}</code></pre>
{{else}} {{else}}
Not Available! {{i18n raw_email.not_available}}
{{/if}} {{/if}}
</div> </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> <div class="post-info wiki" title="{{i18n post.wiki.about}}" {{action "editPost" this}}><i class="fa fa-pencil-square-o"></i></div>
{{/if}} {{/if}}
{{#if via_email}} {{#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}} {{/if}}
<div {{bind-attr class=":read-state read"}} title="{{i18n post.unread}}"><i class='fa fa-circle'></i></div> <div {{bind-attr class=":read-state read"}} title="{{i18n post.unread}}"><i class='fa fa-circle'></i></div>
</div> </div>

View File

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

View File

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

View File

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