mirror of
https://github.com/discourse/discourse-rewind.git
synced 2025-07-06 22:02:12 +00:00
Merge branch 'main' of https://github.com/jjaffeux/discourse-rewind into main
This commit is contained in:
commit
0d25800241
@ -57,7 +57,6 @@ module DiscourseRewind
|
||||
.where(posts: { user_id: user.id })
|
||||
.where(created_at: date)
|
||||
.group(:reaction_value)
|
||||
.limit(5)
|
||||
.count,
|
||||
)
|
||||
end
|
||||
@ -85,7 +84,7 @@ module DiscourseRewind
|
||||
end
|
||||
|
||||
def sort_and_limit(reactions)
|
||||
reactions.sort_by { |_, v| v }.first(5).to_h
|
||||
reactions.sort_by { |_, v| -v }.first(5).reverse.to_h
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -51,19 +51,19 @@ module DiscourseRewind
|
||||
end
|
||||
|
||||
def fetch_reports(date:, user:, guardian:, year:)
|
||||
key = "rewind:#{guardian.user.username}:#{year}"
|
||||
reports = Discourse.redis.get(key)
|
||||
# key = "rewind:#{guardian.user.username}:#{year}"
|
||||
# reports = Discourse.redis.get(key)
|
||||
|
||||
if Rails.env.development? || !reports
|
||||
reports =
|
||||
::DiscourseRewind::Rewind::Action::BaseReport
|
||||
.descendants
|
||||
.filter { _1.enabled? }
|
||||
.map { |report| report.call(date:, user:, guardian:) }
|
||||
Discourse.redis.setex(key, CACHE_DURATION, MultiJson.dump(reports))
|
||||
else
|
||||
reports = MultiJson.load(reports.compact, symbolize_keys: true)
|
||||
end
|
||||
# if Rails.env.development? || !reports
|
||||
reports =
|
||||
::DiscourseRewind::Rewind::Action::BaseReport
|
||||
.descendants
|
||||
.filter { _1.enabled? }
|
||||
.map { |report| report.call(date:, user:, guardian:) }
|
||||
# Discourse.redis.setex(key, CACHE_DURATION, MultiJson.dump(reports))
|
||||
# else
|
||||
# reports = MultiJson.load(reports.compact, symbolize_keys: true)
|
||||
# end
|
||||
|
||||
reports
|
||||
end
|
||||
|
@ -53,7 +53,9 @@
|
||||
left: -4px;
|
||||
top: -4px;
|
||||
content: "";
|
||||
background-image: url(/plugins/discourse-rewind/images/rewind-avatar-2-shimmer.gif);
|
||||
background-image: absolute-image-url(
|
||||
"/plugins/discourse-rewind/images/rewind-avatar-2-shimmer.gif"
|
||||
);
|
||||
display: block;
|
||||
background-size: cover;
|
||||
}
|
||||
|
@ -49,7 +49,9 @@
|
||||
}
|
||||
|
||||
.background-1 {
|
||||
background: url(/plugins/discourse-rewind/images/blur-bg.png);
|
||||
background: absolute-image-url(
|
||||
"/plugins/discourse-rewind/images/blur-bg.png"
|
||||
);
|
||||
@if is-dark-color-scheme() {
|
||||
opacity: 0.15;
|
||||
}
|
||||
@ -68,6 +70,7 @@
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-bottom: var(--safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.rewind__exit-fullscreen-btn {
|
||||
|
Loading…
x
Reference in New Issue
Block a user