Skip to content

Instantly share code, notes, and snippets.

Jami Gibbs jamigibbs

Block or report user

Report or block jamigibbs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jamigibbs
jamigibbs / feeditem-soql-query.cls
Last active May 21, 2020
SOQL query for profile image from FeedItem
View feeditem-soql-query.cls
feedItemsList = [
SELECT Id, Body, Title, Parent.Name, CreatedDate
TYPEOF InsertedBy WHEN User THEN Name, MediumPhotoUrl END
FROM FeedItem
WHERE CreatedDate = LAST_N_DAYS:30
ORDER BY CreatedDate DESC
];
@jamigibbs
jamigibbs / bad-feeditem-soql-query-3.cls
Last active May 21, 2020
Bad Feed Item SOQL query for profile image 3
View bad-feeditem-soql-query-3.cls
feedItemsList = [
SELECT Id, Body, Title, CreatedDate, Parent.Name, InsertedBy.MediumPhotoUrl
FROM FeedItem
WHERE CreatedDate = LAST_N_DAYS:30
ORDER BY CreatedDate DESC
];
feedItemsList = [
SELECT Id, Body, Title, CreatedDate, Parent.Name, InsertedBy__r.MediumPhotoUrl
FROM FeedItem
@jamigibbs
jamigibbs / bad-feeditem-soql-query-2.cls
Last active May 21, 2020
Bad Feed Item SOQL query for profile image 2
View bad-feeditem-soql-query-2.cls
feedItemsList = [
SELECT Id, Body, Title, CreatedDate, Parent.Name, Parent.Photo.mediumPhotoUrl
FROM FeedItem
WHERE InsertedBy = LAST_N_DAYS:30
ORDER BY CreatedDate DESC
];
@jamigibbs
jamigibbs / bad-feeditem-soql-query.cls
Last active May 21, 2020
Bad Feed Item SOQL query for profile image
View bad-feeditem-soql-query.cls
feedItemsList = [
SELECT Id, Body, Title, CreatedDate, Parent.Name, Parent.MediumPhotoUrl
FROM FeedItem
WHERE CreatedDate = LAST_N_DAYS:30
ORDER BY CreatedDate DESC
];
feedItemsList = [
SELECT Id, Body, Title, CreatedDate, Parent.Name, Parent__r.MediumPhotoUrl
FROM FeedItem
View websocketChat.js
this._socket.on('refreshChatUsers', () => {
return refreshApex(this.wiredChatUsers);
});
@jamigibbs
jamigibbs / server.js
Created Mar 30, 2020
Refresh chat users
View server.js
socket.on('userEnteredChat', () => {
io.emit('refreshChatUsers');
});
socket.on('userLeftChat', () => {
io.emit('refreshChatUsers');
});
@jamigibbs
jamigibbs / websocketChat.js
Last active Mar 31, 2020
Enter and leave chat
View websocketChat.js
handleEnterChat() {
setUserChatActive()
.then((res) => {
this.isChatActive = res.Chat_Active__c;
this._socket.emit('userEnteredChat');
return refreshApex(this.wiredChatUsers);
})
.catch(error => {
// eslint-disable-next-line no-console
console.error('handleEnterChat error', error);
@jamigibbs
jamigibbs / websocketChat.js
Created Mar 30, 2020
chat updated socket event
View websocketChat.js
this._socket.on('chatupdated', () => {
return refreshApex(this.wiredMessages);
});
View websocketChat.js
this._socket.on('output', (data) => {
if (data) {
const fields = {};
fields[CONTENT_FIELD.fieldApiName] = data.message;
fields[USER_FIELD.fieldApiName] = this.userId;
const message = { apiName: MESSAGE_OBJECT.objectApiName, fields };
createRecord(message)
.then(() => {
this._socket.emit('transmit');
@jamigibbs
jamigibbs / server.js
Last active Mar 30, 2020
Server socket on input
View server.js
socket.on('transmit', () => {
io.emit('chatupdated');
});
You can’t perform that action at this time.