How to disable edit and delete buttons for feed messages in every section where feed appears?

Hi everyone,

I was trying to remove edit and delete access rights from feed messages. I tried this by modifying the object permission for this object "SocialMessages". However after some investigation I reached to the point that feed is not dependent on object permissions but is something that can be modified in client-modules (front-end). I would like to know if there is a way how to remove/disable the edit and delete button.

Thanks in advance :)

Like 0

Like

5 comments
Best reply

Luis Kateshi,

 

they can be overriden it depends on the approach it's done. For example try creating a module in configurations with the UsrSocialFeedUtilities name and the following code:

define("UsrSocialFeedUtilities", ["terrasoft", "SocialFeedUtilities"], function(Terrasoft) {
    Ext.override(Terrasoft.SocialFeedUtilities, {
        getPostCommentEditVisible: function() {
                    return false;
                },
        getPostCommentDeleteVisible: function() {
            return false;
        }
    });
    return {}; 
});

and then create a repalcing view model for the SocialFeed module with the following code (where we add the created UsrSocialFeedUtilities module as a dependency):

define("SocialFeed", ["UsrSocialFeedUtilities"],
	function() {
		return {
			properties: {},
			mixins: {},
			messages: {},
			attributes: {},
			methods: {},
			diff: []
		};
 });

refresh the page in the UI and check what happens. I am sure the edit and delete buttons will be hidden.

Hi Luis,

 

Indeed this can be done by overriding the logic of the getPostCommentEditVisible and getPostCommentDeleteVisible methods from the SocialFeedUtilities module. So you need to override these methods.

Hi Oleg,

Thanks for your reply. I already tried to do this but as I see it is not possible to create a replacing client-module for "SocialFeedUtilities". And the methods u mentioned (getPostCommentEditVisible and getPostCommentDeleteVisible) seem to be private and I don't think they can be overriden. 

 

/**

         * ########## ######### ###### ############## #########/###########.

         * @private

         */

        getPostCommentEditVisible: function() {

            return this.getPostCommentEditDeleteVisible();

        },

Luis Kateshi,

 

they can be overriden it depends on the approach it's done. For example try creating a module in configurations with the UsrSocialFeedUtilities name and the following code:

define("UsrSocialFeedUtilities", ["terrasoft", "SocialFeedUtilities"], function(Terrasoft) {
    Ext.override(Terrasoft.SocialFeedUtilities, {
        getPostCommentEditVisible: function() {
                    return false;
                },
        getPostCommentDeleteVisible: function() {
            return false;
        }
    });
    return {}; 
});

and then create a repalcing view model for the SocialFeed module with the following code (where we add the created UsrSocialFeedUtilities module as a dependency):

define("SocialFeed", ["UsrSocialFeedUtilities"],
	function() {
		return {
			properties: {},
			mixins: {},
			messages: {},
			attributes: {},
			methods: {},
			diff: []
		};
 });

refresh the page in the UI and check what happens. I am sure the edit and delete buttons will be hidden.

Thank you Oleg, it worked, I appreciate your help :)

Hi Oleg Drobina, can remove/disable the edit and delete button in feed message in a specific section like an opportunity only?

Show all comments