Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a bug on the popular questions macro?

Jonathan Beattie
May 5, 2017

I've added the 'popular Questions' macro to many of my Confluence pages, with the 'Ask a Question' button included. I have also set topic tags to filter for the macro (i.e. so that it only shows Questions with these topic tags).

It looks like there is a bug with this macro, because the 'ask a question' button does not appear until a question is asked with one of the filtered topic tags. This makes for a poor user experience as people can't ask Questions directly from these Confluence pages until there is at least one question with one of the topic tags designated for that macro. This doesn't seem to make sense and I'm thinking this is a bug with the macro.

Can someone please look into this issue and let me know if/when it should be resolved?

4 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
3 votes
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
June 6, 2018

Hello, @Bart Geens 

1) Yes it possible.

2) You'll need to get worklogs via WorklogManager and create htlm to draw table, based on worklogs.

Here is example:

import com.atlassian.jira.issue.*
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.Worklog

def issue = context.issue as Issue
def workLogManager = ComponentAccessor.getWorklogManager()
//get worklogs for issue
def logsForIssue = workLogManager.getByIssue(issue)
//draw a table via html
String fin ='<table border=\"1\"><tr><th>Author</th><th>Time Spent</th><th>Created</th></tr>'
for(Worklog worklog : logsForIssue)
{
fin = fin +'<tr><td>'+worklog.getAuthorObject().getDisplayName() + "</td><td>" + worklog.getTimeSpent()/60 +"</td><td>"+ worklog.getCreated().toString() + "</td></tr>"
}
fin = fin +'</table>'

writer.write(fin)

 If you locate the panel at atl.jira.view.issue.right.context, it will look like this:

image.png

Bart Geens
June 6, 2018

Thanks for the example!

3 votes
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
June 6, 2018

Hello, Bart,

1) Yes, it possible

2) You need get worklogs via WorklogManager. and create html code that draw you table
Here is example:

import com.atlassian.jira.issue.*
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.Worklog

def issue = context.issue as Issue
def workLogManager = ComponentAccessor.getWorklogManager()
//get worklogs for issue
def logsForIssue = workLogManager.getByIssue(issue)
//draw a table via html
String fin ='<table border=\"1\"><tr><th>Author</th><th>Time Spent</th><th>Created</th></tr>'
for(Worklog worklog : logsForIssue)
{
fin = fin +'<tr><td>'+worklog.getAuthorObject().getDisplayName() + "</td><td>" + worklog.getTimeSpent()/60 +"</td><td>"+ worklog.getCreated().toString() + "</td></tr>"
}
fin = fin +'</table>'

writer.write(fin)



If you locate it at atl.jira.view.issue.right.context, it will be looks like:

image.png

Chhaya Gadade
January 16, 2020

Thanks Markov,this works for me

0 votes
Vijay Sv
Contributor
April 7, 2020

@Mark Markov , Is it possible to display the linked issues of particular link type and its status under Web panel? (Script fragment)

0 votes
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
June 6, 2018

Hello, @Bart Geens

1) Yes it possible.

2) You'll need to get worklogs via WorklogManager and create html to draw table, based on worklogs.

Here is an example:

import com.atlassian.jira.issue.*
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.Worklog

def issue = context.issue as Issue
def workLogManager = ComponentAccessor.getWorklogManager()
//get worklogs for issue
def logsForIssue = workLogManager.getByIssue(issue)
//draw a table via html
String fin ='<table border=\"1\"><tr><th>Author</th><th>Time Spent</th><th>Created</th></tr>'
for(Worklog worklog : logsForIssue)
{
fin = fin +'<tr><td>'+worklog.getAuthorObject().getDisplayName() + "</td><td>" + worklog.getTimeSpent()/60 +"</td><td>"+ worklog.getCreated().toString() + "</td></tr>"
}
fin = fin +'</table>'

writer.write(fin)

 If you locate the panel at atl.jira.view.issue.right.context, it will look like this:

image.png

TAGS
AUG Leaders

Atlassian Community Events