Skip to content

Commit

Permalink
Merge pull request #13160 from opf/bug/45011-no-info-about-changes-in…
Browse files Browse the repository at this point in the history
…-activity-when-use-checkbox-in-the-custom-field

[#45011] No info about changes in activity when use checkbox in custom fields
  • Loading branch information
HDinger authored Jul 19, 2023
2 parents 93251d2 + aed72f9 commit abb2c95
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ export class UserActivityComponent extends WorkPackageCommentFieldHandler implem
this.$element.bind('focusin', this.focus.bind(this));
this.$element.bind('focusout', this.blur.bind(this));

_.each(this.activity.details, (detail:any) => {
this.details.push(detail.html);
_.each(this.activity.details, (detail:{ html:string }) => {
this.details.push(this.sanitization.bypassSecurityTrustHtml(detail.html));
});

this
Expand Down
32 changes: 30 additions & 2 deletions spec/features/work_packages/tabs/activity_tab_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,26 @@
js: true,
selenium: true do
def alter_work_package_at(work_package, attributes:, at:, user: User.current)
work_package.custom_field_values = attributes.delete(:custom_field_values)
work_package.update(attributes.merge(updated_at: at))

note_journal = work_package.journals.last
note_journal.update(created_at: at, updated_at: at, user:)
end

let(:project) { create(:project_with_types, public: true) }
let(:string_cf) { create(:text_wp_custom_field) }

let(:type_with_cf) do
create(:type, custom_fields: [string_cf])
end

let(:project) do
create(:project_with_types,
types: [type_with_cf],
work_package_custom_fields: [string_cf],
public: true)
end

let!(:work_package) do
work_package = create(:work_package,
project:,
Expand All @@ -65,7 +78,13 @@ def alter_work_package_at(work_package, attributes:, at:, user: User.current)
end

let!(:note1) do
attributes = { subject: 'New subject', description: 'Some not so long description.' }
attributes = {
subject: 'New subject',
description: 'Some not so long description.',
custom_field_values: {
string_cf.id => "* [x] Task 1\n* [ ] Task 2"
}
}

alter_work_package_at(work_package,
attributes:,
Expand Down Expand Up @@ -208,6 +227,15 @@ def alter_work_package_at(work_package, attributes:, at:, user: User.current)
expect(page).to have_selector('.user-comment > .message', count: 3)
expect(page).to have_selector('.user-comment > .message blockquote')
end

it 'can render checkboxes as part of the activity' do
task_list = page.all('[data-qa-activity-number="2"] ul.op-uc-list_task-list li.op-uc-list--item')
expect(task_list.size).to eq(2)
expect(task_list[0]).to have_text('Task 1')
expect(task_list[0]).to have_checked_field(disabled: true)
expect(task_list[1]).to have_text('Task 2')
expect(task_list[1]).to have_unchecked_field(disabled: true)
end
end

context 'with no permission' do
Expand Down

0 comments on commit abb2c95

Please sign in to comment.