Skip to content
Snippets Groups Projects
Verified Commit dc857ab1 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett
Browse files

Added editable concern

parent 6dd88474
No related branches found
No related tags found
2 merge requests!12258Update Prometheus Merge Request Metrics page,!11375Fix realtime edited text for issues
Pipeline #
Loading
Loading
@@ -5,7 +5,6 @@ class Projects::IssuesController < Projects::ApplicationController
include ToggleAwardEmoji
include IssuableCollections
include SpammableActions
include EditableHelper
 
prepend_before_action :authenticate_user!, only: [:new]
 
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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 ')
Loading
Loading
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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -13,6 +13,7 @@ class Note < ActiveRecord::Base
include AfterCommitQueue
include ResolvableNote
include IgnorableColumn
include Editable
 
ignore_column :original_discussion_id
 
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment