Skip to content

Feature/#24 deactivate closing comments#170

Merged
vickyokrm merged 6 commits intodevelopfrom
feature/#24-deactivate-closing-comments
Dec 14, 2017
Merged

Feature/#24 deactivate closing comments#170
vickyokrm merged 6 commits intodevelopfrom
feature/#24-deactivate-closing-comments

Conversation

@vickyokrm
Copy link
Copy Markdown

@vickyokrm vickyokrm commented Dec 10, 2017

Features Deactivation of Closing comment solution. This closes #24

Thus, Please check if the solution and the code is optimistic.

Solution Overview

  • New permission setting so called Assitify_Deactivate_request_closing_comments grouped under Assitify is created.
  • Comments section in the Sweet alert window is dynamically determined based on the above setting.
  • The new setting has reflected in the setting-based-permission section with no implications found while testing together.

@ghost ghost assigned vickyokrm Dec 10, 2017
@ghost ghost added the progress:working label Dec 10, 2017
@vickyokrm vickyokrm requested a review from mrsimpson December 10, 2017 00:11
@@ -1,5 +1,10 @@
import { RocketChat, UiTextContext } from 'meteor/rocketchat:lib';

const showClosingComment = function() {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function was invoked to determine if the close comment section should be visible or not. I tried a lot to have this function referenced to sweet alert config using inline/shorthand declaration. However, did not work :(.

section: 'General'
});

RocketChat.settings.add('Assitify_Deactivate_request_closing_comments', false, {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not want to test my German skill here :). So Please help to translate.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Kommentieren beim Schließen von Anfragen verhindern"

Copy link
Copy Markdown
Member

@mrsimpson mrsimpson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the swal-config creation

Close_HelpRequest: Close chat
Close_request_comment: You can add (famous) last words
Close_request_warning: Please do close the request once you are finished answering the questions asked. This way, we can learn from what you have written.
Deactivate_close_comment: Allow Request closing comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not be the other way round:
Deactivate_close_comment: Don't allow closing comments

section: 'General'
});

RocketChat.settings.add('Assitify_Deactivate_request_closing_comments', false, {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Kommentieren beim Schließen von Anfragen verhindern"

title: t('Closing_chat'),
text: warnText ? t(warnText) : '',
type: 'input',
type: showClosingComment(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is kind-of-a-hack. The swal-configuration could also not contain the input properties. Let me give you a sample

let swalConfig = {
			title: t('Closing_chat'),
			type: showClosingComment(),
			showCancelButton: true,
			closeOnConfirm: false
		};

		if (showClosingComment()) {
			swalConfig = _.extend(swalConfig, {
				type: 'input',
				inputPlaceholder: t('Please_add_a_comment')
			});
		}

		swal(swalConfig, (inputValue) => {

@ghost ghost assigned mrsimpson Dec 13, 2017
@ThomasRoehl
Copy link
Copy Markdown

The functionality works like expected.
The permission to change the settings is also set correctly.

@vickyokrm
Copy link
Copy Markdown
Author

The Object.extend method seem to be not working. However, I found that Object.assign shall be used to merge object properties. Link to MDN Merging Objects

Copy link
Copy Markdown
Author

@vickyokrm vickyokrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated text translation for DE and Property merging using Object.assign

@vickyokrm vickyokrm merged commit ab98c85 into develop Dec 14, 2017
@ghost ghost removed the progress:working label Dec 14, 2017
@vickyokrm vickyokrm deleted the feature/#24-deactivate-closing-comments branch December 14, 2017 15:04
@graywolf336
Copy link
Copy Markdown

@vickyokrm My apologies, you are correct it was Object.assign I was thinking of. 👍

@mrsimpson
Copy link
Copy Markdown
Member

And Object.assign is not supported by IE. And as we’re on the frontend in this case, we’ll stick to _ . I know why I hate that UI-stuff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Proxy] Deactivation of closing comment

4 participants