2018-06-15 23:03:24 +08:00
|
|
|
import computed from "ember-addons/ember-computed-decorators";
|
2014-01-24 05:40:10 +08:00
|
|
|
|
2018-04-25 01:29:15 +08:00
|
|
|
export default Discourse.Model.extend({
|
2018-06-15 23:03:24 +08:00
|
|
|
@computed("days_visited", "time_period")
|
2018-04-25 01:29:15 +08:00
|
|
|
days_visited_percent(daysVisited, timePeriod) {
|
|
|
|
return Math.round((daysVisited * 100) / timePeriod);
|
|
|
|
},
|
|
|
|
|
2018-06-15 23:03:24 +08:00
|
|
|
@computed("min_days_visited", "time_period")
|
2018-04-25 01:29:15 +08:00
|
|
|
min_days_visited_percent(minDaysVisited, timePeriod) {
|
|
|
|
return Math.round((minDaysVisited * 100) / timePeriod);
|
|
|
|
},
|
2014-01-24 05:40:10 +08:00
|
|
|
|
2019-04-26 18:16:21 +08:00
|
|
|
@computed(
|
2018-06-15 23:03:24 +08:00
|
|
|
"days_visited",
|
|
|
|
"min_days_visited",
|
|
|
|
"num_topics_replied_to",
|
|
|
|
"min_topics_replied_to",
|
|
|
|
"topics_viewed",
|
|
|
|
"min_topics_viewed",
|
|
|
|
"posts_read",
|
|
|
|
"min_posts_read",
|
|
|
|
"num_flagged_posts",
|
|
|
|
"max_flagged_posts",
|
|
|
|
"topics_viewed_all_time",
|
|
|
|
"min_topics_viewed_all_time",
|
|
|
|
"posts_read_all_time",
|
|
|
|
"min_posts_read_all_time",
|
|
|
|
"num_flagged_by_users",
|
|
|
|
"max_flagged_by_users",
|
|
|
|
"num_likes_given",
|
|
|
|
"min_likes_given",
|
|
|
|
"num_likes_received",
|
|
|
|
"min_likes_received",
|
|
|
|
"num_likes_received",
|
|
|
|
"min_likes_received",
|
|
|
|
"num_likes_received_days",
|
|
|
|
"min_likes_received_days",
|
|
|
|
"num_likes_received_users",
|
|
|
|
"min_likes_received_users",
|
|
|
|
"trust_level_locked",
|
|
|
|
"penalty_counts.silenced",
|
|
|
|
"penalty_counts.suspended"
|
2018-04-25 01:29:15 +08:00
|
|
|
)
|
2019-04-26 18:16:21 +08:00
|
|
|
met() {
|
|
|
|
return {
|
2019-05-27 16:15:39 +08:00
|
|
|
days_visited: this.days_visited >= this.min_days_visited,
|
2019-04-26 18:16:21 +08:00
|
|
|
topics_replied_to:
|
2019-05-27 16:15:39 +08:00
|
|
|
this.num_topics_replied_to >= this.min_topics_replied_to,
|
|
|
|
topics_viewed: this.topics_viewed >= this.min_topics_viewed,
|
|
|
|
posts_read: this.posts_read >= this.min_posts_read,
|
2019-04-26 18:16:21 +08:00
|
|
|
topics_viewed_all_time:
|
2019-05-27 16:15:39 +08:00
|
|
|
this.topics_viewed_all_time >=
|
|
|
|
this.min_topics_viewed_all_time,
|
2019-04-26 18:16:21 +08:00
|
|
|
posts_read_all_time:
|
2019-05-27 16:15:39 +08:00
|
|
|
this.posts_read_all_time >= this.min_posts_read_all_time,
|
2019-04-26 18:16:21 +08:00
|
|
|
flagged_posts:
|
2019-05-27 16:15:39 +08:00
|
|
|
this.num_flagged_posts <= this.max_flagged_posts,
|
2019-04-26 18:16:21 +08:00
|
|
|
flagged_by_users:
|
2019-05-27 16:15:39 +08:00
|
|
|
this.num_flagged_by_users <= this.max_flagged_by_users,
|
|
|
|
likes_given: this.num_likes_given >= this.min_likes_given,
|
2019-04-26 18:16:21 +08:00
|
|
|
likes_received:
|
2019-05-27 16:15:39 +08:00
|
|
|
this.num_likes_received >= this.min_likes_received,
|
2019-04-26 18:16:21 +08:00
|
|
|
likes_received_days:
|
2019-05-27 16:15:39 +08:00
|
|
|
this.num_likes_received_days >=
|
|
|
|
this.min_likes_received_days,
|
2019-04-26 18:16:21 +08:00
|
|
|
likes_received_users:
|
2019-05-27 16:15:39 +08:00
|
|
|
this.num_likes_received_users >=
|
|
|
|
this.min_likes_received_users,
|
|
|
|
level_locked: this.trust_level_locked,
|
2019-04-26 18:16:21 +08:00
|
|
|
silenced: this.get("penalty_counts.silenced") === 0,
|
|
|
|
suspended: this.get("penalty_counts.suspended") === 0
|
|
|
|
};
|
|
|
|
}
|
2014-01-24 05:40:10 +08:00
|
|
|
});
|