mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 19:37:55 +08:00
Merge pull request #2462 from techAPJ/bookmarks-menu-patch
Make bookmarks menu appear all the time
This commit is contained in:
commit
ded274d204
|
@ -1,8 +1,6 @@
|
|||
export default Ember.ArrayController.extend(Discourse.HasCurrentUser, {
|
||||
showAdminLinks: Em.computed.alias("currentUser.staff"),
|
||||
|
||||
showBookmarksLink: Em.computed.alias("currentUser.hasBookmark"),
|
||||
|
||||
actions: {
|
||||
logout: function() {
|
||||
Discourse.logout();
|
||||
|
|
|
@ -11,7 +11,6 @@ Discourse.User = Discourse.Model.extend({
|
|||
hasPMs: Em.computed.gt("private_messages_stats.all", 0),
|
||||
hasStartedPMs: Em.computed.gt("private_messages_stats.mine", 0),
|
||||
hasUnreadPMs: Em.computed.gt("private_messages_stats.unread", 0),
|
||||
hasBookmark: Em.computed.gt('bookmarks_count', 0),
|
||||
|
||||
/**
|
||||
The user's stream
|
||||
|
|
|
@ -9,9 +9,7 @@
|
|||
{{#if currentUser.unread_private_messages}}<span class="badge-notification unread-private-messages">{{currentUser.unread_private_messages}}</span>{{/if}}{{i18n user.unread_message_count}}
|
||||
{{/link-to}}
|
||||
</li>
|
||||
{{#if showBookmarksLink}}
|
||||
<li>{{#link-to 'userActivity.bookmarks' currentUser}}{{i18n user.bookmarks}}{{/link-to}}</li>
|
||||
{{/if}}
|
||||
<li>{{#link-to 'userActivity.bookmarks' currentUser}}{{i18n user.bookmarks}}{{/link-to}}</li>
|
||||
<li>{{#link-to 'preferences' currentUser}}{{i18n user.preferences}}{{/link-to}}</li>
|
||||
<li><button {{action "logout"}} class='btn btn-danger right logout'><i class='fa fa-sign-out'></i>{{i18n user.log_out}}</button></li>
|
||||
</ul>
|
||||
|
|
|
@ -89,10 +89,6 @@ SQL
|
|||
{ all: all, mine: mine, unread: unread }
|
||||
end
|
||||
|
||||
def self.bookmarks_stats(user_id)
|
||||
UserAction.where(action_type: BOOKMARK, user_id: user_id).count
|
||||
end
|
||||
|
||||
def self.stream_item(action_id, guardian)
|
||||
stream(action_id: action_id, guardian: guardian).first
|
||||
end
|
||||
|
|
|
@ -10,7 +10,6 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
:staff?,
|
||||
:reply_count,
|
||||
:topic_count,
|
||||
:bookmarks_count,
|
||||
:enable_quoting,
|
||||
:external_links_in_new_tab,
|
||||
:dynamic_favicon,
|
||||
|
@ -38,10 +37,6 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
object.user_stat.topic_reply_count
|
||||
end
|
||||
|
||||
def bookmarks_count
|
||||
UserAction.bookmarks_stats(object.id)
|
||||
end
|
||||
|
||||
def site_flagged_posts_count
|
||||
PostAction.flagged_posts_count
|
||||
end
|
||||
|
|
|
@ -26,14 +26,3 @@ test("showAdminLinks", function() {
|
|||
currentUserStub.set("staff", false);
|
||||
equal(controller.get("showAdminLinks"), false, "is false when current user is not a staff member");
|
||||
});
|
||||
|
||||
test("showBookmarksLink", function() {
|
||||
var currentUserStub = Ember.Object.create();
|
||||
this.stub(Discourse.User, "current").returns(currentUserStub);
|
||||
|
||||
currentUserStub.set("hasBookmark", true);
|
||||
equal(controller.get("showBookmarksLink"), true, "is true when current user have bookmarks");
|
||||
|
||||
currentUserStub.set("hasBookmark", false);
|
||||
equal(controller.get("showBookmarksLink"), false, "is false when current user does not have bookmarks");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user