Skip to content

Commit

Permalink
Minor fixes and updates for chatter
Browse files Browse the repository at this point in the history
  • Loading branch information
wadewegner committed Mar 7, 2018
1 parent ea441bb commit d448cdc
Show file tree
Hide file tree
Showing 16 changed files with 122 additions and 49 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.sfdx
.vscode
.vscode
scripts
2 changes: 1 addition & 1 deletion config/project-scratch-def.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"orgName": "wade.wegner Company",
"edition": "Developer",
"orgPreferences" : {
"enabled": ["S1DesktopEnabled"],
"enabled": ["S1DesktopEnabled", "ChatterEnabled"],
"disabled": ["S1EncryptedStoragePref2"]
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 3 additions & 1 deletion force-app/main/default/aura/SearchGIPHY/SearchGIPHY.cmp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes">
<aura:component
implements="force:appHostable,flexipage:availableForAllPageTypes"
controller="ChatterHelper">

<aura:attribute name="searchTerms" type="String" />
<aura:attribute name="results" type="Map" />
Expand Down
18 changes: 15 additions & 3 deletions force-app/main/default/aura/SearchGIPHY/SearchGIPHYController.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

({

afterScriptsLoaded: function (component, event, helper) {
Expand All @@ -7,6 +6,19 @@

doInit: function (component, event, helper) {
console.log('doInit called successfully');

var action = component.get("c.getChatterGroups");
$A.enqueueAction(action);

console.log('about to set callback');

action.setCallback(this, function (response) {
console.log('i am back');
// var groups = JSON.parse(response.getReturnValue());
var output = response.getReturnValue();
// console.log('groups');
console.log(output);
});
},

keyCheck: function (component, event, helper) {
Expand Down Expand Up @@ -54,15 +66,15 @@
console.log(results);


var selectedGif=results.data.find(item => item.id === id)
var selectedGif = results.data.find(item => item.id === id)
console.log(selectedGif);

var width = selectedGif.images.original.width;
var height = selectedGif.images.original.height;

console.log("width: " + width);
console.log("height: " + height);

component.set("v.selectedGifWidth", width);
component.set("v.selectedGifHeight", height);
component.set("v.selectedGif", "https://media0.giphy.com/media/" + id + "/giphy.mp4");
Expand Down
90 changes: 90 additions & 0 deletions force-app/main/default/classes/ChatterHelper.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
public with sharing class ChatterHelper {

@AuraEnabled
public static String getChatterGroups() {

// System.debug('getChatterGroups');

// ConnectApi.ContentHubRepositoryCollection repositoryCollection = ConnectApi.ContentHub.getRepositories();

// System.debug('repository');

// for(ConnectApi.ContentHubRepository repository : repositoryCollection.repositories){

// System.debug(repository);

// }





// String userId = UserInfo.getUserId();
// System.debug('userId: ' + userId);

// String communityId = null;
// String imageId = '069D00000001INA'; // need to replace
// // String mentionedUserId = '005D0000001QNpr';
// String targetUserOrGroupOrRecordId = 'me'; // is this right?

// ConnectApi.FeedItemInput input = new ConnectApi.FeedItemInput();
// input.subjectId = targetUserOrGroupOrRecordId;
// input.feedElementType = ConnectApi.FeedElementType.FeedItem;

// ConnectApi.MessageBodyInput messageInput = new ConnectApi.MessageBodyInput();
// ConnectApi.TextSegmentInput textSegment;
// ConnectApi.MentionSegmentInput mentionSegment;
// ConnectApi.MarkupBeginSegmentInput markupBeginSegment;
// ConnectApi.MarkupEndSegmentInput markupEndSegment;
// ConnectApi.InlineImageSegmentInput inlineImageSegment;

// System.debug('here 1');

// messageInput.messageSegments = new List<ConnectApi.MessageSegmentInput>();

// markupBeginSegment = new ConnectApi.MarkupBeginSegmentInput();
// markupBeginSegment.markupType = ConnectApi.MarkupType.Bold;
// messageInput.messageSegments.add(markupBeginSegment);

// System.debug('here 2');

// textSegment = new ConnectApi.TextSegmentInput();
// textSegment.text = 'Hello ';
// messageInput.messageSegments.add(textSegment);

// System.debug('here 3');

// // mentionSegment = new ConnectApi.MentionSegmentInput();
// // mentionSegment.id = mentionedUserId;
// // messageInput.messageSegments.add(mentionSegment);

// System.debug('here 4');

// textSegment = new ConnectApi.TextSegmentInput();
// textSegment.text = '!';
// messageInput.messageSegments.add(textSegment);

// System.debug('here 5');

// markupEndSegment = new ConnectApi.MarkupEndSegmentInput();
// markupEndSegment.markupType = ConnectApi.MarkupType.Bold;
// messageInput.messageSegments.add(markupEndSegment);

// System.debug('here 6');

// inlineImageSegment = new ConnectApi.InlineImageSegmentInput();
// inlineImageSegment.altText = 'image one';
// inlineImageSegment.fileId = imageId;
// messageInput.messageSegments.add(inlineImageSegment);

// input.body = messageInput;

// System.debug('here 7');

// ConnectApi.ChatterFeeds.postFeedElement(communityId, input, null);

// System.debug('here 8');

return 'finished';
}
}
5 changes: 5 additions & 0 deletions force-app/main/default/classes/ChatterHelper.cls-meta.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="urn:metadata.tooling.soap.sforce.com" fqn="ChatterHelper">
<apiVersion>35.0</apiVersion>
<status>Active</status>
</ApexClass>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<RemoteSiteSetting xmlns="http://soap.sforce.com/2006/04/metadata">
<disableProtocolSecurity>false</disableProtocolSecurity>
<isActive>true</isActive>
<url>https://media1.giphy.com</url>
</RemoteSiteSetting>

0 comments on commit d448cdc

Please sign in to comment.