mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: show watched first post in user page
This commit is contained in:
parent
4161ee210a
commit
f1b1b0da14
@ -182,8 +182,9 @@ const User = RestModel.extend({
|
|||||||
|
|
||||||
var updatedState = {};
|
var updatedState = {};
|
||||||
|
|
||||||
['muted','watched','tracked'].forEach(s => {
|
['muted','watched','tracked','watched_first_post'].forEach(s => {
|
||||||
let cats = this.get(s + 'Categories').map(c => c.get('id'));
|
let prop = s === "watched_first_post" ? "watchedFirstPostCategories" : s + "Categories";
|
||||||
|
let cats = this.get(prop).map(c => c.get('id'));
|
||||||
updatedState[s + '_category_ids'] = cats;
|
updatedState[s + '_category_ids'] = cats;
|
||||||
|
|
||||||
// HACK: denote lack of categories
|
// HACK: denote lack of categories
|
||||||
@ -360,14 +361,9 @@ const User = RestModel.extend({
|
|||||||
this.set("watchedCategories", Discourse.Category.findByIds(this.watched_category_ids));
|
this.set("watchedCategories", Discourse.Category.findByIds(this.watched_category_ids));
|
||||||
},
|
},
|
||||||
|
|
||||||
changedCategoryNotifications: function(type) {
|
@observes("watched_first_post_category_ids")
|
||||||
const ids = this.get(type + "Categories").map(c => c.id);
|
updateWatchedFirstPostCategories() {
|
||||||
const oldIds = this.get(type + "_category_ids");
|
this.set("watchedFirstPostCategories", Discourse.Category.findByIds(this.watched_first_post_category_ids));
|
||||||
|
|
||||||
return {
|
|
||||||
add: _.difference(ids, oldIds),
|
|
||||||
remove: _.difference(oldIds, ids),
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("can_delete_account", "reply_count", "topic_count")
|
@computed("can_delete_account", "reply_count", "topic_count")
|
||||||
|
@ -264,6 +264,11 @@
|
|||||||
{{category-group categories=model.trackedCategories blacklist=selectedCategories}}
|
{{category-group categories=model.trackedCategories blacklist=selectedCategories}}
|
||||||
</div>
|
</div>
|
||||||
<div class="instructions">{{i18n 'user.tracked_categories_instructions'}}</div>
|
<div class="instructions">{{i18n 'user.tracked_categories_instructions'}}</div>
|
||||||
|
<div class="controls category-controls">
|
||||||
|
<label><span class="icon fa fa-dot-circle-o watching-first-post"></span> {{i18n 'user.watched_first_post_categories'}}</label>
|
||||||
|
{{category-group categories=model.watchedFirstPostCategories}}
|
||||||
|
</div>
|
||||||
|
<div class="instructions">{{i18n 'user.watched_first_post_categories_instructions'}}</div>
|
||||||
<div class="controls category-controls">
|
<div class="controls category-controls">
|
||||||
<label><span class="icon fa fa-times-circle muted"></span> {{i18n 'user.muted_categories'}}</label>
|
<label><span class="icon fa fa-times-circle muted"></span> {{i18n 'user.muted_categories'}}</label>
|
||||||
{{category-group categories=model.mutedCategories blacklist=selectedCategories}}
|
{{category-group categories=model.mutedCategories blacklist=selectedCategories}}
|
||||||
|
@ -288,3 +288,7 @@ and (max-width : 600px) {
|
|||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-preferences .watching-first-post.fa-dot-circle-o {
|
||||||
|
color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
|
||||||
|
}
|
||||||
|
@ -88,6 +88,7 @@ class UserSerializer < BasicUserSerializer
|
|||||||
:muted_tags,
|
:muted_tags,
|
||||||
:tracked_category_ids,
|
:tracked_category_ids,
|
||||||
:watched_category_ids,
|
:watched_category_ids,
|
||||||
|
:watched_first_post_category_ids,
|
||||||
:private_messages_stats,
|
:private_messages_stats,
|
||||||
:system_avatar_upload_id,
|
:system_avatar_upload_id,
|
||||||
:system_avatar_template,
|
:system_avatar_template,
|
||||||
@ -273,6 +274,10 @@ class UserSerializer < BasicUserSerializer
|
|||||||
CategoryUser.lookup(object, :watching).pluck(:category_id)
|
CategoryUser.lookup(object, :watching).pluck(:category_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def watched_first_post_category_ids
|
||||||
|
CategoryUser.lookup(object, :watching_first_post).pluck(:category_id)
|
||||||
|
end
|
||||||
|
|
||||||
def muted_usernames
|
def muted_usernames
|
||||||
MutedUser.where(user_id: object.id).joins(:muted_user).pluck(:username)
|
MutedUser.where(user_id: object.id).joins(:muted_user).pluck(:username)
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
class UserUpdater
|
class UserUpdater
|
||||||
|
|
||||||
CATEGORY_IDS = {
|
CATEGORY_IDS = {
|
||||||
|
watched_first_post_category_ids: :watching_first_post,
|
||||||
watched_category_ids: :watching,
|
watched_category_ids: :watching,
|
||||||
tracked_category_ids: :tracking,
|
tracked_category_ids: :tracking,
|
||||||
muted_category_ids: :muted
|
muted_category_ids: :muted
|
||||||
|
@ -550,6 +550,8 @@ en:
|
|||||||
watched_categories_instructions: "You will automatically watch all topics in these categories. You will be notified of all new posts and topics, and a count of new posts will also appear next to the topic."
|
watched_categories_instructions: "You will automatically watch all topics in these categories. You will be notified of all new posts and topics, and a count of new posts will also appear next to the topic."
|
||||||
tracked_categories: "Tracked"
|
tracked_categories: "Tracked"
|
||||||
tracked_categories_instructions: "You will automatically track all new topics in these categories. A count of new posts will appear next to the topic."
|
tracked_categories_instructions: "You will automatically track all new topics in these categories. A count of new posts will appear next to the topic."
|
||||||
|
watched_first_post_categories: "Watching First Post Only"
|
||||||
|
watched_first_post_categories_instructions: "You will be notified of the first post in each new topic in these categories."
|
||||||
muted_categories: "Muted"
|
muted_categories: "Muted"
|
||||||
muted_categories_instructions: "You will not be notified of anything about new topics in these categories, and they will not appear in latest."
|
muted_categories_instructions: "You will not be notified of anything about new topics in these categories, and they will not appear in latest."
|
||||||
delete_account: "Delete My Account"
|
delete_account: "Delete My Account"
|
||||||
|
Loading…
Reference in New Issue
Block a user