mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: allow disabling user activity tab for non admin users (#25540)
* FEATURE: allow disabling user activity tab for non admin users * add another test case
This commit is contained in:
@@ -9,15 +9,16 @@
|
||||
<span>{{i18n "user.summary.title"}}</span>
|
||||
</DNavigationItem>
|
||||
|
||||
<DNavigationItem
|
||||
@route="userActivity"
|
||||
@ariaCurrentContext="parentNav"
|
||||
class="user-nav__activity"
|
||||
>
|
||||
{{d-icon "stream"}}
|
||||
<span>{{i18n "user.activity_stream"}}</span>
|
||||
</DNavigationItem>
|
||||
|
||||
{{#if @showActivityTab}}
|
||||
<DNavigationItem
|
||||
@route="userActivity"
|
||||
@ariaCurrentContext="parentNav"
|
||||
class="user-nav__activity"
|
||||
>
|
||||
{{d-icon "stream"}}
|
||||
<span>{{i18n "user.activity_stream"}}</span>
|
||||
</DNavigationItem>
|
||||
{{/if}}
|
||||
{{/unless}}
|
||||
|
||||
{{#if @showNotificationsTab}}
|
||||
|
||||
@@ -122,6 +122,11 @@ export default Controller.extend(CanCheckEmails, {
|
||||
);
|
||||
},
|
||||
|
||||
@discourseComputed("viewingSelf", "currentUser.admin")
|
||||
showActivityTab(viewingSelf, isAdmin) {
|
||||
return viewingSelf || isAdmin || !this.siteSettings.hide_user_activity_tab;
|
||||
},
|
||||
|
||||
@discourseComputed("viewingSelf", "currentUser.admin")
|
||||
showNotificationsTab(viewingSelf, isAdmin) {
|
||||
return viewingSelf || isAdmin;
|
||||
|
||||
@@ -460,6 +460,7 @@
|
||||
@user={{this.model}}
|
||||
@isStaff={{this.currentUser.staff}}
|
||||
@isMobileView={{this.site.mobileView}}
|
||||
@showActivityTab={{this.showActivityTab}}
|
||||
@showNotificationsTab={{this.showNotificationsTab}}
|
||||
@showPrivateMessages={{this.showPrivateMessages}}
|
||||
@canInviteToForum={{this.canInviteToForum}}
|
||||
|
||||
@@ -51,15 +51,25 @@
|
||||
@label="user.summary.posts_read"
|
||||
/>
|
||||
</li>
|
||||
<li class="stats-likes-given linked-stat">
|
||||
<LinkTo @route="userActivity.likesGiven">
|
||||
{{#if this.model.can_see_user_actions}}
|
||||
<li class="stats-likes-given linked-stat">
|
||||
<LinkTo @route="userActivity.likesGiven">
|
||||
<UserStat
|
||||
@value={{this.model.likes_given}}
|
||||
@icon="heart"
|
||||
@label="user.summary.likes_given"
|
||||
/>
|
||||
</LinkTo>
|
||||
</li>
|
||||
{{else}}
|
||||
<li class="stats-likes-given">
|
||||
<UserStat
|
||||
@value={{this.model.likes_given}}
|
||||
@icon="heart"
|
||||
@label="user.summary.likes_given"
|
||||
/>
|
||||
</LinkTo>
|
||||
</li>
|
||||
</li>
|
||||
{{/if}}
|
||||
<li class="stats-likes-received">
|
||||
<UserStat
|
||||
@value={{this.model.likes_received}}
|
||||
@@ -68,31 +78,58 @@
|
||||
/>
|
||||
</li>
|
||||
{{#if this.model.bookmark_count}}
|
||||
<li class="stats-bookmark-count linked-stat">
|
||||
<LinkTo @route="userActivity.bookmarks">
|
||||
{{#if this.model.can_see_user_actions}}
|
||||
<li class="stats-bookmark-count linked-stat">
|
||||
<LinkTo @route="userActivity.bookmarks">
|
||||
<UserStat
|
||||
@value={{this.model.bookmark_count}}
|
||||
@label="user.summary.bookmark_count"
|
||||
/>
|
||||
</LinkTo>
|
||||
</li>
|
||||
{{else}}
|
||||
<li class="stats-bookmark-count">
|
||||
<UserStat
|
||||
@value={{this.model.bookmark_count}}
|
||||
@label="user.summary.bookmark_count"
|
||||
/>
|
||||
</li>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if this.model.can_see_user_actions}}
|
||||
<li class="stats-topic-count linked-stat">
|
||||
<LinkTo @route="userActivity.topics">
|
||||
<UserStat
|
||||
@value={{this.model.topic_count}}
|
||||
@label="user.summary.topic_count"
|
||||
/>
|
||||
</LinkTo>
|
||||
</li>
|
||||
{{/if}}
|
||||
<li class="stats-topic-count linked-stat">
|
||||
<LinkTo @route="userActivity.topics">
|
||||
{{else}}
|
||||
<li class="stats-topic-count">
|
||||
<UserStat
|
||||
@value={{this.model.topic_count}}
|
||||
@label="user.summary.topic_count"
|
||||
/>
|
||||
</LinkTo>
|
||||
</li>
|
||||
<li class="stats-post-count linked-stat">
|
||||
<LinkTo @route="userActivity.replies">
|
||||
</li>
|
||||
{{/if}}
|
||||
{{#if this.model.can_see_user_actions}}
|
||||
<li class="stats-post-count linked-stat">
|
||||
<LinkTo @route="userActivity.replies">
|
||||
<UserStat
|
||||
@value={{this.model.post_count}}
|
||||
@label="user.summary.post_count"
|
||||
/>
|
||||
</LinkTo>
|
||||
</li>
|
||||
{{else}}
|
||||
<li class="stats-post-count">
|
||||
<UserStat
|
||||
@value={{this.model.post_count}}
|
||||
@label="user.summary.post_count"
|
||||
/>
|
||||
</LinkTo>
|
||||
</li>
|
||||
</li>
|
||||
{{/if}}
|
||||
<PluginOutlet
|
||||
@name="user-summary-stat"
|
||||
@connectorTagName="li"
|
||||
|
||||
@@ -94,12 +94,17 @@ class UserSummarySerializer < ApplicationSerializer
|
||||
:time_read,
|
||||
:recent_time_read,
|
||||
:bookmark_count,
|
||||
:can_see_summary_stats
|
||||
:can_see_summary_stats,
|
||||
:can_see_user_actions
|
||||
|
||||
def can_see_summary_stats
|
||||
scope.can_see_summary_stats?(object.user)
|
||||
end
|
||||
|
||||
def can_see_user_actions
|
||||
scope.can_see_user_actions?(object.user, [])
|
||||
end
|
||||
|
||||
def include_badges?
|
||||
SiteSetting.enable_badges
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user