BigW Consortium Gitlab

Added editable concern

parent 6dd88474
......@@ -5,7 +5,6 @@ class Projects::IssuesController < Projects::ApplicationController
include ToggleAwardEmoji
include IssuableCollections
include SpammableActions
include EditableHelper
prepend_before_action :authenticate_user!, only: [:new]
......@@ -212,7 +211,7 @@ class Projects::IssuesController < Projects::ApplicationController
issue_number: @issue.iid,
}
if is_edited?(@issue)
if @issue.is_edited?
response[:updated_at] = @issue.updated_at
response[:updated_by_name] = @issue.last_edited_by.name
response[:updated_by_path] = user_path(@issue.last_edited_by)
......
......@@ -2,8 +2,6 @@ require 'digest/md5'
require 'uri'
module ApplicationHelper
include EditableHelper
# Check if a particular controller is the current one
#
# args - One or more controller names to check
......@@ -183,7 +181,7 @@ module ApplicationHelper
end
def edited_time_ago_with_tooltip(object, placement: 'top', html_class: 'time_ago', exclude_author: false)
return unless is_edited?(object)
return unless object.is_edited?
content_tag :small, class: 'edited-text' do
output = content_tag(:span, 'Edited ')
......
module EditableHelper
def is_edited?(object)
!object.last_edited_at.blank? && object.last_edited_at != object.created_at
end
end
module Editable
extend ActiveSupport::Concern
def is_edited?
last_edited_at.present? && last_edited_at != created_at
end
end
......@@ -15,6 +15,7 @@ module Issuable
include Taskable
include TimeTrackable
include Importable
include Editable
# This object is used to gather issuable meta data for displaying
# upvotes, downvotes, notes and closing merge requests count for issues and merge requests
......
......@@ -13,6 +13,7 @@ class Note < ActiveRecord::Base
include AfterCommitQueue
include ResolvableNote
include IgnorableColumn
include Editable
ignore_column :original_discussion_id
......
......@@ -53,7 +53,7 @@
.detail-page-description.content-block
.issue-title-data.hidden{ "data" => { "endpoint" => rendered_title_namespace_project_issue_path(@project.namespace, @project, @issue),
"can-update-tasks-class" => can?(current_user, :update_issue, @issue) ? 'js-task-list-container' : '',
"is-edited": is_edited?(@issue),
"is-edited": @issue.is_edited?,
} }
.issue-title-entrypoint
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment