Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Chore/rename timestamps (#8765)

ulferts6cce947cbd06
diff --git a/app/cells/users/table_cell.rb b/app/cells/users/table_cell.rb
index 360fea0c815..dc2e7ffd341 100644
--- a/app/cells/users/table_cell.rb
+++ b/app/cells/users/table_cell.rb
@@ -1,7 +1,7 @@
module Users
class TableCell < ::TableCell
options :current_user # adds this option to those of the base class
- columns :login, :firstname, :lastname, :mail, :admin, :created_on, :last_login_on
+ columns :login, :firstname, :lastname, :mail, :admin, :created_at, :last_login_on
def initial_sort
[:id, :asc]
@@ -22,7 +22,7 @@ module Users
end
def desc_by_default
- [:admin, :created_on, :last_login_on]
+ [:admin, :created_at, :last_login_on]
end
end
end
diff --git a/app/controllers/enterprises_controller.rb b/app/controllers/enterprises_controller.rb
index 73cbeb10ecd..b209cdda1eb 100644
--- a/app/controllers/enterprises_controller.rb
+++ b/app/controllers/enterprises_controller.rb
@@ -103,7 +103,7 @@ class EnterprisesController < ApplicationController
if @trial_key
gon.ee_trial_key = {
value: @trial_key.value,
- created: @trial_key.created_on
+ created: @trial_key.created_at
}
end
end
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index ffaea91cb11..985ecfb8d33 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -48,10 +48,10 @@ class ForumsController < ApplicationController
end
def show
- sort_init 'updated_on', 'desc'
- sort_update 'created_on' => "#{Message.table_name}.created_on",
+ sort_init 'updated_at', 'desc'
+ sort_update 'created_at' => "#{Message.table_name}.created_at",
'replies' => "#{Message.table_name}.replies_count",
- 'updated_on' => "#{Message.table_name}.updated_on"
+ 'updated_at' => "#{Message.table_name}.updated_at"
respond_to do |format|
format.html do
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index f2a2c6e35f8..e626d84a149 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -51,10 +51,12 @@ class MessagesController < ApplicationController
page = 1 + offset / REPLIES_PER_PAGE
end
- @replies = @topic.children.includes(:author, :attachments, forum: :project)
- .order("#{Message.table_name}.created_on ASC")
- .page(page)
- .per_page(per_page_param)
+ @replies = @topic
+ .children
+ .includes(:author, :attachments, forum: :project)
+ .order(created_at: :asc)
+ .page(page)
+ .per_page(per_page_param)
@reply = Message.new(subject: "RE: #{@message.subject}", parent: @topic, forum: @topic.forum)
render action: 'show', layout: !request.xhr?
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 18c786cc01f..1439e9556c0 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -87,7 +87,7 @@ class WikiController < ApplicationController
# List of page, by last update
def date_index
load_pages_for_index
- @pages_by_date = @pages.group_by { |p| p.updated_on.to_date }
+ @pages_by_date = @pages.group_by { |p| p.updated_at.to_date }
end
def new; end
@@ -424,7 +424,7 @@ class WikiController < ApplicationController
end
def load_pages_for_index
- @pages = @wiki.pages.with_updated_on.order(Arel.sql('title')).includes(wiki: :project)
+ @pages = @wiki.pages.with_updated_at.order(Arel.sql('title')).includes(wiki: :project)
end
def default_breadcrumb
diff --git a/app/mailers/base_mailer.rb b/app/mailers/base_mailer.rb
index edb8a117acf..ed13eaa23f7 100644
--- a/app/mailers/base_mailer.rb
+++ b/app/mailers/base_mailer.rb
@@ -78,11 +78,7 @@ class BaseMailer < ActionMailer::Base
end
def mail_timestamp(object)
- if object.respond_to? :created_at
- object.send(object.respond_to?(:created_at) ? :created_at : :updated_at)
- else
- object.send(object.respond_to?(:created_on) ? :created_on : :updated_on)
- end
+ object.send(object.respond_to?(:created_at) ? :created_at : :updated_at)
end
def host
diff --git a/app/models/changeset.rb b/app/models/changeset.rb
index 84f463e0fec..6363e4b1448 100644
--- a/app/models/changeset.rb
+++ b/app/models/changeset.rb
@@ -33,7 +33,7 @@ class Changeset < ApplicationRecord
has_many :file_changes, class_name: 'Change', dependent: :delete_all
has_and_belongs_to_many :work_packages
- acts_as_journalized
+ acts_as_journalized timestamp: :committed_on
acts_as_event title: Proc.new { |o|
"#{I18n.t(:label_revision)} #{o.format_identifier}" + (o.short_comments.blank? ? '' : (': ' + o.short_comments))
diff --git a/app/models/journal/scopes/aggregated_journal.rb b/app/models/journal/scopes/aggregated_journal.rb
index e4878dcef1b..ccca1c8b701 100644
--- a/app/models/journal/scopes/aggregated_journal.rb
+++ b/app/models/journal/scopes/aggregated_journal.rb
@@ -256,6 +256,7 @@ module Journal::Scopes
#{notes_in_group_alias}.version notes_version,
#{version_projection} AS version,
#{created_at_projection} created_at,
+ #{updated_at_projection} updated_at,
#{id_projection} id
SQL
@@ -263,26 +264,26 @@ module Journal::Scopes
end
def id_projection
- <<~SQL
- CASE
- WHEN successor_notes.version IS NOT NULL THEN #{notes_in_group_alias}.id
- ELSE #{end_group_journals_alias}.id END
- SQL
+ attribute_projection(:id)
end
def version_projection
- <<~SQL
- CASE
- WHEN successor_notes.version IS NOT NULL THEN #{notes_in_group_alias}.version
- ELSE #{end_group_journals_alias}.version END
- SQL
+ attribute_projection(:version)
end
def created_at_projection
+ attribute_projection(:created_at)
+ end
+
+ def updated_at_projection
+ attribute_projection(:updated_at)
+ end
+
+ def attribute_projection(attribute)
<<~SQL
CASE
- WHEN successor_notes.version IS NOT NULL THEN #{notes_in_group_alias}.created_at
- ELSE #{end_group_journals_alias}.created_at END
+ WHEN successor_notes.version IS NOT NULL THEN #{notes_in_group_alias}.#{attribute}
+ ELSE #{end_group_journals_alias}.#{attribute} END
SQL
end
diff --git a/app/models/journal_version.rb b/app/models/journal_version.rb
deleted file mode 100644
index 9fb31575355..00000000000
--- a/app/models/journal_version.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#-- encoding: UTF-8
-#-- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2012-2020 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2017 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See docs/COPYRIGHT.rdoc for more details.
-#++
-
-class JournalVersion < ActiveRecord::Base
-end
diff --git a/app/models/message.rb b/app/models/message.rb
index c45f1ed5b99..8aeafd10098 100644
--- a/app/models/message.rb
+++ b/app/models/message.rb
@@ -33,7 +33,7 @@ class Message < ApplicationRecord
belongs_to :forum
has_one :project, through: :forum
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
- acts_as_tree counter_cache: :replies_count, order: "#{Message.table_name}.created_on ASC"
+ acts_as_tree counter_cache: :replies_count, order: "#{Message.table_name}.created_at ASC"
acts_as_attachable after_add: :attachments_changed,
after_remove: :attachments_changed,
add_on_new_permission: :add_messages,
@@ -44,7 +44,6 @@ class Message < ApplicationRecord
acts_as_event title: Proc.new { |o| "#{o.forum.name}: #{o.subject}" },
description: :content,
- datetime: :created_on,
type: Proc.new { |o| o.parent_id.nil? ? 'message' : 'reply' },
url: (Proc.new do |o|
msg = o
@@ -59,7 +58,7 @@ class Message < ApplicationRecord
include: { forum: :project },
references: [:forums],
project_key: 'project_id',
- date_column: "#{table_name}.created_on"
+ date_column: "#{table_name}.created_at"
acts_as_watchable
diff --git a/app/models/news.rb b/app/models/news.rb
index aa704a5d3f6..3cd83000f57 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -31,7 +31,7 @@ class News < ApplicationRecord
belongs_to :project
belongs_to :author, class_name: 'User', foreign_key: 'author_id'
has_many :comments, -> {
- order('created_on')
+ order(:created_at)
}, as: :commented, dependent: :delete_all
validates_presence_of :title
@@ -40,8 +40,7 @@ class News < ApplicationRecord
acts_as_journalized
- acts_as_event url: Proc.new { |o| { controller: '/news', action: 'show', id: o.id } },
- datetime: :created_at
+ acts_as_event url: Proc.new { |o| { controller: '/news', action: 'show', id: o.id } }
acts_as_searchable columns: ["#{table_name}.title", "#{table_name}.summary", "#{table_name}.description"],
include: :project,
diff --git a/app/models/setting.rb b/app/models/setting.rb
index c8f9e648f2c..28acb812496 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -165,7 +165,7 @@ class Setting < ApplicationRecord
new_setting.value = v
# Keep the current cache key,
- # since updated_on will change after .save
+ # since updated_at will change after .save
old_cache_key = cache_key
if new_setting.save
@@ -235,7 +235,7 @@ class Setting < ApplicationRecord
def self.clear_cache(key = cache_key)
Rails.cache.delete(key)
RequestStore.delete :cached_settings
- RequestStore.delete :settings_updated_on
+ RequestStore.delete :settings_updated_at
end
private
@@ -281,8 +281,8 @@ class Setting < ApplicationRecord
end
def self.cache_key
- RequestStore.store[:settings_updated_on] ||= Setting.maximum(:updated_on)
- most_recent_settings_change = (RequestStore.store[:settings_updated_on] || Time.now.utc).to_i
+ RequestStore.store[:settings_updated_at] ||= Setting.column_names.include?(:updated_at) && Setting.maximum(:updated_at)
+ most_recent_settings_change = (RequestStore.store[:settings_updated_at] || Time.now.utc).to_i
"/openproject/settings/all/#{most_recent_settings_change}"
end
diff --git a/app/models/user.rb b/app/models/user.rb
index a16dd216ff0..482bc585d6f 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -169,7 +169,7 @@ class User < Principal
scope :admin, -> { where(admin: true) }
- scope :newest, -> { not_builtin.order(created_on: :desc) }
+ scope :newest, -> { not_builtin.order(created_at: :desc) }
def self.unique_attribute
:login
@@ -302,7 +302,7 @@ class User < Principal
token = Token::AutoLogin.find_by_plaintext_value(key)
# Make sure there's only 1 token that matches the key
if token
- if (token.created_on > Setting.autologin.to_i.day.ago) && token.user && token.user.active?
+ if (token.created_at > Setting.autologin.to_i.day.ago) && token.user && token.user.active?
token.user.log_successful_login
token.user
end
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index 861e64d01ae..b9f7cb52884 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -44,7 +44,6 @@ class WikiPage < ApplicationRecord
acts_as_watchable
acts_as_event title: Proc.new { |o| "#{Wiki.model_name.human}: #{o.title}" },
description: :text,
- datetime: :created_on,
url: Proc.new { |o| { controller: '/wiki', action: 'show', project_id: o.wiki.project, id: o.title } }
acts_as_searchable columns: ["#{WikiPage.table_name}.title", "#{WikiContent.table_name}.text"],
@@ -65,8 +64,8 @@ class WikiPage < ApplicationRecord
before_destroy :remove_redirects
# eager load information about last updates, without loading text
- scope :with_updated_on, -> {
- select("#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_on")
+ scope :with_updated_at, -> {
+ select("#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_at")
.joins("LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id")
}
@@ -87,7 +86,7 @@ class WikiPage < ApplicationRecord
end
def delete_wiki_menu_item
- menu_item.destroy if menu_item
+ menu_item&.destroy
# ensure there is a menu item for the wiki
wiki.create_menu_item_for_start_page if MenuItems::WikiMenuItem.main_items(wiki).empty?
end
@@ -137,7 +136,7 @@ class WikiPage < ApplicationRecord
unless journal.nil? || content.version == journal.version
content_version = WikiContent.new journal.data.attributes.except('id', 'journal_id')
- content_version.updated_on = journal.created_at
+ content_version.updated_at = journal.created_at
content_version.journals = content.journals.select { |j| j.version <= version.to_i }
content_version
@@ -164,22 +163,22 @@ class WikiPage < ApplicationRecord
end
def text
- content.text if content
+ content&.text
end
- def updated_on
- unless @updated_on
- if time = read_attribute(:updated_on)
- # content updated_on was eager loaded with the page
+ def updated_at
+ unless @updated_at
+ if (time = read_attribute(:updated_at))
+ # content updated_at was eager loaded with the page
unless time.is_a? Time
time = Time.zone.parse(time) rescue nil
end
- @updated_on = time
+ @updated_at = time
else
- @updated_on = content && content.updated_on
+ @updated_at = content&.updated_at
end
end
- @updated_on
+ @updated_at
end
# Returns true if usr is allowed to edit the page, otherwise false
@@ -192,7 +191,7 @@ class WikiPage < ApplicationRecord
end
def parent_title
- @parent_title || (parent && parent.title)
+ @parent_title || (parent&.title)
end
def parent_title=(t)
diff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rb
index 9a5e9926838..63eac2d2757 100644
--- a/app/services/journals/create_service.rb
+++ b/app/services/journals/create_service.rb
@@ -118,12 +118,6 @@ module Journals
""
end
- timestamp = if notes.blank? && journable_timestamp
- ':created_at'
- else
- 'now()'
- end
-
journal_sql = <<~SQL
INSERT INTO
journals (
@@ -133,7 +127,8 @@ module Journals
activity_type,
user_id,
notes,
- created_at
+ created_at,
+ updated_at
)
SELECT
:journable_id,
@@ -142,7 +137,8 @@ module Journals
:activity_type,
:user_id,
:notes,
- #{timestamp}
+ #{journal_timestamp_sql(notes, ':created_at')},
+ #{journal_timestamp_sql(notes, ':updated_at')}
FROM max_journals
#{condition}
RETURNING *
@@ -154,7 +150,8 @@ module Journals
activity_type: journable.activity_type,
journable_type: journable_type,
user_id: user.id,
- created_at: journable_timestamp)
+ created_at: journable_timestamp,
+ updated_at: journable_timestamp)
end
def insert_data_sql
@@ -393,7 +390,7 @@ module Journals
end
def journable_timestamp
- journable.respond_to?(:updated_at) && journable.updated_at || journable.respond_to?(:updated_on) && journable.updated_on
+ journable.send(journable.class.aaj_options[:timestamp])
end
def journable_type
@@ -412,6 +409,14 @@ module Journals
"REGEXP_REPLACE(COALESCE(#{column},''), '\\r\\n', '\n', 'g')"
end
+ def journal_timestamp_sql(notes, attribute)
+ if notes.blank? && journable_timestamp
+ attribute
+ else
+ 'now()'
+ end
+ end
+
# Because we added the journal via bare metal sql, rails does not yet
# know of the journal. If the journable has the journals loaded already,
# the caller might expect the journals to also be updated so we do it for him.
diff --git a/app/services/projects/copy/forums_dependent_service.rb b/app/services/projects/copy/forums_dependent_service.rb
index e2385fad1e3..43fb3c488ae 100644
--- a/app/services/projects/copy/forums_dependent_service.rb
+++ b/app/services/projects/copy/forums_dependent_service.rb
@@ -60,8 +60,8 @@ module Projects::Copy
'author_id',
'replies_count',
'last_reply_id',
- 'created_on',
- 'updated_on')
+ 'created_at',
+ 'updated_at')
new_topic.forum = new_forum
new_topic.author_id = topic.author_id
new_forum.topics << new_topic
diff --git a/app/services/projects/copy/members_dependent_service.rb b/app/services/projects/copy/members_dependent_service.rb
index 4ec3a153893..2f31f2796bf 100644
--- a/app/services/projects/copy/members_dependent_service.rb
+++ b/app/services/projects/copy/members_dependent_service.rb
@@ -49,7 +49,7 @@ module Projects::Copy
next if role_ids.empty?
attributes = member
- .attributes.dup.except('id', 'project_id', 'created_on')
+ .attributes.dup.except('id', 'project_id', 'created_at')
.merge(role_ids: role_ids)
target.memberships.create attributes
diff --git a/app/services/projects/copy/versions_dependent_service.rb b/app/services/projects/copy/versions_dependent_service.rb
index 13008dcabf5..0c3f560eb13 100644
--- a/app/services/projects/copy/versions_dependent_service.rb
+++ b/app/services/projects/copy/versions_dependent_service.rb
@@ -39,7 +39,7 @@ module Projects::Copy
def copy_dependency(params:)
version_id_map = {}
source.versions.each do |source_version|
- version = target.versions.create source_version.attributes.dup.except('id', 'project_id', 'created_on', 'updated_at')
+ version = target.versions.create source_version.attributes.dup.except('id', 'project_id', 'created_at', 'updated_at')
version_id_map[source_version.id] = version.id
end
diff --git a/app/views/forums/index.html.erb b/app/views/forums/index.html.erb
index 8dca6f82a72..d35463412b0 100644
--- a/app/views/forums/index.html.erb
+++ b/app/views/forums/index.html.erb
@@ -121,7 +121,7 @@ See docs/COPYRIGHT.rdoc for more details.
<td>
<% if forum.last_message %>
<% forum.last_message %>
- <%= authoring forum.last_message.created_on, forum.last_message.author %><br />
+ <%= authoring forum.last_message.created_at, forum.last_message.author %><br />
<%= link_to_message forum.last_message, no_root: true %>
<% end %>
</td>
diff --git a/app/views/forums/show.html.erb b/app/views/forums/show.html.erb
index e1031134ab7..436f766ef1f 100644
--- a/app/views/forums/show.html.erb
+++ b/app/views/forums/show.html.erb
@@ -97,9 +97,9 @@ See docs/COPYRIGHT.rdoc for more details.
</div>
</div>
</th>
- <%= sort_header_tag("created_on", caption: Message.human_attribute_name(:created_on)) %>
+ <%= sort_header_tag("created_on", caption: Message.human_attribute_name(:created_at)) %>
<%= sort_header_tag("replies", caption: t(:label_reply_plural)) %>
- <%= sort_header_tag("updated_on", caption: t(:label_message_last)) %>
+ <%= sort_header_tag("updated_at", caption: t(:label_message_last)) %>
</tr>
</thead>
<tbody>
@@ -119,13 +119,13 @@ See docs/COPYRIGHT.rdoc for more details.
<%= link_to message.author.name, user_path(message.author) %>
<% end %>
</td>
- <td class="created_on">
- <%= format_time message.created_on %>
+ <td class="created_at">
+ <%= format_time message.created_at %>
</td>
<td class="replies"><%= message.replies_count %></td>
<td class="last_message">
<% if message.last_reply %>
- <%= authoring message.last_reply.created_on, message.last_reply.author %><br/>
+ <%= authoring message.last_reply.created_at, message.last_reply.author %><br/>
<br/>
<%= link_to_message message.last_reply, no_root: true %>
<% end %>
diff --git a/app/views/homescreen/blocks/_users.html.erb b/app/views/homescreen/blocks/_users.html.erb
index f3d93ba39c9..26f040708c1 100644
--- a/app/views/homescreen/blocks/_users.html.erb
+++ b/app/views/homescreen/blocks/_users.html.erb
@@ -7,7 +7,7 @@
<% @newest_users.each do |user| %>
<li>
<%= link_to user, user_path(user), title: user.name %>
- <small>(<%= format_date(user.created_on) %>)</small>
+ <small>(<%= format_date(user.created_at) %>)</small>
</li>
<% end %>
</ul>
diff --git a/app/views/messages/show.html.erb b/app/views/messages/show.html.erb
index 1d9686a4896..18f591a5a07 100644
--- a/app/views/messages/show.html.erb
+++ b/app/views/messages/show.html.erb
@@ -67,7 +67,7 @@ See docs/COPYRIGHT.rdoc for more details.
<% end %>
<div class="forum-message">
- <p class="author additional-information"><%= authoring @topic.created_on, @topic.author %></p>
+ <p class="author additional-information"><%= authoring @topic.created_at, @topic.author %></p>
<div class="wiki">
<%= format_text(@topic.content, object: @topic, attachments: @topic.attachments) %>
</div>
@@ -108,7 +108,7 @@ See docs/COPYRIGHT.rdoc for more details.
r: message,
anchor: "message-#{message.id}") %>
-
- <%= authoring message.created_on, message.author %>
+ <%= authoring message.created_at, message.author %>
</h4>
<div class="wiki">
<%= format_text message, :content, attachments: message.attachments %>
diff --git a/app/views/my/access_token.html.erb b/app/views/my/access_token.html.erb
index 18b58153260..b733973748f 100644
--- a/app/views/my/access_token.html.erb
+++ b/app/views/my/access_token.html.erb
@@ -56,7 +56,7 @@ See docs/COPYRIGHT.rdoc for more details.
<th>
<div class="generic-table--sort-header-outer">
<div class="generic-table--sort-header">
- <%= User.human_attribute_name(:created_on) %>
+ <%= User.human_attribute_name(:created_at) %>
</div>
</div>
</th>
@@ -82,8 +82,8 @@ See docs/COPYRIGHT.rdoc for more details.
<tr>
<td><%= t(:label_feeds_access_key_type) %></td>
<td>
- <span title="<%= format_time(@user.rss_token.created_on) %>">
- <%= format_time(@user.rss_token.created_on.to_s) %>
+ <span title="<%= format_time(@user.rss_token.created_at) %>">
+ <%= format_time(@user.rss_token.created_at.to_s) %>
</span>
</td>
<td><%= I18n.t('my_account.access_tokens.indefinite_expiration') %></td>
@@ -114,8 +114,8 @@ See docs/COPYRIGHT.rdoc for more details.
<tr>
<td><%= t(:label_api_access_key_type) %></td>
<td>
- <span title="<%= format_time(@user.api_token.created_on) %>">
- <%= format_time(@user.api_token.created_on.to_s) %>
+ <span title="<%= format_time(@user.api_token.created_at) %>">
+ <%= format_time(@user.api_token.created_at.to_s) %>
</span>
</td>
<td><%= I18n.t('my_account.access_tokens.indefinite_expiration') %></td>
diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb
index fc81d49b55b..ceeff27f632 100644
--- a/app/views/news/show.html.erb
+++ b/app/views/news/show.html.erb
@@ -88,7 +88,7 @@ See docs/COPYRIGHT.rdoc for more details.
title: t(:button_delete),
alt: t(:button_delete) %>
</div>
- <h4 class="author additional-information"><%= avatar(comment.author) %><%= authoring comment.created_on, comment.author %></h4>
+ <h4 class="author additional-information"><%= avatar(comment.author) %><%= authoring comment.created_at, comment.author %></h4>
<%= format_text(comment.comments, object: comment) %>
</div>
<% end %>
diff --git a/app/views/wiki/annotate.html.erb b/app/views/wiki/annotate.html.erb
index f08b8648f89..8c87ab8a493 100644
--- a/app/views/wiki/annotate.html.erb
+++ b/app/views/wiki/annotate.html.erb
@@ -47,7 +47,7 @@ See docs/COPYRIGHT.rdoc for more details.
<p>
<%= Version.model_name.human %> <%= link_to h(@annotate.content.version), action: 'show', id: @page, version: @annotate.content.version %>
- <em>(<%= h(@annotate.content.journable.author ? @annotate.content.journable.author.name : t(:label_user_anonymous)) %>, <%= format_time(@annotate.content.journable.updated_on) %>)</em>
+ <em>(<%= h(@annotate.content.journable.author ? @annotate.content.journable.author.name : t(:label_user_anonymous)) %>, <%= format_time(@annotate.content.journable.updated_at) %>)</em>
</p>
<% colors = Hash.new {|k,v| k[v] = (k.size % 12) } %>
<table class="filecontent annotate">
diff --git a/app/views/wiki/history.html.erb b/app/views/wiki/history.html.erb
index 56b43fc4203..d8eedc35614 100644
--- a/app/views/wiki/history.html.erb
+++ b/app/views/wiki/history.html.erb
@@ -85,7 +85,7 @@ See docs/COPYRIGHT.rdoc for more details.
<div class="generic-table--sort-header-outer">
<div class="generic-table--sort-header">
<span>
- <%= Journal.human_attribute_name(:updated_on) %>
+ <%= Journal.human_attribute_name(:updated_at) %>
</span>
</div>
</div>
@@ -134,7 +134,7 @@ See docs/COPYRIGHT.rdoc for more details.
<%= radio_button_tag('version_from', ver.version, (line_num==2), id: "cbto-#{line_num}") %>
<% end %>
</td>
- <td class="updated_on"><%= format_time(ver.created_at) %></td>
+ <td class="updated_at"><%= format_time(ver.created_at) %></td>
<td class="author"><%= link_to_user ver.user %></td>
<td class="comments"><%=h ver.notes %></td>
<td class="buttons"><%= link_to t(:button_annotate), action: 'annotate', id: @page, version: ver.version %></td>
diff --git a/app/views/wiki/show.html.erb b/app/views/wiki/show.html.erb
index 85577837d30..fc1d2852b78 100644
--- a/app/views/wiki/show.html.erb
+++ b/app/views/wiki/show.html.erb
@@ -124,7 +124,7 @@ See docs/COPYRIGHT.rdoc for more details.
<div>
<%= link_to(t(:label_previous), { action: 'show', id: @page, project_id: @page.project, version: (@content.version - 1) }, class: 'button navigate-left') if @content.version > 1 %>
<span><%= "#{Version.model_name.human} #{@content.version}/#{@page.content.version}" %> &#x2014;</span>
- <span><em><%= @content.author ? link_to_user(@content.author) : t(:label_user_anonymous) %></em> &#x2014; <%= format_time(@content.updated_on) %></span>
+ <span><em><%= @content.author ? link_to_user(@content.author) : t(:label_user_anonymous) %></em> &#x2014; <%= format_time(@content.updated_at) %></span>
<%= link_to(t(:label_next), { action: 'show', id: @page, project_id: @page.project, version: (@content.version + 1) }, class: 'button navigate-right') if @content.version < @page.content.version %>
</div>
<hr />
diff --git a/config/constants/ar_to_api_conversions.rb b/config/constants/ar_to_api_conversions.rb
index 78d1eb4ce31..51c0598ca75 100644
--- a/config/constants/ar_to_api_conversions.rb
+++ b/config/constants/ar_to_api_conversions.rb
@@ -37,8 +37,6 @@ module Constants
version: 'version',
done_ratio: 'percentageDone',
estimated_hours: 'estimatedTime',
- created_on: 'createdAt',
- updated_on: 'updatedAt',
remaining_hours: 'remainingTime',
spent_hours: 'spentTime',
subproject: 'subprojectId',
diff --git a/config/initializers/activity.rb b/config/initializers/activity.rb
index da2b86224ef..501f61f31b2 100644
--- a/config/initializers/activity.rb
+++ b/config/initializers/activity.rb
@@ -51,8 +51,8 @@ Project.register_latest_project_activity on: 'Changeset',
Project.register_latest_project_activity on: 'WikiContent',
chain: %w(Wiki WikiPage),
- attribute: :updated_on
+ attribute: :updated_at
Project.register_latest_project_activity on: 'Message',
chain: 'Forum',
- attribute: :updated_on
+ attribute: :updated_at
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 14cc6864f3d..6972002a84a 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -811,7 +811,6 @@ en:
content: "Content"
color: "Color"
created_at: "Created on"
- created_on: "Created on"
custom_options: "Possible values"
custom_values: "Custom fields"
date: "Date"
diff --git a/db/migrate/20190618115620_fix_available_languages.rb b/db/migrate/20190618115620_fix_available_languages.rb
index dae37054e4d..dba5261e00c 100644
--- a/db/migrate/20190618115620_fix_available_languages.rb
+++ b/db/migrate/20190618115620_fix_available_languages.rb
@@ -1,5 +1,7 @@
class FixAvailableLanguages < ActiveRecord::Migration[5.2]
def up
+ Setting.reset_column_information
+
Setting.available_languages = Setting.available_languages.map do |lang|
if lang == 'zh'
'zh-CN'
@@ -12,6 +14,8 @@ class FixAvailableLanguages < ActiveRecord::Migration[5.2]
end
def down
+ Setting.reset_column_information
+
Setting.available_languages = Setting.available_languages.map do |lang|
if lang == 'zh-CN'
'zh'
@@ -22,6 +26,4 @@ class FixAvailableLanguages < ActiveRecord::Migration[5.2]
User.where(language: 'zh-CN').update_all(language: 'zh')
end
-
- private
end
diff --git a/db/migrate/20201005184411_rename_timestamps.rb b/db/migrate/20201005184411_rename_timestamps.rb
new file mode 100644
index 00000000000..b9090bd746f
--- /dev/null
+++ b/db/migrate/20201005184411_rename_timestamps.rb
@@ -0,0 +1,56 @@
+class RenameTimestamps < ActiveRecord::Migration[6.0]
+ def change
+ alter_name_and_defaults(:comments, :created_on, :created_at)
+ alter_name_and_defaults(:comments, :updated_on, :updated_at)
+
+ alter_name_and_defaults(:messages, :created_on, :created_at)
+ alter_name_and_defaults(:messages, :updated_on, :updated_at)
+
+ alter_name_and_defaults(:versions, :created_on, :created_at)
+ alter_name_and_defaults(:versions, :updated_on, :updated_at)
+
+ alter_name_and_defaults(:users, :created_on, :created_at)
+ alter_name_and_defaults(:users, :updated_on, :updated_at)
+
+ alter_name_and_defaults(:wiki_pages, :created_on, :created_at)
+ alter_name_and_defaults(:wiki_redirects, :created_on, :created_at)
+
+ alter_name_and_defaults(:tokens, :created_on, :created_at)
+
+ alter_name_and_defaults(:settings, :updated_on, :updated_at)
+
+ alter_name_and_defaults(:cost_queries, :created_on, :created_at)
+ alter_name_and_defaults(:cost_queries, :updated_on, :updated_at)
+
+ alter_name_and_defaults(:wiki_contents, :updated_on, :updated_at)
+
+ add_timestamp_column(:journals, :updated_at, :created_at)
+
+ add_timestamp_column(:roles, :created_at, 'CURRENT_TIMESTAMP')
+ add_timestamp_column(:roles, :updated_at, 'CURRENT_TIMESTAMP')
+ end
+
+ private
+
+ def alter_name_and_defaults(table, old_column_name, new_column_name)
+ rename_column table, old_column_name, new_column_name
+
+ change_column_default table, new_column_name, from: nil, to: -> { 'CURRENT_TIMESTAMP' }
+ end
+
+ def add_timestamp_column(table, column_name, from_column = nil)
+ add_column table, column_name, :timestamp, default: -> { 'CURRENT_TIMESTAMP' }
+
+ reversible do |dir|
+ dir.up do
+ execute <<~SQL
+ UPDATE
+ #{table}
+ SET #{column_name} = #{from_column}
+ SQL
+ end
+ end
+
+ change_column_null table, column_name, true
+ end
+end
diff --git a/docs/api/apiv3/endpoints/documents.apib b/docs/api/apiv3/endpoints/documents.apib
index f857d594f95..17ba85485a0 100644
--- a/docs/api/apiv3/endpoints/documents.apib
+++ b/docs/api/apiv3/endpoints/documents.apib
@@ -201,7 +201,7 @@ The documents returned depend on the provided parameters and also on the request
+ sortBy (optional, string, `[["created_at", "asc"]]`) ... JSON specifying sort criteria.
Accepts the same format as returned by the [queries](#queries) endpoint. Currently supported sorts are:
+ id: Sort by primary key
- + created_on: Sort by document creation datetime
+ + created_at: Sort by document creation datetime
+ Response 200 (application/hal+json)
diff --git a/docs/api/apiv3/endpoints/news.apib b/docs/api/apiv3/endpoints/news.apib
index a12635cd5bb..10bbf51fff6 100644
--- a/docs/api/apiv3/endpoints/news.apib
+++ b/docs/api/apiv3/endpoints/news.apib
@@ -188,7 +188,7 @@ Lists news. The news returned depend on the provided parameters and also on the
+ sortBy (optional, string, `[["created_at", "asc"]]`) ... JSON specifying sort criteria.
Accepts the same format as returned by the [queries](#queries) endpoint. Currently supported sorts are:
+ id: Sort by primary key
- + created_on: Sort by news creation datetime
+ + created_at: Sort by news creation datetime
+ filters (optional, string, `[{ "project_id": { "operator": "=", "values": ["1", "2"] } }]`) ... JSON specifying filter conditions.
Accepts the same format as returned by the [queries](#queries) endpoint. Currently supported filters are:
diff --git a/docs/api/apiv3/endpoints/projects.apib b/docs/api/apiv3/endpoints/projects.apib
index 8077d34f49a..f3945201857 100644
--- a/docs/api/apiv3/endpoints/projects.apib
+++ b/docs/api/apiv3/endpoints/projects.apib
@@ -406,7 +406,7 @@ Returns a collection of projects. The collection can be filtered via query param
Currently supported filters are:
+ active: based on the active property of the project
+ ancestor: filters projects by their ancestor. A project is not considered to be it's own ancestor.
- + created_on: based on the time the project was created
+ + created_at: based on the time the project was created
+ latest_activity_at: based on the time the last activity was registered on a project.
+ name_and_identifier: based on both the name and the identifier.
+ parent_id: filters projects by their parent.
@@ -418,7 +418,7 @@ Returns a collection of projects. The collection can be filtered via query param
Currently supported orders are:
+ id
+ name
- + created_on
+ + created_at
+ public
+ latest_activity_at
+ required_disk_space
diff --git a/lib/api/v3/principals/principal_representer.rb b/lib/api/v3/principals/principal_representer.rb
index 9fc0d86b81b..a41c1b10faa 100644
--- a/lib/api/v3/principals/principal_representer.rb
+++ b/lib/api/v3/principals/principal_representer.rb
@@ -73,12 +73,10 @@ module API
property :name,
render_nil: true
- date_time_property :created_on,
- as: 'createdAt',
+ date_time_property :created_at,
cache_if: -> { current_user_is_admin_or_self }
- date_time_property :updated_on,
- as: 'updatedAt',
+ date_time_property :updated_at,
cache_if: -> { current_user_is_admin_or_self }
def current_user_is_admin_or_self
diff --git a/lib/api/v3/versions/version_representer.rb b/lib/api/v3/versions/version_representer.rb
index f3e66170790..463085addb7 100644
--- a/lib/api/v3/versions/version_representer.rb
+++ b/lib/api/v3/versions/version_representer.rb
@@ -104,11 +104,8 @@ module API
property :sharing
- date_time_property :created_on,
- as: 'createdAt'
-
- date_time_property :updated_on,
- as: 'updatedAt'
+ date_time_property :created_at
+ date_time_property :updated_at
def _type
'Version'
diff --git a/lib/api/v3/work_packages/eager_loading/checksum.rb b/lib/api/v3/work_packages/eager_loading/checksum.rb
index 031d3a18a9e..bf3636de6c6 100644
--- a/lib/api/v3/work_packages/eager_loading/checksum.rb
+++ b/lib/api/v3/work_packages/eager_loading/checksum.rb
@@ -59,9 +59,8 @@ module API
def md5_concat
md5_parts = checksum_associations.map do |association_name|
table_name = md5_checksum_table_name(association_name)
- timestamp_column_name = md5_checksum_timestamp_column(association_name)
- %W[#{table_name}.id #{table_name}.#{timestamp_column_name}]
+ %W[#{table_name}.id #{table_name}.updated_at]
end.flatten
<<-SQL
@@ -84,10 +83,6 @@ module API
end
end
- def md5_checksum_timestamp_column(association_name)
- (association_class(association_name).all_timestamp_attributes_in_model & %w[updated_at updated_on]).first
- end
-
def association_class(association_name)
WorkPackage.reflect_on_association(association_name).class_name.constantize
end
diff --git a/lib/open_project/page_hierarchy_helper.rb b/lib/open_project/page_hierarchy_helper.rb
index f36a0045a6f..86fb9b8871d 100644
--- a/lib/open_project/page_hierarchy_helper.rb
+++ b/lib/open_project/page_hierarchy_helper.rb
@@ -72,8 +72,8 @@ module OpenProject
end
def hierarchy_item_title(options, page)
- if options[:timestamp] && page.updated_on
- ::I18n.t(:label_updated_time, value: distance_of_time_in_words(Time.now, page.updated_on))
+ if options[:timestamp] && page.updated_at
+ ::I18n.t(:label_updated_time, value: distance_of_time_in_words(Time.now, page.updated_at))
end
end
diff --git a/lib/plugins/acts_as_journalized/lib/acts/journalized/options.rb b/lib/plugins/acts_as_journalized/lib/acts/journalized/options.rb
index 6d6c25cc382..74fc78cbd44 100644
--- a/lib/plugins/acts_as_journalized/lib/acts/journalized/options.rb
+++ b/lib/plugins/acts_as_journalized/lib/acts/journalized/options.rb
@@ -105,6 +105,7 @@ module Acts::Journalized
class_name: Journal.name,
dependent: :destroy,
foreign_key: :journable_id,
+ timestamp: :updated_at,
as: :journable
}.merge(options.symbolize_keys)
end
diff --git a/lib/plugins/acts_as_journalized/lib/journal_deprecated.rb b/lib/plugins/acts_as_journalized/lib/journal_deprecated.rb
index c0bdba935d6..39c6f2ed2d5 100644
--- a/lib/plugins/acts_as_journalized/lib/journal_deprecated.rb
+++ b/lib/plugins/acts_as_journalized/lib/journal_deprecated.rb
@@ -50,24 +50,9 @@
# It provides the hooks to apply different formatting to the details
# of a specific journal.
module JournalDeprecated
- # Old timestamps. created_at is what t.timestamps creates in recent Rails journals
- def created_on
- created_at
- end
-
- # Old naming
- def journalized
- journaled
- end
-
- # Old naming
- def journalized=(obj)
- journaled = obj
- end
-
# Shortcut from more issue-specific journals
def attachments
- journalized.respond_to?(:attachments) ? journalized.attachments : nil
+ journaled.respond_to?(:attachments) ? journaled.attachments : nil
end
# deprecate created_on: "use #created_at"
diff --git a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
index a47df934d0b..9d0099d912e 100644
--- a/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
+++ b/lib/plugins/acts_as_searchable/lib/acts_as_searchable.rb
@@ -37,8 +37,8 @@ module Redmine
# Options:
# * :columns - a column or an array of columns to search
# * :project_key - project foreign key (default to project_id)
- # * :date_column - name of the datetime column (default to created_on)
- # * :sort_order - name of the column used to sort results (default to :date_column or created_on)
+ # * :date_column - name of the datetime column (default to created_at)
+ # * :order_column - name of the column used to sort results (default to :date_column or created_at)
# * :permission - permission required to search the model (default to :view_"objects")
def acts_as_searchable(options = {})
return if included_modules.include?(Redmine::Acts::Searchable::InstanceMethods)
@@ -55,7 +55,7 @@ module Redmine
searchable_options[:tsv_columns] ||= []
searchable_options[:project_key] ||= "#{table_name}.project_id"
- searchable_options[:date_column] ||= "#{table_name}.created_on"
+ searchable_options[:date_column] ||= "#{table_name}.created_at"
searchable_options[:order_column] ||= searchable_options[:date_column]
# Permission needed to search this model
diff --git a/modules/backlogs/app/controllers/rb_master_backlogs_controller.rb b/modules/backlogs/app/controllers/rb_master_backlogs_controller.rb
index c86f949019c..9fc6da12cd2 100644
--- a/modules/backlogs/app/controllers/rb_master_backlogs_controller.rb
+++ b/modules/backlogs/app/controllers/rb_master_backlogs_controller.rb
@@ -35,7 +35,7 @@ class RbMasterBacklogsController < RbApplicationController
@owner_backlogs = Backlog.owner_backlogs(@project)
@sprint_backlogs = Backlog.sprint_backlogs(@project)
- @last_update = (@sprint_backlogs + @owner_backlogs).map(&:updated_on).compact.max
+ @last_update = (@sprint_backlogs + @owner_backlogs).map(&:updated_at).compact.max
end
private
diff --git a/modules/backlogs/app/helpers/rb_common_helper.rb b/modules/backlogs/app/helpers/rb_common_helper.rb
index f7cddc5adde..e96df8f5186 100644
--- a/modules/backlogs/app/helpers/rb_common_helper.rb
+++ b/modules/backlogs/app/helpers/rb_common_helper.rb
@@ -162,10 +162,6 @@ module RbCommonHelper
story.type.nil? ? '' : h(backlogs_types_by_id[story.type_id].name)
end
- def updated_on_with_milliseconds(story)
- date_string_with_milliseconds(story.updated_on, 0.001) unless story.blank?
- end
-
def date_string_with_milliseconds(d, add = 0)
return '' if d.blank?
d.strftime('%B %d, %Y %H:%M:%S') + '.' + (d.to_f % 1 + add).to_s.split('.')[1]
diff --git a/modules/backlogs/app/models/backlog.rb b/modules/backlogs/app/models/backlog.rb
index b3ce588c269..0817e7fbbfd 100644
--- a/modules/backlogs/app/models/backlog.rb
+++ b/modules/backlogs/app/models/backlog.rb
@@ -55,7 +55,7 @@ class Backlog
@owner_backlog = options['owner_backlog']
end
- def updated_on
+ def updated_at
@stories.max_by(&:updated_at).try(:updated_at)
end
diff --git a/modules/backlogs/app/models/sprint.rb b/modules/backlogs/app/models/sprint.rb
index a8202670f7c..a79487f0495 100644
--- a/modules/backlogs/app/models/sprint.rb
+++ b/modules/backlogs/app/models/sprint.rb
@@ -138,7 +138,7 @@ class Sprint < Version
# Assume a sprint is active if it's only 2 days old
return true if bd.remaining_hours.size <= 2
- WorkPackage.exists?(['version_id = ? and ((updated_on between ? and ?) or (created_on between ? and ?))',
+ WorkPackage.exists?(['version_id = ? and ((updated_at between ? and ?) or (created_at between ? and ?))',
id, -2.days.from_now, Time.now, -2.days.from_now, Time.now])
end
diff --git a/modules/backlogs/app/views/rb_tasks/index.html.erb b/modules/backlogs/app/views/rb_tasks/index.html.erb
index 77cf0645f63..9613f97aaeb 100644
--- a/modules/backlogs/app/views/rb_tasks/index.html.erb
+++ b/modules/backlogs/app/views/rb_tasks/index.html.erb
@@ -28,7 +28,7 @@ See docs/COPYRIGHT.rdoc for more details.
++#%>
<div>
- <div class="meta" id="last_updated"><%= date_string_with_milliseconds( (@last_updated.blank? ? Time.parse(params[:after]) : @last_updated.updated_on), 0.001 ) %></div>
+ <div class="meta" id="last_updated"><%= date_string_with_milliseconds( (@last_updated.blank? ? Time.parse(params[:after]) : @last_updated.updated_at), 0.001 ) %></div>
<%= render :partial => "task", :collection => @tasks, :locals => { :include_meta => @include_meta } %>
<%- if @impediments %>
<%= render :partial => "impediment", :collection => @impediments, :locals => { :include_meta => @include_meta }%>
diff --git a/modules/budgets/config/locales/en.yml b/modules/budgets/config/locales/en.yml
index 680f824b23c..ab49c2dfd5f 100644
--- a/modules/budgets/config/locales/en.yml
+++ b/modules/budgets/config/locales/en.yml
@@ -35,13 +35,11 @@ en:
available: "Available"
budget: "Planned"
budget_ratio: "Spent (ratio)"
- created_on: "Created on"
description: "Description"
spent: "Spent"
status: "Status"
subject: "Subject"
type: "Cost type"
- updated_on: "Updated on"
labor_budget: "Planned labor costs"
material_budget: "Planned unit costs"
work_package:
diff --git a/modules/budgets/spec/lib/api/v3/budgets/budget_representer_spec.rb b/modules/budgets/spec/lib/api/v3/budgets/budget_representer_spec.rb
index 13439b55d9c..b7a9dc08659 100644
--- a/modules/budgets/spec/lib/api/v3/budgets/budget_representer_spec.rb
+++ b/modules/budgets/spec/lib/api/v3/budgets/budget_representer_spec.rb
@@ -35,8 +35,8 @@ describe ::API::V3::Budgets::BudgetRepresenter do
let(:user) do
FactoryBot.build(:user,
member_in_project: project,
- created_on: 1.day.ago,
- updated_on: Date.today)
+ created_at: 1.day.ago,
+ updated_at: Date.today)
end
let(:budget) do
FactoryBot.create(:budget,
diff --git a/modules/documents/app/controllers/documents_controller.rb b/modules/documents/app/controllers/documents_controller.rb
index eda7c0a68ad..c704ecb9c32 100644
--- a/modules/documents/app/controllers/documents_controller.rb
+++ b/modules/documents/app/controllers/documents_controller.rb
@@ -41,7 +41,7 @@ class DocumentsController < ApplicationController
@grouped =
case @group_by
when 'date'
- documents.group_by {|d| d.updated_on.to_date }
+ documents.group_by {|d| d.updated_at.to_date }
when 'title'
documents.group_by {|d| d.title.first.upcase}
when 'author'
diff --git a/modules/documents/app/models/document.rb b/modules/documents/app/models/document.rb
index 0eecd451376..d8196810008 100644
--- a/modules/documents/app/models/document.rb
+++ b/modules/documents/app/models/document.rb
@@ -36,10 +36,9 @@ class Document < ApplicationRecord
acts_as_journalized
acts_as_event title: Proc.new { |o| "#{Document.model_name.human}: #{o.title}" },
url: Proc.new { |o| { controller: '/documents', action: 'show', id: o.id } },
- datetime: :created_at,
- author: ( Proc.new do |o|
- o.attachments.find(:first, order: "#{Attachment.table_name}.created_at ASC").try(:author)
- end)
+ author: Proc.new { |o|
+ o.attachments.find(:first, order: "#{Attachment.table_name}.created_at ASC").try(:author)
+ }
acts_as_searchable columns: ['title', "#{table_name}.description"],
include: :project,
@@ -72,15 +71,15 @@ class Document < ApplicationRecord
self.category ||= DocumentCategory.default if new_record?
end
- def updated_on
- unless @updated_on
- # attachments has a default order that conflicts with `created_at DESC`
- # #reorder removes that default order but rather than #unscoped keeps the
- # scoping by this document
- a = attachments.reorder(Arel.sql('created_at DESC')).first
- @updated_on = (a && a.created_at) || created_at
- end
- @updated_on
+ # TODO: This should not be necessary as the Attachments::CreateService in combination
+ # with acts_as_journalized should touch the document after an attachment has been added.
+ def updated_at
+ @updated_at ||= [attachments.maximum(:updated_at), read_attribute(:updated_at)].compact.max
+ end
+
+ def reload(options = nil)
+ @updated_at = nil
+ super
end
private
diff --git a/modules/documents/app/views/documents/_document.html.erb b/modules/documents/app/views/documents/_document.html.erb
index 2a217637423..22b5e649c68 100644
--- a/modules/documents/app/views/documents/_document.html.erb
+++ b/modules/documents/app/views/documents/_document.html.erb
@@ -28,7 +28,7 @@ See docs/COPYRIGHT.rdoc for more details.
++#%>
<h4 class="document-category-elements--header"><%= link_to h(document.title), :controller => '/documents', :action => 'show', :id => document %></h4>
-<p class="document-category-elements--date"><em><%= format_time(document.updated_on) %></em></p>
+<p class="document-category-elements--date"><em><%= format_time(document.updated_at) %></em></p>
<div class="wiki">
<%= format_text(truncate_lines(document.description)) %>
diff --git a/modules/documents/spec/models/document_spec.rb b/modules/documents/spec/models/document_spec.rb
index 3af173aab12..e2d7c67f370 100644
--- a/modules/documents/spec/models/document_spec.rb
+++ b/modules/documents/spec/models/document_spec.rb
@@ -81,14 +81,19 @@ describe Document do
}.to change { Document.count }.by 1
end
- it "with attachments should change the updated_on-date on the document to the attachment's date" do
- 3.times do
- FactoryBot.create(:attachment, container: valid_document)
- end
-
- valid_document.reload
- expect(valid_document.attachments.size).to eql 3
- expect(valid_document.attachments.map(&:created_at).max).to eql valid_document.updated_on
+ it "with attachments should change the updated_at-date on the document to the attachment's date" do
+ valid_document.save
+
+ expect {
+ Attachments::CreateService
+ .new(valid_document, author: admin)
+ .call(uploaded_file: FactoryBot.attributes_for(:attachment)[:file], description: '')
+
+ expect(valid_document.attachments.size).to eql 1
+ }.to(change {
+ valid_document.reload
+ valid_document.updated_at
+ })
end
it "without attachments, the updated-on-date is taken from the document's date" do
diff --git a/modules/ldap_groups/app/cells/ldap_groups/memberships/table_cell.rb b/modules/ldap_groups/app/cells/ldap_groups/memberships/table_cell.rb
index 6e05b854f8d..a05d37c6784 100644
--- a/modules/ldap_groups/app/cells/ldap_groups/memberships/table_cell.rb
+++ b/modules/ldap_groups/app/cells/ldap_groups/memberships/table_cell.rb
@@ -18,7 +18,7 @@ module LdapGroups
def headers
[
['user', caption: ::LdapGroups::Membership.human_attribute_name('user')],
- ['added', caption: ::LdapGroups::Membership.human_attribute_name('created_on')]
+ ['added', caption: ::LdapGroups::Membership.human_attribute_name('created_at')]
]
end
end
diff --git a/modules/meeting/app/models/meeting_content.rb b/modules/meeting/app/models/meeting_content.rb
index fc8cee19f7c..2938533e674 100644
--- a/modules/meeting/app/models/meeting_content.rb
+++ b/modules/meeting/app/models/meeting_content.rb
@@ -80,11 +80,6 @@ class MeetingContent < ApplicationRecord
.first.data
end
- # Compatibility for mailer.rb
- def updated_on
- updated_at
- end
-
# Show the project on activity and search views
def project
meeting.project
diff --git a/modules/meeting/app/views/meeting_contents/history.html.erb b/modules/meeting/app/views/meeting_contents/history.html.erb
index 3f29964e8ef..720c10115d0 100644
--- a/modules/meeting/app/views/meeting_contents/history.html.erb
+++ b/modules/meeting/app/views/meeting_contents/history.html.erb
@@ -70,7 +70,7 @@ See docs/COPYRIGHT.rdoc for more details.
<div class="generic-table--sort-header-outer">
<div class="generic-table--sort-header">
<span>
- <%= Meeting.human_attribute_name(:updated_on) %>
+ <%= Meeting.human_attribute_name(:updated_at) %>
</span>
</div>
</div>
diff --git a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
index 15e608565b9..603459f8cc4 100644
--- a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
+++ b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
@@ -76,7 +76,7 @@ describe 'Login with 2FA remember cookie', type: :feature,
# Expire token
token = ::TwoFactorAuthentication::RememberedAuthToken.find_by!(user: user)
expect(token).not_to be_expired
- token.update_columns(expires_on: 1.day.ago, created_on: 31.days.ago)
+ token.update_columns(expires_on: 1.day.ago, created_at: 31.days.ago)
# Log out and in again
visit '/logout'
diff --git a/spec/controllers/news/comments_controller_spec.rb b/spec/controllers/news/comments_controller_spec.rb
index a8dc3442520..f68b1bad0db 100644
--- a/spec/controllers/news/comments_controller_spec.rb
+++ b/spec/controllers/news/comments_controller_spec.rb
@@ -44,7 +44,7 @@ describe News::CommentsController, type: :controller do
expect(response).to redirect_to news_path(news)
- latest_comment = news.comments.reorder(Arel.sql('created_on DESC')).first
+ latest_comment = news.comments.reorder(created_at: :desc).first
expect(latest_comment).not_to be_nil
expect(latest_comment.comments).to eq 'This is a test comment'
expect(latest_comment.author).to eq user
diff --git a/spec/factories/principal_factory.rb b/spec/factories/principal_factory.rb
index b1f0da4c20a..3aaec3c173d 100644
--- a/spec/factories/principal_factory.rb
+++ b/spec/factories/principal_factory.rb
@@ -37,8 +37,8 @@ FactoryBot.define do
# necessary as we have created_on instead of created_at for which factory girl would
# provide values automatically
- created_on { Time.now }
- updated_on { Time.now }
+ created_at { Time.now }
+ updated_at { Time.now }
callback(:after_build) do |user, evaluator| # this is also done after :create
(projects = evaluator.member_in_projects || [])
diff --git a/spec/factories/version_factory.rb b/spec/factories/version_factory.rb
index 6a6b6cc59a5..ffbc5e2d207 100644
--- a/spec/factories/version_factory.rb
+++ b/spec/factories/version_factory.rb
@@ -30,8 +30,8 @@ FactoryBot.define do
factory :version do
sequence(:name) { |i| "Version #{i}" }
effective_date { Date.today + 14.days }
- created_on { Time.now }
- updated_on { Time.now }
+ created_at { Time.now }
+ updated_at { Time.now }
project
end
end
diff --git a/spec/features/forums/sticky_spec.rb b/spec/features/forums/sticky_spec.rb
index b650e5ad737..f30b5f07566 100644
--- a/spec/features/forums/sticky_spec.rb
+++ b/spec/features/forums/sticky_spec.rb
@@ -32,18 +32,18 @@ describe 'sticky messages', type: :feature do
let(:forum) { FactoryBot.create(:forum) }
let!(:message1) do
- FactoryBot.create :message, forum: forum, created_on: Time.now - 1.minute do |message|
- Message.where(id: message.id).update_all(updated_on: Time.now - 1.minute)
+ FactoryBot.create :message, forum: forum, created_at: Time.now - 1.minute do |message|
+ Message.where(id: message.id).update_all(updated_at: Time.now - 1.minute)
end
end
let!(:message2) do
- FactoryBot.create :message, forum: forum, created_on: Time.now - 2.minute do |message|
- Message.where(id: message.id).update_all(updated_on: Time.now - 2.minute)
+ FactoryBot.create :message, forum: forum, created_at: Time.now - 2.minute do |message|
+ Message.where(id: message.id).update_all(updated_at: Time.now - 2.minute)
end
end
let!(:message3) do
- FactoryBot.create :message, forum: forum, created_on: Time.now - 3.minute do |message|
- Message.where(id: message.id).update_all(updated_on: Time.now - 3.minute)
+ FactoryBot.create :message, forum: forum, created_at: Time.now - 3.minute do |message|
+ Message.where(id: message.id).update_all(updated_at: Time.now - 3.minute)
end
end
diff --git a/spec/features/users/index_spec.rb b/spec/features/users/index_spec.rb
index 6048281a389..91adc36c08b 100644
--- a/spec/features/users/index_spec.rb
+++ b/spec/features/users/index_spec.rb
@@ -29,9 +29,9 @@
require 'spec_helper'
describe 'index users', type: :feature do
- let!(:admin) { FactoryBot.create :admin, created_on: 1.hour.ago }
+ let!(:admin) { FactoryBot.create :admin, created_at: 1.hour.ago }
let!(:anonymous) { FactoryBot.create :anonymous }
- let!(:active_user) { FactoryBot.create :user, created_on: 1.minute.ago }
+ let!(:active_user) { FactoryBot.create :user, created_at: 1.minute.ago }
let!(:registered_user) { FactoryBot.create :user, status: User::STATUSES[:registered] }
let!(:invited_user) { FactoryBot.create :user, status: User::STATUSES[:invited] }
let(:index_page) { Pages::Admin::Users::Index.new }
diff --git a/spec/lib/api/utilities/property_name_converter_spec.rb b/spec/lib/api/utilities/property_name_converter_spec.rb
index 06cfbb0eb84..3eede3c124e 100644
--- a/spec/lib/api/utilities/property_name_converter_spec.rb
+++ b/spec/lib/api/utilities/property_name_converter_spec.rb
@@ -156,7 +156,7 @@ describe ::API::Utilities::PropertyNameConverter do
end
context 'inapropriate back-replacement' do
- # should not be translated back to updated_on, which is transformed for ar->api
+ # should not be translated back to updated_at, which is transformed for ar->api
let(:attribute_name) { 'updatedAt' }
it 'should not be performed' do
@@ -167,7 +167,7 @@ describe ::API::Utilities::PropertyNameConverter do
let(:context) { FactoryBot.build_stubbed(:version) }
it 'should be performed' do
- is_expected.to eql('updated_on')
+ is_expected.to eql('updated_at')
end
end
end
diff --git a/spec/lib/api/v3/categories/category_representer_spec.rb b/spec/lib/api/v3/categories/category_representer_spec.rb
index f89863f093e..36d0faa49d3 100644
--- a/spec/lib/api/v3/categories/category_representer_spec.rb
+++ b/spec/lib/api/v3/categories/category_representer_spec.rb
@@ -124,7 +124,7 @@ describe ::API::V3::Categories::CategoryRepresenter do
end
it 'changes when the category\'s assigned_to is updated' do
- category.assigned_to.updated_on = Time.now + 20.seconds
+ category.assigned_to.updated_at = Time.now + 20.seconds
expect(representer.json_cache_key)
.not_to eql former_cache_key
diff --git a/spec/lib/api/v3/groups/group_representer_spec.rb b/spec/lib/api/v3/groups/group_representer_spec.rb
index 607f60539ff..15d2d71be15 100644
--- a/spec/lib/api/v3/groups/group_representer_spec.rb
+++ b/spec/lib/api/v3/groups/group_representer_spec.rb
@@ -76,12 +76,12 @@ describe ::API::V3::Groups::GroupRepresenter do
end
it_behaves_like 'has UTC ISO 8601 date and time' do
- let(:date) { group.created_on }
+ let(:date) { group.created_at }
let(:json_path) { 'createdAt' }
end
it_behaves_like 'has UTC ISO 8601 date and time' do
- let(:date) { group.updated_on }
+ let(:date) { group.updated_at }
let(:json_path) { 'updatedAt' }
end
end
@@ -128,7 +128,7 @@ describe ::API::V3::Groups::GroupRepresenter do
end
it 'changes when the group is updated' do
- group.updated_on = Time.now + 20.seconds
+ group.updated_at = Time.now + 20.seconds
expect(representer.json_cache_key)
.not_to eql former_cache_key
diff --git a/spec/lib/api/v3/users/paginated_user_collection_representer_spec.rb b/spec/lib/api/v3/users/paginated_user_collection_representer_spec.rb
index a046fe81845..dff5f4457c0 100644
--- a/spec/lib/api/v3/users/paginated_user_collection_representer_spec.rb
+++ b/spec/lib/api/v3/users/paginated_user_collection_representer_spec.rb
@@ -38,9 +38,7 @@ describe ::API::V3::Users::PaginatedUserCollectionRepresenter do
let(:users) do
users = FactoryBot.build_stubbed_list(:user,
- actual_count,
- created_on: Time.now,
- updated_on: Time.now)
+ actual_count)
allow(users)
.to receive(:per_page)
.with(page_size)
diff --git a/spec/lib/api/v3/users/user_collection_representer_spec.rb b/spec/lib/api/v3/users/user_collection_representer_spec.rb
index 84c6cd1ad13..e64c902838d 100644
--- a/spec/lib/api/v3/users/user_collection_representer_spec.rb
+++ b/spec/lib/api/v3/users/user_collection_representer_spec.rb
@@ -31,9 +31,7 @@ require 'spec_helper'
describe ::API::V3::Users::UserCollectionRepresenter do
let(:users) {
FactoryBot.build_stubbed_list(:user,
- 3,
- created_on: Time.now,
- updated_on: Time.now)
+ 3)
}
let(:representer) {
described_class.new(users,
diff --git a/spec/lib/api/v3/users/user_representer_spec.rb b/spec/lib/api/v3/users/user_representer_spec.rb
index 8d8cb722ddc..b9bd50f3b42 100644
--- a/spec/lib/api/v3/users/user_representer_spec.rb
+++ b/spec/lib/api/v3/users/user_representer_spec.rb
@@ -93,12 +93,12 @@ describe ::API::V3::Users::UserRepresenter do
end
it_behaves_like 'has UTC ISO 8601 date and time' do
- let(:date) { user.created_on }
+ let(:date) { user.created_at }
let(:json_path) { 'createdAt' }
end
it_behaves_like 'has UTC ISO 8601 date and time' do
- let(:date) { user.updated_on }
+ let(:date) { user.updated_at }
let(:json_path) { 'updatedAt' }
end
end
@@ -293,7 +293,7 @@ describe ::API::V3::Users::UserRepresenter do
end
it 'changes when the user is updated' do
- user.updated_on = Time.now + 20.seconds
+ user.updated_at = Time.now + 20.seconds
expect(representer.json_cache_key)
.not_to eql former_cache_key
diff --git a/spec/lib/api/v3/utilities/path_helper_spec.rb b/spec/lib/api/v3/utilities/path_helper_spec.rb
index a126509ab50..1e376be713d 100644
--- a/spec/lib/api/v3/utilities/path_helper_spec.rb
+++ b/spec/lib/api/v3/utilities/path_helper_spec.rb
@@ -275,9 +275,9 @@ describe ::API::V3::Utilities::PathHelper do
end
describe '#query_column' do
- subject { helper.query_column 'updated_on' }
+ subject { helper.query_column 'updated_at' }
- it_behaves_like 'api v3 path', '/queries/columns/updated_on'
+ it_behaves_like 'api v3 path', '/queries/columns/updated_at'
end
describe '#query_group_by' do
diff --git a/spec/lib/api/v3/versions/version_representer_rendering_spec.rb b/spec/lib/api/v3/versions/version_representer_rendering_spec.rb
index e9c60e7400f..207567e436a 100644
--- a/spec/lib/api/v3/versions/version_representer_rendering_spec.rb
+++ b/spec/lib/api/v3/versions/version_representer_rendering_spec.rb
@@ -188,12 +188,12 @@ describe ::API::V3::Versions::VersionRepresenter, 'rendering' do
end
it_behaves_like 'has UTC ISO 8601 date and time' do
- let(:date) { version.created_on }
+ let(:date) { version.created_at }
let(:json_path) { 'createdAt' }
end
it_behaves_like 'has UTC ISO 8601 date and time' do
- let(:date) { version.updated_on }
+ let(:date) { version.updated_at }
let(:json_path) { 'updatedAt' }
end
@@ -255,7 +255,7 @@ describe ::API::V3::Versions::VersionRepresenter, 'rendering' do
end
it 'changes when the version is updated' do
- version.updated_on = Time.now + 20.seconds
+ version.updated_at = Time.now + 20.seconds
expect(representer.json_cache_key)
.not_to eql former_cache_key
diff --git a/spec/lib/api/v3/work_packages/eager_loading/cache_checksum_integration_spec.rb b/spec/lib/api/v3/work_packages/eager_loading/cache_checksum_integration_spec.rb
index 48a30259c8b..94cb47681f4 100644
--- a/spec/lib/api/v3/work_packages/eager_loading/cache_checksum_integration_spec.rb
+++ b/spec/lib/api/v3/work_packages/eager_loading/cache_checksum_integration_spec.rb
@@ -83,7 +83,7 @@ describe ::API::V3::WorkPackages::EagerLoading::Checksum do
end
it 'produces a different checksum on changes to the author' do
- work_package.author.update_attribute(:updated_on, Time.now + 10.seconds)
+ work_package.author.update_attribute(:updated_at, Time.now + 10.seconds)
expect(new_checksum)
.not_to eql orig_checksum
@@ -97,7 +97,7 @@ describe ::API::V3::WorkPackages::EagerLoading::Checksum do
end
it 'produces a different checksum on changes to the assigned_to' do
- work_package.assigned_to.update_attribute(:updated_on, Time.now + 10.seconds)
+ work_package.assigned_to.update_attribute(:updated_at, Time.now + 10.seconds)
expect(new_checksum)
.not_to eql orig_checksum
@@ -111,7 +111,7 @@ describe ::API::V3::WorkPackages::EagerLoading::Checksum do
end
it 'produces a different checksum on changes to the responsible' do
- work_package.responsible.update_attribute(:updated_on, Time.now + 10.seconds)
+ work_package.responsible.update_attribute(:updated_at, Time.now + 10.seconds)
expect(new_checksum)
.not_to eql orig_checksum
@@ -125,7 +125,7 @@ describe ::API::V3::WorkPackages::EagerLoading::Checksum do
end
it 'produces a different checksum on changes to the version' do
- work_package.version.update_attribute(:updated_on, Time.now + 10.seconds)
+ work_package.version.update_attribute(:updated_at, Time.now + 10.seconds)
expect(new_checksum)
.not_to eql orig_checksum
diff --git a/spec/models/permitted_params_spec.rb b/spec/models/permitted_params_spec.rb
index 67871cfddbf..c3aa51fabe1 100644
--- a/spec/models/permitted_params_spec.rb
+++ b/spec/models/permitted_params_spec.rb
@@ -921,8 +921,8 @@ describe PermittedParams, type: :model do
it_behaves_like 'forbids params'
end
- describe 'created_on' do
- let(:hash) { { 'created_on' => 'blubs' } }
+ describe 'created_at' do
+ let(:hash) { { 'created_at' => 'blubs' } }
it_behaves_like 'forbids params'
end
diff --git a/spec/models/projects/activity_spec.rb b/spec/models/projects/activity_spec.rb
index 08cf39f9042..119ce159a01 100644
--- a/spec/models/projects/activity_spec.rb
+++ b/spec/models/projects/activity_spec.rb
@@ -132,12 +132,12 @@ describe Projects::Activity, type: :model do
end
it 'is the latest wiki_contents update' do
- wiki_content.update_attribute(:updated_on, initial_time - 10.seconds)
- wiki_content2.update_attribute(:updated_on, initial_time - 20.seconds)
+ wiki_content.update_attribute(:updated_at, initial_time - 10.seconds)
+ wiki_content2.update_attribute(:updated_at, initial_time - 20.seconds)
wiki_content.reload
wiki_content2.reload
- expect(latest_activity).to eql wiki_content.updated_on
+ expect(latest_activity).to eql wiki_content.updated_at
end
it 'is the latest news update' do
@@ -159,12 +159,12 @@ describe Projects::Activity, type: :model do
end
it 'is the latest message update' do
- message.update_attribute(:updated_on, initial_time - 10.seconds)
- message2.update_attribute(:updated_on, initial_time - 20.seconds)
+ message.update_attribute(:updated_at, initial_time - 10.seconds)
+ message2.update_attribute(:updated_at, initial_time - 20.seconds)
message.reload
message2.reload
- expect(latest_activity).to eql message.updated_on
+ expect(latest_activity).to eql message.updated_at
end
it 'is the latest time_entry update' do
@@ -179,10 +179,10 @@ describe Projects::Activity, type: :model do
it 'takes the time stamp of the latest activity across models' do
work_package.update_attribute(:updated_at, initial_time - 10.seconds)
- wiki_content.update_attribute(:updated_on, initial_time - 20.seconds)
+ wiki_content.update_attribute(:updated_at, initial_time - 20.seconds)
news.update_attribute(:updated_at, initial_time - 30.seconds)
changeset.update_attribute(:committed_on, initial_time - 40.seconds)
- message.update_attribute(:updated_on, initial_time - 50.seconds)
+ message.update_attribute(:updated_at, initial_time - 50.seconds)
work_package.reload
wiki_content.reload
@@ -199,7 +199,7 @@ describe Projects::Activity, type: :model do
expect(latest_activity).to eql work_package.updated_at
- work_package.update_attribute(:updated_at, message.updated_on - 10.seconds)
+ work_package.update_attribute(:updated_at, message.updated_at - 10.seconds)
# Order:
# wiki_content
@@ -208,9 +208,9 @@ describe Projects::Activity, type: :model do
# message
# work_package
- expect(latest_activity).to eql wiki_content.updated_on
+ expect(latest_activity).to eql wiki_content.updated_at
- wiki_content.update_attribute(:updated_on, work_package.updated_at - 10.seconds)
+ wiki_content.update_attribute(:updated_at, work_package.updated_at - 10.seconds)
# Order:
# news
@@ -221,7 +221,7 @@ describe Projects::Activity, type: :model do
expect(latest_activity).to eql news.updated_at
- news.update_attribute(:updated_at, wiki_content.updated_on - 10.seconds)
+ news.update_attribute(:updated_at, wiki_content.updated_at - 10.seconds)
# Order:
# changeset
@@ -241,7 +241,7 @@ describe Projects::Activity, type: :model do
# news
# changeset
- expect(latest_activity).to eql message.updated_on
+ expect(latest_activity).to eql message.updated_at
end
end
end
diff --git a/spec/requests/api/v3/membership_resources_spec.rb b/spec/requests/api/v3/membership_resources_spec.rb
index 2eb4baacb93..c968311ab5d 100644
--- a/spec/requests/api/v3/membership_resources_spec.rb
+++ b/spec/requests/api/v3/membership_resources_spec.rb
@@ -273,7 +273,7 @@ describe 'API v3 memberships resource', type: :request, content_type: :json do
end
end
- context 'with the outdated created_on sort by (renamed ot created_at' do
+ context 'with the outdated created_on sort by (renamed to created_at)' do
let(:path) { "#{api_v3_paths.path_for(:memberships, sort_by: [%i(created_on desc)])}&pageSize=1&offset=2" }
it 'is still supported and returns a slice of the visible memberships' do
diff --git a/spec_legacy/fixtures/comments.yml b/spec_legacy/fixtures/comments.yml
index 86f2892c76d..b4acbd31ea1 100644
--- a/spec_legacy/fixtures/comments.yml
+++ b/spec_legacy/fixtures/comments.yml
@@ -33,14 +33,14 @@ comments_001:
id: 1
author_id: 1
comments: my first comment
- created_on: 2006-12-10 18:10:10 +01:00
- updated_on: 2006-12-10 18:10:10 +01:00
+ created_at: 2006-12-10 18:10:10 +01:00
+ updated_at: 2006-12-10 18:10:10 +01:00
comments_002:
commented_type: News
commented_id: 1
id: 2
author_id: 2
comments: This is an other comment
- created_on: 2006-12-10 18:12:10 +01:00
- updated_on: 2006-12-10 18:12:10 +01:00
+ created_at: 2006-12-10 18:12:10 +01:00
+ updated_at: 2006-12-10 18:12:10 +01:00
diff --git a/spec_legacy/fixtures/messages.yml b/spec_legacy/fixtures/messages.yml
index 8758c2bf9d6..b49fcdd53dc 100644
--- a/spec_legacy/fixtures/messages.yml
+++ b/spec_legacy/fixtures/messages.yml
@@ -28,8 +28,8 @@
---
messages_001:
- created_on: 2007-05-12 17:15:32 +02:00
- updated_on: 2007-05-12 17:15:32 +02:00
+ created_at: 2007-05-12 17:15:32 +02:00
+ updated_at: 2007-05-12 17:15:32 +02:00
subject: First post
id: 1
replies_count: 2
@@ -39,8 +39,8 @@ messages_001:
parent_id:
forum_id: 1
messages_002:
- created_on: 2007-05-12 17:18:00 +02:00
- updated_on: 2007-05-12 17:18:00 +02:00
+ created_at: 2007-05-12 17:18:00 +02:00
+ updated_at: 2007-05-12 17:18:00 +02:00
subject: First reply
id: 2
replies_count: 0
@@ -50,8 +50,8 @@ messages_002:
parent_id: 1
forum_id: 1
messages_003:
- created_on: 2007-05-12 17:18:02 +02:00
- updated_on: 2007-05-12 17:18:02 +02:00
+ created_at: 2007-05-12 17:18:02 +02:00
+ updated_at: 2007-05-12 17:18:02 +02:00
subject: "RE: First post"
id: 3
replies_count: 0
@@ -61,8 +61,8 @@ messages_003:
parent_id: 1
forum_id: 1
messages_004:
- created_on: 2007-08-12 17:15:32 +02:00
- updated_on: 2007-08-12 17:15:32 +02:00
+ created_at: 2007-08-12 17:15:32 +02:00
+ updated_at: 2007-08-12 17:15:32 +02:00
subject: Post 2
id: 4
replies_count: 2
@@ -72,8 +72,8 @@ messages_004:
parent_id:
forum_id: 1
messages_005:
- created_on: <%= 3.days.ago.to_date.to_s(:db) %>
- updated_on: <%= 3.days.ago.to_date.to_s(:db) %>
+ created_at: <%= 3.days.ago.to_date.to_s(:db) %>
+ updated_at: <%= 3.days.ago.to_date.to_s(:db) %>
subject: 'RE: post 2'
id: 5
replies_count: 0
@@ -83,8 +83,8 @@ messages_005:
parent_id: 4
forum_id: 1
messages_006:
- created_on: <%= 2.days.ago.to_date.to_s(:db) %>
- updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
+ created_at: <%= 2.days.ago.to_date.to_s(:db) %>
+ updated_at: <%= 2.days.ago.to_date.to_s(:db) %>
subject: 'RE: post 2'
id: 6
replies_count: 0
@@ -94,8 +94,8 @@ messages_006:
parent_id: 4
forum_id: 1
messages_007:
- created_on: <%= 2.days.ago.to_date.to_s(:db) %>
- updated_on: <%= 2.days.ago.to_date.to_s(:db) %>
+ created_at: <%= 2.days.ago.to_date.to_s(:db) %>
+ updated_at: <%= 2.days.ago.to_date.to_s(:db) %>
subject: 'Message on a private project'
id: 7
replies_count: 0
diff --git a/spec_legacy/fixtures/tokens.yml b/spec_legacy/fixtures/tokens.yml
index 04180d8af42..86ddceb0674 100644
--- a/spec_legacy/fixtures/tokens.yml
+++ b/spec_legacy/fixtures/tokens.yml
@@ -28,13 +28,13 @@
---
tokens_001:
- created_on: 2007-01-21 00:39:12 +01:00
+ created_at: 2007-01-21 00:39:12 +01:00
type: Token::Invitation
id: 1
value: DwMJ2yIxBNeAk26znMYzYmz5dAiIina0GFrPnGTM
user_id: 1
tokens_002:
- created_on: 2007-01-21 00:39:52 +01:00
+ created_at: 2007-01-21 00:39:52 +01:00
id: 2
value: sahYSIaoYrsZUef86sTHrLISdznW6ApF36h5WSnm
type: Token::Recovery
diff --git a/spec_legacy/fixtures/users.yml b/spec_legacy/fixtures/users.yml
index 4bc040d2229..748f4ad6ece 100644
--- a/spec_legacy/fixtures/users.yml
+++ b/spec_legacy/fixtures/users.yml
@@ -28,11 +28,11 @@
---
users_004:
- created_on: 2006-07-19 19:34:07 +02:00
+ created_at: 2006-07-19 19:34:07 +02:00
status: 1
last_login_on:
language: en
- updated_on: 2006-07-19 19:34:07 +02:00
+ updated_at: 2006-07-19 19:34:07 +02:00
admin: false
lastname: Hill
@@ -44,11 +44,11 @@ users_004:
type: User
first_login: false
users_001:
- created_on: 2006-07-19 19:12:21 +02:00
+ created_at: 2006-07-19 19:12:21 +02:00
status: 1
last_login_on: 2006-07-19 22:57:52 +02:00
language: en
- updated_on: 2006-07-19 22:57:52 +02:00
+ updated_at: 2006-07-19 22:57:52 +02:00
admin: true
lastname: Admin
@@ -60,11 +60,11 @@ users_001:
type: User
first_login: false
users_002:
- created_on: 2006-07-19 19:32:09 +02:00
+ created_at: 2006-07-19 19:32:09 +02:00
status: 1
last_login_on: 2006-07-19 22:42:15 +02:00
language: en
- updated_on: 2006-07-19 22:42:15 +02:00
+ updated_at: 2006-07-19 22:42:15 +02:00
admin: false
lastname: Smith
@@ -76,11 +76,11 @@ users_002:
type: User
first_login: false
users_003:
- created_on: 2006-07-19 19:33:19 +02:00
+ created_at: 2006-07-19 19:33:19 +02:00
status: 1
last_login_on:
language: en
- updated_on: 2006-07-19 19:33:19 +02:00
+ updated_at: 2006-07-19 19:33:19 +02:00
admin: false
lastname: Lopper
@@ -93,12 +93,12 @@ users_003:
first_login: false
users_005:
id: 5
- created_on: 2006-07-19 19:33:19 +02:00
+ created_at: 2006-07-19 19:33:19 +02:00
# Locked
status: 3
last_login_on:
language: en
- updated_on: 2006-07-19 19:33:19 +02:00
+ updated_at: 2006-07-19 19:33:19 +02:00
admin: false
lastname: Lopper2
@@ -110,11 +110,11 @@ users_005:
first_login: false
users_006:
id: 6
- created_on: 2006-07-19 19:33:19 +02:00
+ created_at: 2006-07-19 19:33:19 +02:00
status: 1
last_login_on:
language: ''
- updated_on: 2006-07-19 19:33:19 +02:00
+ updated_at: 2006-07-19 19:33:19 +02:00
admin: false
mail: ''
lastname: Anonymous
@@ -126,11 +126,11 @@ users_006:
first_login: false
users_007:
id: 7
- created_on: 2006-07-19 19:33:19 +02:00
+ created_at: 2006-07-19 19:33:19 +02:00
status: 1
last_login_on:
language: ''
- updated_on: 2006-07-19 19:33:19 +02:00
+ updated_at: 2006-07-19 19:33:19 +02:00
admin: false
lastname: One
@@ -142,11 +142,11 @@ users_007:
first_login: false
users_008:
id: 8
- created_on: 2006-07-19 19:33:19 +02:00
+ created_at: 2006-07-19 19:33:19 +02:00
status: 1
last_login_on:
language: 'de'
- updated_on: 2006-07-19 19:33:19 +02:00
+ updated_at: 2006-07-19 19:33:19 +02:00
admin: false
lastname: Misc
@@ -158,11 +158,11 @@ users_008:
first_login: false
users_009:
id: 9
- created_on: 2006-07-19 19:33:19 +02:00
+ created_at: 2006-07-19 19:33:19 +02:00
status: 1
last_login_on:
language: 'de'
- updated_on: 2006-07-19 19:33:19 +02:00
+ updated_at: 2006-07-19 19:33:19 +02:00
admin: false
lastname: Misc
diff --git a/spec_legacy/fixtures/versions.yml b/spec_legacy/fixtures/versions.yml
index f8f06c9105b..50c92e2a737 100644
--- a/spec_legacy/fixtures/versions.yml
+++ b/spec_legacy/fixtures/versions.yml
@@ -28,70 +28,70 @@
---
versions_001:
- created_on: 2006-07-19 21:00:07 +02:00
+ created_at: 2006-07-19 21:00:07 +02:00
name: "0.1"
project_id: 1
- updated_on: 2006-07-19 21:00:07 +02:00
+ updated_at: 2006-07-19 21:00:07 +02:00
id: 1
description: Beta
effective_date: 2006-07-01
status: closed
sharing: 'none'
versions_002:
- created_on: 2006-07-19 21:00:33 +02:00
+ created_at: 2006-07-19 21:00:33 +02:00
name: "1.0"
project_id: 1
- updated_on: 2006-07-19 21:00:33 +02:00
+ updated_at: 2006-07-19 21:00:33 +02:00
id: 2
description: Stable release
effective_date: <%= 20.day.from_now.to_date.to_s(:db) %>
status: locked
sharing: 'none'
versions_003:
- created_on: 2006-07-19 21:00:33 +02:00
+ created_at: 2006-07-19 21:00:33 +02:00
name: "2.0"
project_id: 1
- updated_on: 2006-07-19 21:00:33 +02:00
+ updated_at: 2006-07-19 21:00:33 +02:00
id: 3
description: Future version
effective_date:
status: open
sharing: 'none'
versions_004:
- created_on: 2006-07-19 21:00:33 +02:00
+ created_at: 2006-07-19 21:00:33 +02:00
name: "2.0"
project_id: 3
- updated_on: 2006-07-19 21:00:33 +02:00
+ updated_at: 2006-07-19 21:00:33 +02:00
id: 4
description: Future version on subproject
effective_date:
status: open
sharing: 'tree'
versions_005:
- created_on: 2006-07-19 21:00:07 +02:00
+ created_at: 2006-07-19 21:00:07 +02:00
name: "Alpha"
project_id: 2
- updated_on: 2006-07-19 21:00:07 +02:00
+ updated_at: 2006-07-19 21:00:07 +02:00
id: 5
description: Private Alpha
effective_date: 2006-07-01
status: open
sharing: 'none'
versions_006:
- created_on: 2006-07-19 21:00:07 +02:00
+ created_at: 2006-07-19 21:00:07 +02:00
name: "Private Version of public subproject"
project_id: 5
- updated_on: 2006-07-19 21:00:07 +02:00
+ updated_at: 2006-07-19 21:00:07 +02:00
id: 6
description: "Should be done any day now..."
effective_date:
status: open
sharing: 'tree'
versions_007:
- created_on: 2006-07-19 21:00:07 +02:00
+ created_at: 2006-07-19 21:00:07 +02:00
name: "Systemwide visible version"
project_id: 2
- updated_on: 2006-07-19 21:00:07 +02:00
+ updated_at: 2006-07-19 21:00:07 +02:00
id: 7
description:
effective_date:
diff --git a/spec_legacy/fixtures/wiki_contents.yml b/spec_legacy/fixtures/wiki_contents.yml
index 15821df4f84..c3b380db548 100644
--- a/spec_legacy/fixtures/wiki_contents.yml
+++ b/spec_legacy/fixtures/wiki_contents.yml
@@ -32,7 +32,7 @@ wiki_contents_001:
h1. CookBook documentation
Some updated [[documentation]] here with gzipped history
- updated_on: 2007-03-07 00:10:51 +01:00
+ updated_at: 2007-03-07 00:10:51 +01:00
page_id: 1
id: 1
lock_version: 3
@@ -44,7 +44,7 @@ wiki_contents_002:
This is a link to a ticket: #2
And this is an included page:
{{include(Page with an inline image)}}
- updated_on: 2007-03-08 00:18:07 +01:00
+ updated_at: 2007-03-08 00:18:07 +01:00
page_id: 2
id: 2
lock_version: 1
@@ -54,7 +54,7 @@ wiki_contents_003:
h1. Start page
E-commerce web site start page
- updated_on: 2007-03-08 00:18:07 +01:00
+ updated_at: 2007-03-08 00:18:07 +01:00
page_id: 3
id: 3
lock_version: 1
@@ -66,7 +66,7 @@ wiki_contents_004:
This is an inline image:
!logo.gif!
- updated_on: 2007-03-08 00:18:07 +01:00
+ updated_at: 2007-03-08 00:18:07 +01:00
page_id: 4
id: 4
lock_version: 1
@@ -76,7 +76,7 @@ wiki_contents_005:
h1. Child page 1
This is a child page
- updated_on: 2007-03-08 00:18:07 +01:00
+ updated_at: 2007-03-08 00:18:07 +01:00
page_id: 5
id: 5
lock_version: 1
@@ -86,35 +86,35 @@ wiki_contents_006:
h1. Child page 2
This is a child page
- updated_on: 2007-03-08 00:18:07 +01:00
+ updated_at: 2007-03-08 00:18:07 +01:00
page_id: 6
id: 6
lock_version: 1
author_id: 1
wiki_contents_007:
text: This is a child page
- updated_on: 2007-03-08 00:18:07 +01:00
+ updated_at: 2007-03-08 00:18:07 +01:00
page_id: 7
id: 7
lock_version: 1
author_id: 1
wiki_contents_008:
text: This is a parent page
- updated_on: 2007-03-08 00:18:07 +01:00
+ updated_at: 2007-03-08 00:18:07 +01:00
page_id: 8
id: 8
lock_version: 1
author_id: 1
wiki_contents_009:
text: This is a child page
- updated_on: 2007-03-08 00:18:07 +01:00
+ updated_at: 2007-03-08 00:18:07 +01:00
page_id: 9
id: 9
lock_version: 1
author_id: 1
wiki_contents_010:
text: Page with cyrillic title
- updated_on: 2007-03-08 00:18:07 +01:00
+ updated_at: 2007-03-08 00:18:07 +01:00
page_id: 10
id: 10
lock_version: 1
diff --git a/spec_legacy/fixtures/wiki_pages.yml b/spec_legacy/fixtures/wiki_pages.yml
index 261763f6023..4a33ea39846 100644
--- a/spec_legacy/fixtures/wiki_pages.yml
+++ b/spec_legacy/fixtures/wiki_pages.yml
@@ -28,7 +28,7 @@
---
wiki_pages_001:
- created_on: 2007-03-07 00:08:07 +01:00
+ created_at: 2007-03-07 00:08:07 +01:00
title: CookBook documentation
slug: cookbook-documentation
id: 1
@@ -36,7 +36,7 @@ wiki_pages_001:
protected: true
parent_id:
wiki_pages_002:
- created_on: 2007-03-08 00:18:07 +01:00
+ created_at: 2007-03-08 00:18:07 +01:00
title: Another page
slug: another-page
id: 2
@@ -44,7 +44,7 @@ wiki_pages_002:
protected: false
parent_id:
wiki_pages_003:
- created_on: 2007-03-08 00:18:07 +01:00
+ created_at: 2007-03-08 00:18:07 +01:00
title: Start page
slug: start-page
id: 3
@@ -52,7 +52,7 @@ wiki_pages_003:
protected: false
parent_id:
wiki_pages_004:
- created_on: 2007-03-08 00:18:07 +01:00
+ created_at: 2007-03-08 00:18:07 +01:00
title: Page with an inline image
slug: page-with-an-inline-image
id: 4
@@ -60,7 +60,7 @@ wiki_pages_004:
protected: false
parent_id: 1
wiki_pages_005:
- created_on: 2007-03-08 00:18:07 +01:00
+ created_at: 2007-03-08 00:18:07 +01:00
title: Child 1
slug: child-1
id: 5
@@ -68,7 +68,7 @@ wiki_pages_005:
protected: false
parent_id: 2
wiki_pages_006:
- created_on: 2007-03-08 00:18:07 +01:00
+ created_at: 2007-03-08 00:18:07 +01:00
title: Child 2
slug: child-2
id: 6
@@ -76,7 +76,7 @@ wiki_pages_006:
protected: false
parent_id: 2
wiki_pages_007:
- created_on: 2007-03-08 00:18:07 +01:00
+ created_at: 2007-03-08 00:18:07 +01:00
title: Child page 1
slug: child-page-1
id: 7
@@ -84,7 +84,7 @@ wiki_pages_007:
protected: false
parent_id: 8
wiki_pages_008:
- created_on: 2007-03-08 00:18:07 +01:00
+ created_at: 2007-03-08 00:18:07 +01:00
title: Parent page
slug: parent-page
id: 8
@@ -92,7 +92,7 @@ wiki_pages_008:
protected: false
parent_id:
wiki_pages_009:
- created_on: 2007-03-08 00:18:07 +01:00
+ created_at: 2007-03-08 00:18:07 +01:00
title: Child page 2
slug: child-page-2
id: 9
@@ -100,7 +100,7 @@ wiki_pages_009:
protected: false
parent_id: 8
wiki_pages_010:
- created_on: 2007-03-08 00:18:07 +01:00
+ created_at: 2007-03-08 00:18:07 +01:00
title: Этика менеджмента
slug: etika-mieniedzhmienta
id: 10
diff --git a/spec_legacy/functional/wiki_controller_spec.rb b/spec_legacy/functional/wiki_controller_spec.rb
index ad532f339a7..366bf9567be 100644
--- a/spec_legacy/functional/wiki_controller_spec.rb
+++ b/spec_legacy/functional/wiki_controller_spec.rb
@@ -148,12 +148,11 @@ describe WikiController, type: :controller do
# because running whole suite is fine, but running only this test
# results in failure
it 'should update stale page should not raise an error' do
- ::JournalVersion.create!(journable_type: 'WikiContent', journable_id: 2, version: 1)
- journal = FactoryBot.create :wiki_content_journal,
- journable_id: 2,
- version: 1,
- data: FactoryBot.build(:journal_wiki_content_journal,
- text: "h1. Another page\n\n\nthis is a link to ticket: #2")
+ FactoryBot.create :wiki_content_journal,
+ journable_id: 2,
+ version: 1,
+ data: FactoryBot.build(:journal_wiki_content_journal,
+ text: "h1. Another page\n\n\nthis is a link to ticket: #2")
session[:user_id] = 2
c = Wiki.find(1).find_page('Another page').content
c.text = 'Previous text'
@@ -354,7 +353,7 @@ describe WikiController, type: :controller do
pages = assigns(:pages)
refute_nil pages
assert_equal wiki.pages.size, pages.size
- assert_equal pages.first.content.updated_on, pages.first.updated_on
+ assert_equal pages.first.content.updated_at, pages.first.updated_at
assert_select 'ul', attributes: { class: 'pages-hierarchy' },
child: { tag: 'li', child: { tag: 'a', attributes: { href: '/projects/ecookbook/wiki/CookBook%20documentation' },
diff --git a/spec_legacy/unit/mail_handler_spec.rb b/spec_legacy/unit/mail_handler_spec.rb
index 99559a0a82e..ee4e756c738 100644
--- a/spec_legacy/unit/mail_handler_spec.rb
+++ b/spec_legacy/unit/mail_handler_spec.rb
@@ -304,7 +304,6 @@ describe MailHandler, type: :model do
specify 'reply to issue update (Journal) by message_id' do
Journal.delete_all
FactoryBot.create :work_package_journal, id: 3, version: 1, journable_id: 2
- JournalVersion.create(journable_type: 'WorkPackage', journable_id: 2, version: 1)
journal = submit_email('ticket_reply_by_message_id.eml')
assert journal.data.is_a?(Journal::WorkPackageJournal), "Email was a #{journal.data.class}"
assert_equal User.find_by_login('jsmith'), journal.user
diff --git a/spec_legacy/unit/wiki_page_spec.rb b/spec_legacy/unit/wiki_page_spec.rb
index 6e95c3971f4..a3d8840a81f 100644
--- a/spec_legacy/unit/wiki_page_spec.rb
+++ b/spec_legacy/unit/wiki_page_spec.rb
@@ -128,9 +128,9 @@ describe WikiPage, type: :model do
end
it 'should updated on eager load' do
- page = WikiPage.with_updated_on.first
+ page = WikiPage.with_updated_at.first
assert page.is_a?(WikiPage)
- refute_nil page.read_attribute(:updated_on)
- assert_equal page.content.updated_on, page.updated_on
+ refute_nil page.read_attribute(:updated_at)
+ assert_equal page.content.updated_at, page.updated_at
end
end