mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 03:58:06 +08:00
Add unstarred_at column to topic_users so we can permanently track when topics are starred
This commit is contained in:
@ -569,7 +569,7 @@ class Topic < ActiveRecord::Base
|
||||
# Enable/disable the star on the topic
|
||||
def toggle_star(user, starred)
|
||||
Topic.transaction do
|
||||
TopicUser.change(user, id, starred: starred, starred_at: starred ? DateTime.now : nil)
|
||||
TopicUser.change(user, id, {starred: starred}.merge( starred ? {starred_at: DateTime.now, unstarred_at: nil} : {unstarred_at: DateTime.now}))
|
||||
|
||||
# Update the star count
|
||||
exec_sql "UPDATE topics
|
||||
|
Reference in New Issue
Block a user