Social profile icon causing warning in Elasticsearch display

Bug #1745042 reported by Ghada El-Zoghbi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Ghada El-Zoghbi
17.10
Fix Released
Medium
Unassigned
18.04
Fix Released
Medium
Ghada El-Zoghbi

Bug Description

Mahara: 17:10.2 (2017092611)
OS: Linux 16.04
DB: Postgres
Browser: any

An warning is displayed (and debug is on) when using Elastisearch when searching on data. Please refer to attached image of warning.

We are using the raw_old theme but it's also present in raw.

I haven't been able to track down the data itself but I can see that it stems from a social profile not having a relevant icon. And, I can track it down to:

/htdocs/search/elasticsearch/type/ElasticsearchType_artefact.php::getRecordDataById - lines 353-356

If the array $icons is empty, the properties: link and icon

do not get set.

Which leads to this warning in the template:

/htdocs/theme/raw_old/plugintype/search/elasticsearch/templates/artefact.tpl

on line 15.

Revision history for this message
Ghada El-Zoghbi (ghada-z) wrote :
Changed in mahara:
milestone: none → 18.04.0
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/8466

Revision history for this message
Ghada El-Zoghbi (ghada-z) wrote :

hi @robertl,

I've dug around a bit more. The bug appears (i.e. icon not set) when the user logged in does not match the record owner.

That is, in

    search/elasticsearch/type/ElasticsearthType_artefact.php::getRecordDataById()

It checks:

if ($USER->get ( 'id' ) == $record->owner) {

If this does not match, the icon and link are not set.

And, the error is generated.

So, I think the check needs to happen in the template if those values are missing.

What do you think ?

And, this is how we can test for it.

Thanks,
Ghada

Revision history for this message
Ghada El-Zoghbi (ghada-z) wrote :

Steps to reproduce:

1. Set up elasticsearch and ensure social profiles are indexed.
2. As user1, create a social profile for 'Twitter'
3. As user1, add this social profile to your Profile page.
4. As user2, create a social profile for 'Twitter'
5. As user2, add this social profile to your Profile page.
6. Ensure the elasticsearch indexing is complete
7. As user2, search (at the top) for 'Twitter'
8. You should now see the error message:
[WAR] 2c (lib/dwoo/dwoo/Dwoo/Core.php:1265) Undefined property: stdClass::$icon

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8466
Committed: https://git.mahara.org/mahara/mahara/commit/7f65b938cfb71a6d4a3d49bcdd26e20f16d3bb43
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 7f65b938cfb71a6d4a3d49bcdd26e20f16d3bb43
Author: Ghada El-Zoghbi <email address hidden>
Date: Wed Jan 24 10:12:35 2018 +1100

Bug 1745042: set link and icon attribute for socialprofiles

When a user shares their socialprofile on their
profile page and another user searches
for that social profile (using elsaticsearch),
the icon attribute is never set.
Because social profiles are external to Mahara,
we can display the link to users.

Sponsored by The Australian National University

behatnotneeded

Change-Id: I94282bed7904f9d37a50b8e0fd32c5f2d174c704

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "17.10_STABLE" branch: https://reviews.mahara.org/8586

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/8586
Committed: https://git.mahara.org/mahara/mahara/commit/da597048a2411d58daa96280999847de4e4b9cf9
Submitter: Robert Lyon (<email address hidden>)
Branch: 17.10_STABLE

commit da597048a2411d58daa96280999847de4e4b9cf9
Author: Ghada El-Zoghbi <email address hidden>
Date: Wed Jan 24 10:12:35 2018 +1100

Bug 1745042: set link and icon attribute for socialprofiles

When a user shares their socialprofile on their
profile page and another user searches
for that social profile (using elsaticsearch),
the icon attribute is never set.
Because social profiles are external to Mahara,
we can display the link to users.

Sponsored by The Australian National University

behatnotneeded

Change-Id: I94282bed7904f9d37a50b8e0fd32c5f2d174c704
(cherry picked from commit 7f65b938cfb71a6d4a3d49bcdd26e20f16d3bb43)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.